api.foo
api.foo / Docs / Cline setup (IDE & CLI)

Cline Setup Guide (2026): VS Code Extension and Cline CLI with Any API Provider

Updated · Tested on: macOS · Cline CLI 3.0.71 · Node.js 22
On this page

Short answer:

  • IDE: open the Extensions view, search Cline, install it, then click the ⚙️ in the Cline panel and pick an API Provider.
  • Terminal: run npm install -g cline (Node.js 20+), then cline 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 installed Cline CLI 3.0.71 on a Mac on October 15, 2026 and configured it non-interactively against a real endpoint. The outputs below come from that run.

What Cline is

Cline is an open-source coding agent with an approve-each-step workflow: it proposes file edits and commands, and you approve them, unless you turn on auto-approve. It comes in several forms:

Form Where Notes
IDE extension VS Code, Cursor, Windsurf, VSCodium, JetBrains The original and most-used form. Windsurf and VSCodium install from Open VSX
Cline CLI Any terminal Interactive TUI, plus headless mode for scripts and CI
Cline Desktop macOS, Windows (beta) Native app focused on open-weight models

You choose where the models come from: Cline (usage-billing) with pay-as-you-go credits, ClinePass (a $9.99/month subscription for popular open coding models), or your own provider key (Anthropic, OpenAI, Gemini, DeepSeek, OpenRouter, Bedrock, any OpenAI-compatible API, or local models via Ollama and LM Studio).

Install the IDE extension

  1. Press Cmd+Shift+X (macOS) or Ctrl+Shift+X to open Extensions.
  2. Search for Cline and click Install.
  3. Open Cline from the sidebar and click ⚙️ to choose a provider.

On JetBrains IDEs, go to Settings → Plugins → Marketplace, search for Cline, install it, and restart the IDE.

Install the Cline CLI

The CLI needs Node.js 20 or later (22 recommended):

npm install -g cline
added 330 packages in 14s

It's a big install, about 360 MB on our machine. Check it:

cline --version
3.0.71

Then run cline auth for interactive setup, or configure it in one line (next section).

Connect a provider

In the IDE extension

Click ⚙️ in the Cline panel, choose an API Provider, and fill in what it asks for:

Provider Fields Notes
Anthropic Anthropic API Key, Model Optional Use custom base URL for proxies and gateways
OpenAI API key or Codex sign-in
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 lets you set the model's context window, max output tokens, image support and per-token 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 ran a task with a deliberately invalid key. Cline reached the gateway, which rejected the key ("无效的令牌" means "invalid token"):

cline --json "say hi"
{"type":"error","message":"无效的令牌 (request id: …)"}

The gateway's log showed the request arriving at POST /v1/chat/completions, so the base URL was combined correctly.

Two CLI gotchas we hit:

  • Custom base URLs only work for OpenAI-type providers. cline auth -p anthropic … -b https://… fails with error: base URL is only supported for OpenAI and OpenAI-compatible providers. To reach Claude models through a gateway from the CLI, use openai-compatible with the gateway's /v1 URL and a Claude model ID.
  • Without a saved provider, Cline falls back to its own provider and fails with Unauthorized: Please make sure you're using the latest version of Cline and re-authenticate your Cline account. If you see that after setting up your own key, run cline config to check which provider is active.

Where the config lives

Cline keeps its CLI state in ~/.cline by default. Provider keys are stored in ~/.cline/data/settings/providers.json, and the log is in ~/.cline/data/logs/cline.log (cline doctor log opens it). Point it 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.

Everyday CLI usage

Command What it does
cline Interactive session in the current folder
cline "task" Run one task
cline -p "task" Start in Plan mode (plan first, then act)
cline --json "task" Headless JSON output for scripts
git diff | cline "review these changes" Pipe context in. Piping switches to headless mode
cline --auto-approve true "task" No approval prompts. Use only on a clean branch
cline config Show current configuration
cline doctor Diagnose configuration problems
cline history Browse past tasks
cline mcp Manage MCP servers

Troubleshooting

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
Unauthorized: … re-authenticate your Cline account Cline is using its own provider, not yours Run cline auth with your provider, then cline config to confirm

For HTTP status codes in general, see LLM API errors and rate limits.

FAQ

What is Cline?

Cline is an open-source AI coding agent that reads files, writes code and runs commands with your approval. It runs as an extension for VS Code, Cursor, Windsurf and JetBrains IDEs, as a terminal CLI, and as a desktop app, and works with many model providers including your own API keys.

Is Cline free?

The extension 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 runs limited-time free model promotions for users with a Cline account.

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.71 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 [email protected].