Cline in VS Code: OpenAI Compatible provider setup
Point the Cline extension at uttapen: pick OpenAI Compatible, set base URL, key and model id, cap Max Output Tokens to keep holds small, and fix errors.
Updated: 22 Sep 2026
Cline is a coding agent extension for VS Code with an OpenAI Compatible provider, which is how you connect it to uttapen. This page was checked against the docs and source of version 4.1.x.
Setting it up
- Open the Cline panel and click the gear (Settings).
- Under API Provider, pick OpenAI Compatible — not OpenAI. The OpenAI provider talks to the Responses API, which uttapen doesn't serve, so use OpenAI Compatible even for
openai/…models. - Fill in:
| Field | Value |
|---|---|
| Base URL | https://api.uttapen.ir/v1 |
| OpenAI Compatible API Key | your sk-up-… key from Dashboard → API keys |
| Model ID | for example anthropic/claude-sonnet-5 |
Cline reads the model list from GET /v1/models at that base URL, so once the URL is in place you can pick a model from the list instead of typing the id.
Model Configuration section
Expand MODEL CONFIGURATION on the same screen. Two fields matter:
- Max Output Tokens is the request's
max_tokens. Left empty, depending on which engine your build runs, Cline either sends no ceiling at all or sends 32,000. Both are bad for your wallet: either the hold is far larger than needed, or the hold ends up smaller than the real charge and the balance dips negative (pricing).8192is a good number for code work. - Context Window Size defaults to 128,000. Set it to the model's real context — or lower, for cheaper prompts. Every model's number is on the model list.
The Input Price and Output Price fields only feed Cline's own cost estimate; they change nothing about what you are charged. The real figure in toman is in Dashboard → Usage. Turn Supports Images on only for a model that actually accepts image input (vision).
Choosing a model
Copy ids verbatim from the model list. For coding:
anthropic/claude-sonnet-5oropenai/gpt-5when quality matters more than cost.qwen/qwen3-coder,deepseek/deepseek-v3.2orz-ai/glm-4.7for cheaper day-to-day work.
Cline has a Use different models for Plan and Act option, so you can put a strong model on Plan and a cheap one on Act. Unlike some other agents it has no separate model for titles or summaries — the active model does those too, which makes Max Output Tokens your main lever.
Checking that it works
Send a short message ("list the files in this project"), then look for the request under your Cline key in Dashboard → Usage. To test the key on its own first:
curl https://api.uttapen.ir/v1/chat/completions \
-H "Authorization: Bearer $UTTAPEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-5-mini","max_tokens":20,"messages":[{"role":"user","content":"ping"}]}'
Troubleshooting
| Error | Cause in Cline | Fix |
|---|---|---|
401 invalid_api_key | Wrong or revoked key in the OpenAI Compatible API Key field | Create a new key and paste it in |
404 model_not_found | A hand-typed Model ID that doesn't match a real id | Pick from the dropdown, or copy the id from /en/models (the 404 also lists the closest ids it guessed, in uttapen.suggestions) |
404 not_found | API Provider is still OpenAI, so the request went to /v1/responses | Switch to OpenAI Compatible |
402 insufficient_balance | The balance can't cover this request's hold | Top up and lower Max Output Tokens |
429 | The key's rate or monthly limit (rate limits) | Wait a few seconds, or raise the key's limit |
| Reply stops mid-edit | The model hit max_tokens and returned finish_reason: "length" | Raise Max Output Tokens |
When your available balance is below the cost of the full max_tokens, uttapen doesn't reject the call: it lowers the output ceiling to what the balance can pay for, never below 1,024 tokens, and reports the granted number in the X-Uttapen-Max-Tokens response header. A code edit may then end unfinished — top up, or set a smaller Max Output Tokens. 402 only shows up when even those 1,024 tokens don't fit.
Other tools are listed in integrations; every error code is in errors.
Sign up with a phone number, top up your wallet from 100,000 toman and create a key. Free models work without a top-up — up to 50 requests a day. Create an API key →