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
- Open VS Code and go to Extensions (
Ctrl+Shift+X, orCmd+Shift+Xon macOS). - Find Cline and install it.
- 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:
| Field | What goes in |
|---|---|
| API Provider | OpenAI Compatible |
| Base URL | |
| API Key | |
| Model ID | a series name from the table below, e.g. auto |
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
/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.
| Series | Model | In / out, $ per 1M | When to use it |
|---|---|---|---|
| gpt | GPT-6 Luna | 0.163 / 0.813 | A cheap input on a noticeably stronger model than the flash series |
| qwen-flash | Qwen3.8-Flash | 0.244 / 0.764 | The cheapest input, but a bit weak for editing code |
| zai-flash | GLM-5.3-Flash | 0.244 / 0.813 | An alternative to qwen-flash at the same price |
| minimax | MiniMax M3.1 Flash | 0.244 / 0.975 | Small edits, long context |
| deepseek-flash | DeepSeek V4.1 Flash | 0.488 / 1.95 | Cheap high-volume calls |
| auto / qwen | Qwen3.7-Plus | 0.65 / 2.6 | Day-to-day work — the sensible entry point |
| xiaomi | MiMo V2.6 Pro | 0.707 / 1.41 | When "auto" does not quite reach |
| gpt-terra | GPT-6.1 Terra | 1.63 / 8.13 | |
| deepseek | DeepSeek V4 Pro | 2.15 / 6.44 | Strong reasoning; output cheaper than grok |
| zai | GLM-5.3 | 2.28 / 7.15 | Refactoring and long chains of edits |
| qwen-max | Qwen4-Max | 2.44 / 7.31 | Hard problems, 1M tokens of context |
| grok | Grok 4.7 | 3.25 / 9.75 | Hard problems, working through architecture |
| gpt-sol | GPT-6.1 Sol | 3.25 / 16.25 | |
| gpt-max | GPT-6 Astra | 16.25 / 81.25 | Sparingly, when nothing else managed it |
What this API does not have
If it does not work
| Symptom | Cause | What to do |
|---|---|---|
| 401 / Unauthorized | A wrong or truncated key | The key is shown once — if it is lost, issue a new one |
| 404 on the request | An extra tail in the Base URL, or the wrong config-id | The address must end in /v1, with no /chat/completions and no trailing slash |
| Model not found | The Model ID names a series that does not exist | Check it against the table above; GET /v1/models returns the full list |
| The answer stops halfway | The context window is set wrong | Set it in the Model Configuration block, or start a new task |
| The agent does not call tools | The model is weak at tool calling | Try 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?
/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?
/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?
GET /v1/models against your base_url and take the name from there.Does Cline work in Cursor and JetBrains?
What does it cost to use Cline?
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?
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