Cline Setup Guide (2026): API Key, VS Code, JetBrains and Cline CLI Commands
On this page
Short answer:
- VS Code and similar editors: open the Extensions view, search Cline, install it, then click ⚙️ in the Cline panel and pick an API Provider.
- JetBrains IDEs and Android Studio: Settings → Plugins → Marketplace, search Cline, install, restart, then open View → Tool Windows → Cline.
- Terminal: run
npm install -g cline(Node.js 20+), thencline auth.
For any OpenAI-compatible service, choose OpenAI Compatible and fill in the Base URL, API Key and Model ID. In the CLI, that's one command: cline auth -p openai-compatible -k <key> -m <model> -b <base-url>.
We first wrote this guide on Cline CLI 3.0.71 in October 2026. On November 23, 2026 we installed the current release, Cline CLI 3.0.75 (published November 21 alongside extension 4.1.27), into a throwaway folder on a Mac and ran every command shown below. The outputs come from that run.
What Cline is
Cline is an open-source coding agent. It proposes file edits and commands and, depending on your approval settings, either waits for you or carries them out. It comes in several forms:
| Form | Where | Notes |
|---|---|---|
| IDE extension | VS Code, Cursor, Windsurf, VSCodium, Antigravity | The most-used form. Windsurf and VSCodium install from Open VSX |
| JetBrains plugin | IntelliJ IDEA, Android Studio, PyCharm, WebStorm, GoLand and more | Same settings panel as the VS Code extension |
| Cline CLI | Any terminal | Interactive mode, plus headless mode for scripts and CI |
| Cline Desktop | macOS, Windows (beta) | Standalone app |
You choose where the models come from:
- Cline (usage-billing): sign in with Google, GitHub or email and pay as you go with Cline credits. Models tagged FREE cost nothing while the promotion lasts.
- ClinePass: a $9.99/month subscription for a set of open coding models, with usage measured over a 5-hour window plus weekly and monthly limits.
- Your own provider key: Anthropic, OpenAI, Gemini, DeepSeek, Amazon Bedrock, any OpenAI-compatible API, or local models through Ollama and LM Studio. The November 2026 release added dozens more providers.
Install the IDE extension
- Press
Cmd+Shift+X(macOS) orCtrl+Shift+Xto open Extensions. - Search for Cline and click Install.
- Open Cline from the sidebar and click ⚙️ to choose a provider.
Install Cline in JetBrains IDEs and Android Studio
Cline's JetBrains plugin is published by Cline Bot Inc. on the JetBrains Marketplace. Version 2.0.9 (October 2026) supports IDEs built on platform 2025.1 through 2026.3, and its compatible products include Android Studio, IntelliJ IDEA, PyCharm, WebStorm, GoLand, PhpStorm, CLion, Rider, RubyMine and RustRover.
- Open Settings → Plugins → Marketplace. On macOS, Settings is under the IDE's own menu (for example Android Studio → Settings); on Windows and Linux it's File → Settings.
- Search for Cline, click Install, and restart the IDE.
- Open the panel with View → Tool Windows → Cline.
- Click ⚙️, choose an API Provider, and paste your API key. The provider list and fields are the same as in VS Code (see Connect a provider).
If Cline doesn't show up in the Marketplace search, your IDE is older than the plugin's supported range. Update the IDE first. One Android Studio user reported a blank Cline panel that was tied to the IDE's embedded browser runtime (JCEF), not to the API key (cline/cline#11578).
Install the Cline CLI
The CLI needs Node.js 20 or later (22 recommended):
npm install -g cline
It's a big install, about 390 MB on our machine. Check it:
cline --version
3.0.75
Then run cline auth for interactive setup, or configure it in one line (next section). To update later, run cline update.
Connect a provider
In the IDE extension or JetBrains plugin
Click ⚙️ in the Cline panel, choose an API Provider, and fill in what it asks for:
| Provider | Fields | Notes |
|---|---|---|
| Cline | Sign In | Pay-as-you-go credits and FREE models |
| ClinePass | Sign In | Subscription. Subscribe on the Cline dashboard first |
| Anthropic | Anthropic API Key, Model | Optional Use custom base URL for proxies and gateways |
| OpenAI | OpenAI API Key, Model, optional Base URL | |
| OpenAI Codex | Sign in with OpenAI | Uses a ChatGPT plan instead of an API key |
| OpenAI Compatible | Base URL, API Key, Model ID | For any service with an OpenAI-style API. Use Verify to test |
| Claude Code | Path to the claude CLI |
Uses your Claude Pro/Max subscription instead of API billing |
Under OpenAI Compatible, the Model Configuration section sets the model's max output tokens, context window, image support, computer use and input/output prices. Cline uses those numbers to track context and cost, so set them to match the real model.
In the CLI, non-interactively
cline auth takes the provider, key, model and base URL as flags, which is handy for scripts and new machines:
cline auth -p openai-compatible -k "sk-your-key" -m gpt-6.1-sol -b https://api.foo/v1
Provider configured: openai-compatible (gpt-6.1-sol)
That example uses api.foo, the API gateway that publishes these docs. Any OpenAI-compatible base URL works the same way. To check the wiring, we configured a deliberately invalid key and ran a task. Cline reached the gateway, which rejected the key ("无效的令牌" means "invalid token"):
cline --json --auto-approve false "say hi"
{"type":"error","message":"无效的令牌 (request id: …)"}
Getting the gateway's own error back proves the base URL and the /v1 path were combined correctly. With a real key, the same command returns the model's answer.
Two CLI gotchas we hit:
- Custom base URLs only work for OpenAI-type providers.
cline auth -p anthropic … -b https://…fails witherror: base URL is only supported for OpenAI and OpenAI-compatible providers. To reach Claude models through a gateway from the CLI, useopenai-compatiblewith the gateway's/v1URL and a Claude model ID. -pmeans different things. Incline auth,-pis the provider. On the mainclinecommand,-pis Plan mode and the provider flag is capital-P.
Where the config lives
Cline keeps its CLI state in ~/.cline by default. Provider keys are stored in ~/.cline/data/settings/providers.json, and its lastUsedProvider field shows which provider the CLI will use. The log is in ~/.cline/data/logs/cline.log (cline doctor log opens it). Point the CLI elsewhere with --config <dir> or the CLINE_DIR variable, or use --data-dir <dir> for a fully isolated sandbox, which is useful for testing or for running several configurations side by side.
The CLI also starts a small background service (the "hub") on 127.0.0.1:25463. cline doctor shows whether it's running, and cline doctor fix stops all Cline processes.
Cline CLI commands
From cline --help on 3.0.75:
| Command | What it does |
|---|---|
cline |
Start an interactive session in the current folder |
cline "task" |
Run one task. Auto-approves tools by default |
cline --auto-approve false "task" |
Run one task but ask before each action |
cline -p "task" |
Start in Plan mode (plan first, then act) |
cline --json "task" |
JSON output for scripts and CI |
git diff | cline "review these changes" |
Pipe context into a task |
cline -P <provider> -m <model> "task" |
Use a different provider or model for this run |
cline --thinking high "task" |
Set reasoning effort: none, low, medium, high, xhigh |
cline -c <path> "task" |
Run in another folder |
cline --worktree "task" |
Run in a separate git worktree under ~/.cline/worktrees/ |
cline --id <session-id> |
Resume an earlier session |
cline -t 300 "task" |
Stop after 300 seconds |
cline auth |
Set up a provider and model (interactive, or with -p -k -m -b) |
cline config |
Browse configuration (needs a terminal); cline config --json prints it |
cline history |
List past sessions; cline history export <id> saves one as HTML |
cline mcp add <name> / cline mcp remove <name> |
Manage MCP servers |
cline doctor |
Diagnose problems; doctor fix stops stuck processes, doctor log opens the log |
cline update |
Check for updates and install them |
cline version |
Print the version |
Newer commands also appear in the help: skill, plugin, schedule, connect (chat channels such as Slack or Telegram), hub and kanban. Run cline <command> --help for each one's options.
Because a task given on the command line auto-approves by default, run it on a clean branch or inside --worktree, or add --auto-approve false.
Does Cline have autocomplete?
No. Cline doesn't offer inline Tab completion as you type. We checked extension 4.1.27's manifest: it registers no inline completion feature, and Cline's docs have no autocomplete page. Cline works on tasks you describe in its chat panel. The closest editor shortcuts are:
- Select code and press
Cmd+'(Ctrl+'on Windows and Linux) to Add to Cline. With nothing selected, the same key jumps to the chat input. - Right-click selected code for Explain with Cline or Improve with Cline.
- In Source Control, Generate Commit Message with Cline.
If you want Tab completion too, keep your editor's own completion feature on next to Cline. The CLI has no shell-completion command either: cline --help lists none in 3.0.75.
Troubleshooting
"Unauthorized: Please make sure you're using the latest version of Cline and re-authenticate your Cline account"
This error comes from Cline's own provider (Cline credits, ClinePass or the FREE models). Cline's servers rejected the sign-in. Your own Anthropic or OpenAI-compatible key is not involved.
You'll usually see it in one of three cases:
- The CLI has no provider saved. The provider defaults to
cline. In our test with an empty--data-dir,cline "say hi"picked a free Cline model and failed with this exact message in under a second. - Your Cline session expired. Cline's docs say to click Sign In again, and to do a full sign-out and sign-in if it keeps happening (Authorization).
- An old Cline version. In 2025, users got this error at random after the IDE sat idle. A Cline contributor said v3.32.1 fixed it, and reporters confirmed the fix in VS Code and JetBrains (cline/cline#6489).
To fix it:
- Update Cline. In the CLI, run
cline update. In VS Code or JetBrains, update the extension or plugin and restart the IDE. - Sign in again. In the IDE, click ⚙️, choose Cline (or ClinePass) as the API Provider and click Sign In. In the CLI, run
cline authand choose Cline. - Or switch to your own key. If you never meant to use Cline's provider, set yours. In the CLI, run
cline auth -p openai-compatible -k <key> -m <model> -b <base-url>, then checklastUsedProviderin~/.cline/data/settings/providers.json. In the IDE, pick your provider in the API Provider menu.
Other errors
| Message | Cause | Fix |
|---|---|---|
Invalid API Key / 401 |
Wrong key, or a key from a different provider than the base URL | Re-paste the key from the same service |
Model Not Found |
The model ID doesn't exist at that base URL | Copy the exact ID from the provider's model list |
| Connection errors | Wrong base URL, or a proxy or firewall blocks it | Check the URL. It usually ends in /v1 for OpenAI-compatible services |
base URL is only supported for OpenAI and OpenAI-compatible providers |
You passed -b with a non-OpenAI provider in the CLI |
Use openai-compatible, or the IDE extension's Anthropic custom base URL |
interactive mode requires a TTY |
You ran cline config or another interactive command from a script |
Use cline config --json, or run it in a real terminal |
| Cline keeps running after you quit | The background hub is still up | cline doctor fix |
For HTTP status codes in general, see LLM API errors and rate limits.
Related
FAQ
What is Cline?
Cline is an open-source AI coding agent that reads files, writes code and runs commands. It runs as an extension for VS Code, Cursor, Windsurf, VSCodium and Antigravity, as a plugin for JetBrains IDEs including Android Studio, as a terminal CLI, and as a desktop app. It works with many model providers, including your own API keys.
Is Cline free?
The extension, plugin and CLI are free. You pay for models through your own provider key, through Cline's pay-as-you-go credits, or with a ClinePass subscription ($9.99/month). Cline also offers limited-time free models, tagged FREE in the model picker, to users signed in with a Cline account.
How do I fix "Unauthorized: Please make sure you're using the latest version of Cline and re-authenticate your Cline account"?
The error comes from Cline's own provider, not from your API key. Update Cline (cline update for the CLI), then sign in again with cline auth or the Sign In button. If you meant to use your own key, switch the provider to it with cline auth -p openai-compatible or in the extension's API Provider menu.
Does Cline work in JetBrains IDEs and Android Studio?
Yes. Install the Cline plugin from Settings → Plugins → Marketplace. Version 2.0.9 lists IntelliJ IDEA, Android Studio, PyCharm, WebStorm, GoLand and other JetBrains IDEs built on platform 2025.1 to 2026.3, and uses the same API Provider settings as VS Code.
How do I install the Cline CLI?
Install Node.js 20 or later (22 recommended), run npm install -g cline, then cline auth to choose a provider and model. Start a session with cline, or run a single task with cline "your task".
How do I use Cline with an OpenAI-compatible API?
In the extension, choose OpenAI Compatible as the API Provider and fill in Base URL, API Key and Model ID. In the CLI, run cline auth -p openai-compatible -k <key> -m <model> -b <base-url>. The base URL usually ends in /v1.
Can the Cline CLI use a custom Anthropic base URL?
Not through cline auth. Version 3.0.75 still rejects it with "base URL is only supported for OpenAI and OpenAI-compatible providers". The IDE extension's Anthropic provider does have a "Use custom base URL" option.
Found a mistake? Email support@api.foo.