# JetBrains IDE Integration

> **Last verified**: 2026-09-18 · 📄 Per official docs (Claude Code JetBrains plugin 0.1.14-beta (Marketplace; requires IDE ≥2024.2))

## At a glance

| Item | Details |
|---|---|
| Models you can use | Claude ✅ (Claude Code plugin, shares the CLI config) · GPT / Chinese models ⚠️ see JetBrains AI Assistant custom models (separate section) · Gemini ❌ |
| Protocol & Base URL | Anthropic: `https://api.qcode.cc/api` (set in the `claude` CLI env / settings.json) |
| Where to configure | Settings → Tools → Claude Code [Beta] in the IDE; underneath it shares `~/.claude/` |
| Official docs | [code.claude.com/docs/en/jetbrains](https://code.claude.com/docs/en/jetbrains) |

Claude Code offers an official JetBrains plugin. The docs name six IDEs (Android Studio included, which needs Ladybug 2024.2.1 or newer; JetBrains MPS separately needs 2024.3+), and the Marketplace compatibility list adds RubyMine, CLion, Rider, DataGrip and other IntelliJ-platform IDEs — so we do not promise "every IntelliJ-based IDE": check the plugin page inside your own IDE before installing. This guide shows how to install the plugin and point it at the QCode gateway so you can call flagship models like Claude Opus 5 and Sonnet 5 at a lower cost.

The plugin shares the same configuration as the command-line version: as long as your `claude` CLI can reach QCode, the IDE plugin will work too.

## Prerequisites

1. **Claude Code CLI is installed and working** (confirm with `claude --version`; do not match a stale number from this page)
   - Follow the [Installation Guide](/docs/getting-started/installation) to complete installation
   - Follow the [Environment Variables](/docs/getting-started/environment) guide to configure the QCode API
   - Run `claude --version` in a terminal to confirm it works

2. **JetBrains IDE 2024.2 or later** (the Marketplace entry lists build `242.0` as the floor, i.e. 2024.2; on 2024.1 the plugin shows as incompatible)

3. **A QCode API Key** (starts with `cr_`) — the same key works for all endpoints

## Installation Steps

### Step 1: Install the Claude Code Plugin

1. Open your JetBrains IDE

2. Go to **Settings / Preferences** → **Plugins** → **Marketplace**

3. Search for **Claude Code [Beta]** — that is its actual Marketplace name (publisher **Anthropic PBC**, xmlId `com.anthropic.code.plugin`). ⚠️ Searching just "Claude Code" surfaces several unrelated third-party look-alikes first; install the one published by Anthropic PBC

4. Click **Install**

5. Restart the IDE

> Tip: If your network cannot reach the JetBrains Marketplace directly, download the `.zip` package from the plugin's homepage and install it offline via **Plugins** → gear icon → **Install Plugin from Disk...**. Refer to the JetBrains official docs for details.

### Step 2: Configure QCode Access

The plugin reuses the Claude Code CLI configuration. The core is two environment variables:

```bash
export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"
export ANTHROPIC_AUTH_TOKEN="cr_your_api_key"
```

> **Users in mainland China**: replacing `api.qcode.cc` with `asia.qcode.cc` is usually faster and more stable:
>
> ```bash
> export ANTHROPIC_BASE_URL="https://asia.qcode.cc/api"
> ```
>
> The four domains `api` / `asia` / `us` / `eu` share the same API key, so pick whichever is best for your region. The `BASE_URL` must **not** have a trailing slash.

> **Tip**: JetBrains IDEs inherit system environment variables. If you've already configured them in `~/.zshrc` or `~/.bashrc`, the IDE will pick them up on launch — provided the IDE is started from an environment where that config was loaded (see FAQ below).

If you'd rather not rely on global environment variables, you can set them per project instead (see the [FAQ](#environment-variables-not-taking-effect)).

### Step 3: Verify

1. In the IDE, press `Cmd+Esc` (macOS) or `Ctrl+Esc` (Windows/Linux) to open the Claude Code panel

2. Type a simple message (e.g. "hello") to test the connection

3. If you get a normal reply, the plugin is connected successfully through QCode

You can also verify the gateway itself is reachable with `curl` (a `401` means the path is correct and only auth is missing, which is expected):

```bash
curl -i https://api.qcode.cc/api/v1/messages
# HTTP/2 401  ← path is correct, as expected
```

## Usage

### Keyboard Shortcuts

| Shortcut | Function |
|----------|----------|
| `Cmd+Esc` / `Ctrl+Esc` | Open / close the Claude Code panel |
| `Cmd+Option+K` / `Ctrl+Alt+K` | Insert a reference to the current file (@file) in the prompt |
| `Esc` | Interrupt the current generation |

> Actual shortcuts depend on the plugin version and your keymap; search for "Claude" under **Settings** → **Keymap** to customize them.

### Core Capabilities

1. **Code explanation**: Select code → Right-click → **Ask Claude** to have it explain the logic

2. **Code generation**: Describe your requirements in plain language in the Claude panel and let it generate or modify code

3. **Error fixing**: Send a stack trace or error message to Claude for analysis and a fix

4. **Code refactoring**: Select the target code and ask Claude to improve its structure, extract functions, or add tests

### Native Diff View

The plugin is deeply integrated with JetBrains: when Claude proposes file changes, they are shown in the IDE's **native side-by-side diff view**, so you can review each change, accept or reject it, and then write it to disk. This is clearer and safer than a plain terminal diff.

### Using with the Built-in Terminal

The built-in Terminal in JetBrains IDEs can also run the `claude` command directly, providing the full CLI experience. The plugin automatically passes the currently open file and selection as context to the CLI, so the two work best together.

### Image Input (Vision)

Vision-capable models (Claude Opus 5 / Sonnet 5 and the GPT-5.x family) can **read images** as input:

- Paste a screenshot directly (`Ctrl+V`) into the Claude panel
- Drag and drop an image file into the chat box
- Reference an image file path in your prompt

Typical uses: rebuild a UI from a mockup/screenshot, debug from an error screenshot, interpret architecture diagrams and charts.

> This is **image input**, not image generation. To have a model **generate** images, use the `gpt-image-2` model — see [gpt-image-2 Image Generation](/docs/usage/image-2).

### Model Selection

In the Claude panel you can switch models with the `/model` command; all models are called through the same QCode key. Common choices:

| Model | Context | Best for |
|------|--------|----------|
| `claude-opus-5` | 1M | Flagship, complex refactoring and architectural reasoning |
| `claude-opus-4-7` | 1M | Flagship alternative |
| `claude-sonnet-5` | 1M | Everyday coding, balanced value |
| `claude-haiku-4-5` | 200K | Lightweight tasks, quick Q&A |

Prices are not copied onto this page — use the live figures on [qcode.cc/models](https://qcode.cc/models) (administrators can change rates).

> QCode also supports GPT-5.x and Gemini models, but the Claude Code plugin for JetBrains targets the Anthropic protocol; GPT/Gemini are better used in their respective tools such as Codex / Antigravity. Unit prices are whatever [qcode.cc/models](https://qcode.cc/models) shows. 4.x IDs such as `claude-sonnet-4-6` and `claude-opus-4-8` remain on sale.

### Advanced Usage

- **Dynamic Workflows**: include the keyword **`ultracode`** in your prompt (or simply ask to "run a workflow") to orchestrate tens to hundreds of background sub-agents in parallel for large tasks (repo-wide code review, bulk migration, cross-file research, etc.). Sub-agents run in the background while you keep working; check progress with the `/workflows` command. It runs on whatever model Claude Code is configured with — so it works when pointed at QCode. See [Subagents](/docs/advanced/subagents).

- **Headless / automation**: in the IDE terminal you can also use `claude -p "<prompt>"` with `--output-format json|text|stream-json` for scripted calls. `json` returns a structured object containing `result`, `total_cost_usd`, `usage`, and `session_id`, which is easy to parse with `jq`. See [Automation & CI/CD](/docs/advanced/headless).

## The plugin has its own settings page

Officially: **Settings → Tools → Claude Code [Beta]**. The documented items are:

- **Claude command** — which command the plugin uses to start Claude Code, e.g. `claude`,
  `/usr/local/bin/claude`, `npx @anthropic-ai/claude-code`. **When the IDE cannot find `claude`, the
  official fix is to put an absolute path here**, rather than reworking how you launch the shell
- **Suppress notification for when Claude Command is not found** — silence the "command not found" notice
- **Enable using Option+Enter for multi-line prompts** — macOS only
- **Enable automatic updates** — check for and install plugin updates, applied on restart

## Attaching an external terminal: `/ide`

Per the official docs, running `/ide` inside Claude Code in any external terminal connects it to the
running JetBrains IDE and enables all features. On success Claude Code answers with something like
`Connected to IntelliJ IDEA.`; if it detects an IDE without the plugin, `/ide` installs the plugin and
asks you to restart. With QCode this works the same way — the external `claude` uses the
`ANTHROPIC_BASE_URL` you already configured.

## JetBrains Remote Development: install on the host

The docs are explicit: with JetBrains Remote Development the plugin must be installed **on the remote
host**, through **Settings → Plugins → Plugin (Host)**. Installing it on the local client does nothing.

## AI Assistant is a different product

This page is about the **Claude Code plugin**, which drives your own `claude` CLI over the Anthropic
protocol with the base URL taken from an environment variable. JetBrains **AI Assistant** can also use
third-party models, but through another entry: **Settings | Tools | AI Assistant | Providers & API
keys**, and according to the official docs **only the "OpenAI-compatible" kind offers a URL field** —
the Anthropic and Gemini API-key kinds have a key field only.

| Path | Protocol | Custom address? | What QCode can serve there |
|---|---|---|---|
| Claude Code plugin (this page) | Anthropic Messages | yes, `ANTHROPIC_BASE_URL` = `https://api.qcode.cc/api` | Claude models and the Chinese families (Anthropic leg) |
| AI Assistant → OpenAI-compatible | OpenAI Chat Completions | yes, there is a URL field | GPT models and the Chinese families (`https://api.qcode.cc/openai/v1`) |
| AI Assistant → Anthropic / Gemini | native | **no address field in the docs**, vendor key only | cannot point at QCode |

AI completion in AI Assistant (inline completion / next edit) likewise accepts only an
"OpenAI Compatible" endpoint, and the docs warn that inline completion needs Fill-in-the-Middle support,
which general chat models usually lack.

## FAQ

### Claude Code panel not showing?

1. Confirm the plugin is installed and enabled (**Settings** → **Plugins** → **Installed**)

2. Confirm Claude Code CLI is globally installed: run `claude --version` in a terminal — it should print a version (see [official Releases](https://github.com/anthropics/claude-code/releases))

3. Confirm the IDE version is ≥ 2024.2

4. Restart the IDE; if needed, run **File** → **Invalidate Caches / Restart**
### `Esc` does not interrupt the current generation?

Official troubleshooting entry: in JetBrains terminals `Esc` is grabbed by the IDE to move focus to the
editor. Fix it under **Settings → Tools → Terminal** — either untick **"Move focus to the editor with
Escape"**, or click **"Configure terminal keybindings"** and delete the "Switch focus to Editor" shortcut.

### Environment variables not taking effect?

JetBrains IDEs may not pick up environment variables from your shell configuration files (GUI-launched processes often don't load `~/.zshrc`). Solutions:

- **macOS**: Launch the IDE from the terminal (e.g. `open -a "IntelliJ IDEA"`) instead of clicking the Dock icon; or use **Tools** → **Create Command-line Launcher** and start it from a terminal

- **All platforms**: Manually add `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` in **Run/Debug Configurations** → **Environment variables**

- **Persistence**: Set them via JetBrains Toolbox, `*.vmoptions`, or system-level environment variables so they are read on every launch

### Authentication failure / 401 / 403?

1. Check that `ANTHROPIC_AUTH_TOKEN` is a valid QCode key starting with `cr_`, with no stray spaces or quotes

2. Confirm `ANTHROPIC_BASE_URL` has **no** trailing slash and the path is `/api` (Anthropic protocol)

3. Run `curl -i https://api.qcode.cc/api/v1/messages`: a `401` means the gateway is reachable (only auth is missing); a connection error indicates a network/proxy problem

### Connection timeouts / blocked behind a corporate proxy?

- Users in mainland China should switch to `asia.qcode.cc` first

- If you're behind a corporate proxy, make sure the IDE's **Settings** → **Appearance & Behavior** → **System Settings** → **HTTP Proxy** is configured correctly, or set the `HTTPS_PROXY` environment variable for the terminal

- Confirm your firewall allows the IDE process outbound access to `*.qcode.cc:443`

### Changed environment variables but the IDE doesn't notice?

Environment variables are read once at process startup. After editing `~/.zshrc` or system variables, you must **fully quit and restart the IDE** (not just reopen a window) for the changes to take effect.

## Next Steps

- See [Endpoints & API Formats](/docs/getting-started/endpoints-and-api-paths) for the four domains and the base URL for each protocol

- See [VS Code Integration](/docs/ide/vscode) for the VS Code extension

- See [Cline Integration](/docs/ide/cline) for another VS Code AI extension

- See [CLI Tips](/docs/usage/cli-tips) for terminal usage tips

> Wondering which model is most cost-effective to run in JetBrains? Check the [QCode pricing page](https://qcode.cc/pricing) and pick Opus / Sonnet / Haiku to fit your budget.