Connect Cline to Router One through the OpenAI Compatible provider
Cline is an open-source autonomous coding agent that runs as an extension in VS Code, Cursor, Windsurf, VSCodium, Antigravity and JetBrains IDEs, as Cline Desktop, and as a command-line tool. It reads and edits files, runs commands and calls tools, and it bills through whichever provider you configure. Its OpenAI Compatible provider sends each model turn to Router One as POST /v1/chat/completions on your key, so one key reaches the Claude, GPT, Gemini, Grok and DeepSeek chat models in the catalog, and every turn the gateway forwards to a model is a separate request in Dashboard → Logs (requests refused before any model is called have no record, and a streamed turn that failed before any output may have no record either). Three values carry the setup: Base URL, API Key and Model ID. Two more settings that Cline cannot learn from the gateway, the context window and image support, decide how well long sessions go. Cline's docs keep provider settings for the extension, the CLI and the SDK in one file, ~/.cline/data/settings/providers.json. Checked against Cline 4.1.28 (extension, released 2026-11-26) and Cline CLI 3.0.76 (released 2026-11-26) on 2026-11-27, per Cline's docs, release notes and v4.1.28 source.
Install Cline and create a dedicated key
Install the extension from the VS Code Marketplace (extension ID saoudrizwan.claude-dev), from Open VSX for Windsurf and VSCodium, or from the JetBrains Marketplace; as of 2026-11-27 the VS Code Marketplace lists 4.1.28 (released 2026-11-26). The CLI is an npm package that needs Node.js 20 or newer, with 22 recommended: npm install -g cline installs it, and cline version prints the installed version (3.0.76 on npm as of 2026-11-27). Then create a Router One key for Cline alone and give it a maxSpend cap. Top up with a card, Alipay or WeChat Pay through hosted checkout, or with USDT/USDC on six chains (Tron, BSC, Ethereum, Polygon, Base, Arbitrum). No US credit card required. An agent task sends one request per model turn, including every turn that only hands a tool result back to the model, so a long task can send dozens of metered requests (wallet charge or plan quota) without further input from you. The cap is the hard stop on wallet charges, and a dedicated key lets you filter Dashboard → Logs down to Cline's requests.
Configure Cline to use the Router One base URL
Open the Cline panel, click the gear icon and choose OpenAI Compatible under API Provider. Base URL is https://api.router.one/v1: Cline removes trailing slashes and appends /chat/completions and /models itself, so don't paste a full endpoint URL. Paste the key into API Key. The Model ID field is a dropdown that Cline fills by calling GET {Base URL}/models with your key; Router One answers that call only when a key is present, and since Cline 4.1.27 the list refreshes automatically after you save the API key or Base URL (a failed refresh, such as a rejected key, shows as an error in the picker). It contains every catalog ID, image-generation models included, so pick a chat model whose detail page lists tool calling, because Cline's agent works through tool calls. Because OpenAI Compatible sends /v1/chat/completions and OpenAI's GPT-6 / GPT-6.2 guides require /v1/responses for tool calling on GPT-6 Astra, GPT-6.1 and GPT-6.2 (and GPT-6 Sol supports Chat Completions function calling only with reasoning_effort set to none), pick a Chat Completions tool-capable model such as anthropic/claude-sonnet-5, openai/gpt-5.6-sol, deepseek-v4-flash or grok-4.7 (or choose Use custom model ID… and type the exact ID from /models). Then open Model Configuration, described in the next section:
- Base URL
- https://api.router.one/v1
# Cline panel → gear icon → API Provider: OpenAI Compatible Base URL: https://api.router.one/v1 API Key: sk-your-router-one-key Model ID: anthropic/claude-sonnet-5 (or Use custom model ID… + a Chat Completions tool-capable ID from /models) # Model Configuration Context Window Size: 1000000 (the model page's window as a whole number; default 128000) Supports Images: only if the model page lists image input
Set Model Configuration: context window and image support
Cline knows nothing about a custom model beyond what you enter, and its defaults for an OpenAI Compatible model (openAiModelInfoSafeDefaults in the 4.1.28 source) are a 128,000-token context window with image support switched on. Cline plans compaction around that window, so on a model with a 1M window it condenses the conversation long before it needs to. Set Context Window Size from the model's page on /models, which shows the window rounded (1.05M, 200K), and enter it as a whole number rounded down: 1000000 for anthropic/claude-sonnet-5, openai/gpt-5.6-sol and deepseek-v4-flash, and 200000 for anthropic/claude-haiku-4.5. Tick Supports Images only when the model page lists image input. deepseek-v4-flash, for example, is text-only: with the box ticked, a pasted screenshot is sent and the gateway returns HTTP 400 with "model 'deepseek-v4-flash' has no chat candidate that supports requested capabilities: vision", while with the box unticked, Cline 4.1.19 and later mark the image as ignored in the composer instead of sending it. Leave Max Output Tokens and Temperature empty unless you have a reason to set them; your key's maxSpend caps wallet charges. Input Price / 1M tokens and Output Price / 1M tokens only feed Cline's own estimate; Dashboard → Logs records the actual wallet charge or plan quota used for each request the gateway forwards to a model. Custom Headers are not needed for Router One.
Use the same key from the Cline CLI
One command configures the CLI: cline auth with --provider openai-compatible, --apikey, --modelid and --baseurl, as in the block below. The CLI accepts --baseurl only for the OpenAI Compatible and OpenAI providers, and openai is an alias of openai-compatible. Cline's configuration docs list ~/.cline/data/settings/providers.json as the file that holds API keys and provider configuration for the extension, the CLI and the SDK alike; CLINE_DATA_DIR moves the whole directory, and cline config shows the active configuration. Start a task with cline "your prompt". The CLI reference lists cline, Cline's own provider, as the default provider ID, so pass -P openai-compatible and -m with a catalog ID when a run must go to Router One regardless of what was selected last; note that -k / --key sets the API key for the run and also saves it as the provider's key. Since CLI 3.0.75, one-shot runs (a prompt argument or piped stdin) start in yolo mode by default instead of act mode and edit files or run commands without asking; pass --auto-approve false (or --act / --plan) to confirm steps, and keep the maxSpend cap on the key either way. CLI 3.0.75 also no longer reads .env or bunfig.toml from the directory it is launched in.
npm install -g cline # Node.js 20+, 22 recommended (3.0.76 as of 2026-11-27) cline auth --provider openai-compatible \ --apikey sk-your-router-one-key \ --modelid anthropic/claude-sonnet-5 \ --baseurl https://api.router.one/v1 cline config # show the active configuration cline -P openai-compatible -m anthropic/claude-sonnet-5 --auto-approve false "Reply with OK"
Put Plan and Act on different models
Cline works in two modes. In Plan mode it reads the code and proposes an approach; in Act mode it edits files and runs commands. Tick Use different models for Plan and Act in Cline's settings and each mode keeps its own model: switching modes switches the model, and Cline remembers each selection. Cline's docs suggest a stronger reasoning model for planning and a faster one for implementation, for example openai/gpt-5.6-sol for Plan and anthropic/claude-sonnet-5 for Act, both on the same Router One key. Each mode's requests forwarded to a model appear under their own model ID in Dashboard → Logs, so filtering by model shows the wallet charge or plan quota used by planning and implementation separately.
What Cline's requests look like on the gateway
Each model turn is one POST /v1/chat/completions with Bearer authentication, streamed, with Cline's tool definitions attached. Dashboard → Logs records each turn the gateway forwards to a model (a request refused before any model is called — 401, 402, key/account 429, or 400/404 for the model ID or endpoint — has no record, and a streamed turn that failed before any output may have no record either), showing its model, tokens, wallet charge or plan quota used, status, total time and, for a streamed turn that produced output, time to first token (TTFT). Since Cline 4.1.26 and CLI 3.0.74, model requests retry at most three times (reduced from five, so up to four total attempts), including mid-stream provider errors (CLI 3.0.72) and connection drops after reasoning-only output (4.1.26 / CLI 3.0.74); since 4.1.23, a response that ends without a recognized finish reason can also send one follow-up continuation request. Since 4.1.27, the Reasoning Effort dropdown shows the effort a new task will use and provides a Default entry that clears the saved setting; choosing an explicit level sends reasoning_effort on each request (4.1.27 and CLI 3.0.75 also fixed applying off/None on custom models with saved Model Configuration overrides). Router One maps the value to output_config.effort on Claude Opus 5.5 and Claude Sonnet 5.5 (none and minimal become low); whether another model honors it, ignores it or rejects the request with 400 depends on the model, so check the next turn's status in Logs after changing it. Router One serves the GPT, Claude, Gemini, Grok and DeepSeek chat models on this one endpoint, which is why the OpenAI Compatible provider covers every family. Cline's other providers are not the path here: its Anthropic provider picks from a fixed model list that doesn't accept catalog IDs, and its OpenAI provider uses the Responses API with a built-in model list and has no Base URL field in the VS Code settings.
Which model ID should Cline send?
Copy the exact model ID from /models, preserving case, hyphens, and version suffixes; do not substitute a display name. Open its detail page and match the supported API endpoints, context window, and capabilities such as tool calling to the provider and features selected in Cline. A catalog listing does not mean the client can use every feature of that model. Give each client or application a dedicated API key with a maxSpend cap. A key's spend cap (maxSpend) limits what that key can charge to your wallet: once its cumulative wallet charges reach the cap, its wallet-billed requests return HTTP 402. Requests covered by your plan's quota draw from the account's shared plan quota and do not count toward any key's cap.
Which API protocol is Cline using?
OpenAI-compatible describes an interface format; it does not make Chat Completions (/v1/chat/completions), Responses (/v1/responses), and Anthropic Messages (/v1/messages) interchangeable. Check the installed client version, provider configuration, and actual request path against the model detail page and API compatibility fact sheet. A successful plain-text chat does not establish support for hosted tools, conversation state, or file-editing features.
Verify the Cline call in your request trace
Send a simple text request from Cline, then match its trace in Dashboard → Logs by time, model, and request_id: tokens, the wallet charge or plan quota it used, latency, and status. Next, test streaming, tool calls, and multi-turn history separately. For failures, retain the actual request path, full error message, and request_id. If there is no matching log, either the request never reached the gateway (client configuration or connectivity) or the gateway refused it before calling a model — a 401 for the key, a 402 for funds, a 429 from your key's or account's limits, or a 400 or 404 for the model ID or endpoint; a streamed request that failed before any output may have no log either. The status and error message the client received tell which, so check them before attributing the error to the gateway or upstream.
FAQ
Where do these settings live in Cline?
In the extension, open the Cline panel, click the gear icon and choose API Provider → OpenAI Compatible. The fields are Base URL, API Key and Model ID, with Model Configuration below them for Supports Images, Context Window Size, Max Output Tokens, the two prices and Temperature, plus a Reasoning Effort selector (with a Default entry since 4.1.27) and Custom Headers. On disk, Cline's docs place API keys and provider configuration for the extension, the CLI and the SDK in ~/.cline/data/settings/providers.json, and CLINE_DATA_DIR relocates that directory. The file holds your key, so keep it out of dotfile repositories and shared backups.
The Model ID dropdown is empty, a request returns 404, or the list is full of image models. Why?
Cline fills the dropdown from GET https://api.router.one/v1/models, sent with your key, and Router One answers only when a key is present, so the list stays empty until the key is saved (since 4.1.27, saving the API key or Base URL triggers a refresh and surfaces refresh failures as an error in the picker). Check that Base URL ends in /v1 with nothing after it: per Cline's v4.1.28 source (checked 2026-11-27), Cline trims trailing slashes and appends /models and /chat/completions itself, so a full endpoint URL doubles the path, and a 404 on the model list or on a chat turn usually means a wrong path or a model ID outside the catalog. Once it loads, the list holds every catalog ID, image-generation models included, and those can't serve Cline's chat turns. Pick a chat model whose page on /models lists tool calling on Chat Completions (avoid Responses-only GPT-6 models — GPT-6 Astra, GPT-6.1 and GPT-6.2 — here; GPT-6 Sol also supports Chat Completions function calling only with reasoning_effort set to none), or choose Use custom model ID… and type the exact ID. A request that leaves no record in Dashboard → Logs either never reached Router One or was refused before any model was called — a 401 for the key, a 402, a 429 from the key's or account's limits, or a 400 or 404 for the model ID or endpoint — and a streamed turn that failed before any output may have no record either, so read the status and message Cline shows first.
Why does Cline compact the conversation at around 128K tokens?
Because 128,000 tokens is the context window Cline assumes for any OpenAI Compatible model you haven't described. Set Context Window Size under Model Configuration to the window on the model's page, written as a whole number and rounded down (1.05M becomes 1000000, 200K becomes 200000), and Cline plans compaction around the real window instead.
The agent answers but never edits files. What's wrong?
Cline edits files and runs commands through tool calls, so the model has to return them on /v1/chat/completions. Pick a Chat Completions tool-capable ID (such as anthropic/claude-sonnet-5, openai/gpt-5.6-sol, deepseek-v4-flash or grok-4.7; avoid Responses-only GPT-6 models — GPT-6 Astra, GPT-6.1 and GPT-6.2 — on Chat Completions, and note that GPT-6 Sol takes Chat Completions function calling only with reasoning_effort set to none). If the gateway rejects a request with HTTP 400 and "has no chat candidate that supports requested capabilities: tool_calling", the chosen ID cannot take tool calls; switch models. If you are on an earlier 4.1 build, update: 4.1.13 restored tool calling for custom OpenAI Compatible models whose capability list Cline had inferred, and 4.1.27 fixed reasoning-off settings on custom models with saved Model Configuration overrides.
Can I use Cline's Anthropic or OpenAI provider with Router One instead?
Use OpenAI Compatible. Cline's Anthropic provider picks models from a fixed list, so catalog IDs such as anthropic/claude-sonnet-5 can't be entered there, and its OpenAI provider uses the Responses API with a built-in model list and has no Base URL field in the VS Code settings. Router One serves Claude, GPT, Gemini, Grok and DeepSeek chat models on /v1/chat/completions, so the OpenAI Compatible provider reaches all of them with one configuration; for Cline's tool-calling agent turns, choose an ID that supports tool calling on Chat Completions (per OpenAI's docs, GPT-6 Astra, GPT-6.1 and GPT-6.2 take tool calls only on /v1/responses).
Do I configure the VS Code extension and the CLI separately?
Cline's docs describe one provider store for both: ~/.cline/data/settings/providers.json holds API keys and provider configuration for the extension, the CLI and the SDK. cline auth --provider openai-compatible with --apikey, --modelid and --baseurl writes the Router One entry from the terminal, and cline config shows what the CLI will use. When a CLI run must go to Router One, pass -P openai-compatible explicitly, since the CLI's default provider ID is cline; passing -k / --key also saves that key as the provider's key.
Which Cline version is this guide for?
Checked on 2026-11-27 against Cline 4.1.28 (extension, released 2026-11-26) and Cline CLI 3.0.76 (released 2026-11-26), including the 4.1.24–4.1.28 and CLI 3.0.71–3.0.76 release notes and v4.1.28 source. In both, the default provider is Cline's own, so requests reach Router One only after you select OpenAI Compatible and enter the three values. Model Configuration applies to the extension; the context window and image settings are worth checking again after an update, because Cline stores them per model.
Which models can Cline use through the gateway?
Choose a current catalog model that supports both the endpoint and the features Cline uses. Check /models and the model detail page for the exact ID, current rates, and capabilities; a family name such as GPT or Claude is not a compatibility guarantee. A client that lists a model has only read the ID, from its own configuration or from GET /v1/models; verify an actual request too.
Models are listed, but requests fail with 400 or 404. What should I check?
Record the actual request path and error message, then check the exact model ID. A 400 can indicate invalid parameters, unsupported tools, or a model/endpoint mismatch; a 404 can indicate an incorrect path or missing resource, so it does not by itself establish that a model was retired. If the error says must be called via, use the named endpoint or select a model supported on the current endpoint. Do not add or remove /v1 or /chat/completions across all clients indiscriminately.
Does this work from Mainland China?
Yes. The gateway is reachable from Mainland China without a VPN, and the configuration is identical to the global setup.
How do I debug a 401/402/403/429?
Start from what your client received: the status, the error body and the X-Request-ID header. A 401 (missing, unknown, revoked or expired key), a 402 (wallet balance, or the key's maxSpend cap) and a 429 from your key's or account's rate limits are refused before any model is called, so they never appear in Dashboard → Logs — nor does a 400 or 404 for a wrong model ID or endpoint. For 401, check that the full key is sent and still active in Dashboard → API Keys; for 402, top up or raise the key's maxSpend; for a 403, keep the full error body. For 429, back off and retry later; a 429 that does show up in Logs came back from upstream after the gateway's retries. Keep the request_id and follow the error-codes reference.