Cline: setting up an OpenAI-compatible API in VS CodeAn API for AI coding agents: one key, any OpenAI-compatible tool

Published

Cline: setting up an OpenAI-compatible API in VS Code

The short version: in Cline's settings pick the OpenAI Compatible provider, paste a Base URL, a key and a Model ID — and the agent is ready. Below, in detail, with the context window and the errors people usually get stuck on.

Right here on the page

Get the Base URL and key for Cline

The block will hold exactly the values that go into the extension's fields — yours, not placeholders. You can send the first request from here without opening VS Code: if an answer comes back, everything left is Cline's settings.

Press it and get your base_url and API key.

No sign-up, no card.

Free. Your key appears right here.

What Cline is

Cline is a VS Code extension (it also works in Cursor and in JetBrains IDEs) that turns the editor into an agent: it reads the project, proposes edits file by file, runs terminal commands and shows you every step before applying it. Unlike the built-in assistants, Cline is not tied to one model vendor — the provider is configured by hand.

Step 1. Install the extension

  1. Open VS Code and go to Extensions (Ctrl+Shift+X, or Cmd+Shift+X on macOS).
  2. Find Cline and install it.
  3. Open the Cline panel in the editor's sidebar.

Step 2. Get a Base URL and a key

The button in the block above creates a Base URL of the form https://twelver.app/api/ai/<config-id>/v1 and a key of the form sk-…. No signup, no card. The key is shown once — copy it straight away.

Step 3. Configure the provider in Cline

Open Cline's settings (the gear icon) and fill the fields with the values from the block above:

FieldWhat goes in
API ProviderOpenAI Compatible
Base URL
API Key
Model IDa series name from the table below, e.g. auto
Until a Base URL and key are issued, the table shows placeholders — click them. Field names differ between versions of the extension; go by meaning.

In the Model Configuration block, set the context window. Cline uses that number to decide when to trim history; left at its default it may cut a long session short, or conversely send far too much.

Check the connection with something simple like "hi" — if an answer comes back, it is working.

The Base URL ends in /v1

Cline appends /chat/completions to whatever you give it. So the field needs an address ending in /v1 — no trailing slash, and no /chat/completions on the end. The extra fragment gives you a 404.

If the fields do not line up

Ask the AI to configure Cline for you

This opens a chat with the question already typed — you only have to hit send. The API integrator hands you your base_url and key, dictates the value for each Cline field and works out the cost. You can paste an error message in there too if the connection will not go through.

Which series to choose

The Model ID field takes a series — the series points at the current model itself, so you will not have to edit the setting after an update.

SeriesModelIn / out, $ per 1MWhen to use it
gptGPT-6 Luna0.163 / 0.813A cheap input on a noticeably stronger model than the flash series
qwen-flashQwen3.8-Flash0.244 / 0.764The cheapest input, but a bit weak for editing code
zai-flashGLM-5.3-Flash0.244 / 0.813An alternative to qwen-flash at the same price
minimaxMiniMax M3.1 Flash0.244 / 0.975Small edits, long context
deepseek-flashDeepSeek V4.1 Flash0.488 / 1.95Cheap high-volume calls
auto / qwenQwen3.7-Plus0.65 / 2.6Day-to-day work — the sensible entry point
xiaomiMiMo V2.6 Pro0.707 / 1.41When "auto" does not quite reach
gpt-terraGPT-6.1 Terra1.63 / 8.13
deepseekDeepSeek V4 Pro2.15 / 6.44Strong reasoning; output cheaper than grok
zaiGLM-5.32.28 / 7.15Refactoring and long chains of edits
qwen-maxQwen4-Max2.44 / 7.31Hard problems, 1M tokens of context
grokGrok 4.73.25 / 9.75Hard problems, working through architecture
gpt-solGPT-6.1 Sol3.25 / 16.25
gpt-maxGPT-6 Astra16.25 / 81.25Sparingly, when nothing else managed it
Rates as of 1 December 2026. Current ones are on /l/en/twelver-coding-api.

What this API does not have

The Twelver API serves 15 series from 7 vendors: GPT, DeepSeek, Qwen, Grok, GLM, MiMo, MiniMax. Not served: Claude and Gemini. Configuring Cline does not depend on the provider — if you need a different set of models the fields are the same, and only the address and key change.

If it does not work

SymptomCauseWhat to do
401 / UnauthorizedA wrong or truncated keyThe key is shown once — if it is lost, issue a new one
404 on the requestAn extra tail in the Base URL, or the wrong config-idThe address must end in /v1, with no /chat/completions and no trailing slash
Model not foundThe Model ID names a series that does not existCheck it against the table above; GET /v1/models returns the full list
The answer stops halfwayThe context window is set wrongSet it in the Model Configuration block, or start a new task
The agent does not call toolsThe model is weak at tool callingTry a series a class up — zai or grok, for instance

How not to overpay

  • New task, new session. The whole context goes out with every request, so a long conversation gets dearer with each step.
  • Do not hand the agent the whole repository. The narrower the context, the cheaper the input — and input is where an agent's spend actually goes.
  • Start on a cheap series. Move the model up a class where the quality fell short, not in advance.

If the terminal suits you better than the editor, the same setup for opencode. The same setup in Kilo Code, with one config for VS Code, JetBrains and the CLI — Kilo Code: setting up your own API, or split tasks by mode in Roo Code setup. If you are looking for an AI editor to replace Cursor, see Cursor alternatives. A walkthrough of several extensions at once (Kilo Code, Roo Code) is in the separate VS Code guide.

Frequently asked questions

How do I connect Cline to my own API?
In Cline's settings pick the "OpenAI Compatible" provider, give a Base URL ending in /v1, paste the key and fill in the Model ID. Then set the context window in the Model Configuration block and test the connection with a short message.
Which Base URL do I put in Cline?
Your provider's address up to and including the /v1 segment, with no trailing slash. Cline appends /chat/completions itself, so adding that path by hand is unnecessary — and makes the request return a 404.
Why does Cline say Model not found?
The model identifier in the settings does not match what the provider serves. You can always get the exact list with GET /v1/models against your base_url and take the name from there.
Does Cline work in Cursor and JetBrains?
Yes, Cline installs into Cursor and into the JetBrains IDEs. Configuring the provider is the same in both: the same Base URL, API Key and Model ID fields.
What does it cost to use Cline?
The extension itself is free — you only pay for the provider's tokens. With agents most of the spend lands on input tokens, because the project context goes out with every request; the cheapest input of the available series is $0.163 per 1M tokens (qwen-flash), and a sensible main model is auto at 0.65 / 2.6 per 1M in / out.
Where do I get an API key for Cline?
From any provider with an OpenAI-compatible API. With Twelver, a base_url and a key come from a button on the API page — no sign-up and no card; it serves 15 model series, all except Claude and Gemini. In Cline it goes into the «OpenAI Compatible» provider in a minute.

Try it yourself

Everything in this guide runs inside Twelver

One chat for text, images, video, music and voice — no separate services or subscriptions.

Open Twelver chat
Rate your experience