Skip to content

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, 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 sends to a model is a separate request in Dashboard → Logs (a streamed turn that failed before any output may have no record). 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.21 (extension) and Cline CLI 3.0.65 on 2026-09-27; re-checked on 2026-10-09 against the 4.1.22 and 4.1.23 release notes and the CLI 3.0.66–3.0.70 changelog, which list no change to the settings below.

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; on 2026-10-09 the VS Code Marketplace listed 4.1.23, released on October 7, 2026. 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.70 on npm as of 2026-10-09). Then create a Router One key for Cline alone and give it a maxSpend cap. 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 bill dozens of requests without further input from you. The cap is the hard stop, 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, so the list appears once the key is saved. It contains every catalog ID, image-generation models included, so pick a chat model, preferably one whose model page lists tool calling, because Cline's agent works through tool calls. If the list stays empty, choose Use custom model ID… and type the exact ID from /models, for example anthropic/claude-sonnet-5, openai/gpt-5.5, deepseek-v4-flash or grok-4.7. Then open Model Configuration, described in the next section:

Base URL
https://api.router.one/v1
cline-settings
# 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 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 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.5 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 is the spending limit. Input Price / 1M tokens and Output Price / 1M tokens only feed Cline's own cost estimate, and the billed amount is the one in Dashboard → Logs. 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; -k overrides the key for a single run. The CLI approves tool calls automatically by default (--auto-approve true), which means a task edits files and runs commands without asking. Pass --auto-approve false to confirm each step, and keep the maxSpend cap on the key either way.

terminal
npm install -g cline            # Node.js 20+, 22 recommended
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 "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.5 for Plan and anthropic/claude-sonnet-5 for Act, both on the same Router One key. Each mode's requests appear under their own model ID in Dashboard → Logs, so filtering by model shows what planning and implementation each cost.

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 sends to a model (a streamed turn that failed before any output may have no record) — its model, tokens, cost and status, its total time and, for a streamed turn that produced output, its time to first token (TTFT). Cline 4.1.19 and later retry a turn that fails with a transient error before any output, a rate-limit response included, up to three times with backoff, and never retry a turn that has already streamed output, so one step can reach Router One up to four times. Since 4.1.23, a response that ends without a recognized finish reason also gets one follow-up request asking the model to continue. The reasoning-effort selector in the provider settings defaults to none. Choosing a level adds reasoning_effort to each request. Router One does not turn it into a thinking setting for Claude IDs, except on Claude Opus 5.5, where it maps the value to output_config.effort (none and minimal become low); other models may ignore it or reject the request with 400, 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.

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, cost, 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 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. Check that Base URL ends in /v1 with nothing after it: per Cline's source (main branch, checked 2026-10-01), Cline 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, 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. Pick an ID whose model page lists tool calling. 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, which had stripped every tool from the request.

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.

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.

Which Cline version is this guide for?

It was checked against the extension at 4.1.21 and the CLI at 3.0.65 on 2026-09-27, and re-checked on 2026-10-09 against the extension 4.1.22 and 4.1.23 release notes (September 30 and October 7, 2026) and the CLI 3.0.66–3.0.70 changelog, which list no change to the settings this guide uses. 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.