Short answer
To use Cline with APIVAI, open Cline's settings, set API Provider to OpenAI Compatible, enter https://api.apivai.com/v1 as the Base URL, paste your APIVAI key into API Key and type a model ID such as claude-sonnet-4-6 or gpt-5.5. If you only want Claude, you can instead choose the Anthropic provider, tick Use custom base URL and enter https://api.apivai.com without /v1, because Cline adds the path itself. As of 2026-10-07, Claude Sonnet 4.6 costs $1.04 / $5.22 per million input / output tokens through APIVAI, against the official $3.00 / $15.00. You pay per token from a prepaid balance, with no subscription.
What is Cline, and why connect it to your own API?
Cline is an open-source AI coding agent that runs inside VS Code. It reads your files, proposes edits, runs terminal commands with your approval and works through a task step by step. Cline does not include a model of its own: you bring an API provider and a key, and every step of a task is a request billed by that provider.
That makes the choice of provider the main factor in what Cline costs you. APIVAI gives you one key that works with Claude and GPT models, billed per token below official list prices, from a balance you top up when you need to. One key works in both the OpenAI format and the Anthropic format, so it fits either of Cline's provider options.
Which API Provider should you choose in Cline?
Cline offers two provider types that work with APIVAI:
| OpenAI Compatible | Anthropic | |
|---|---|---|
| Base URL | https://api.apivai.com/v1 | https://api.apivai.com (no /v1) |
| Models | Claude and GPT | Claude only |
| How you pick the model | Type the model ID | Choose from Cline's list |
| Best for | One setup for every model | Claude in its native Messages format |
Pick OpenAI Compatible if you want to switch between Claude and GPT or use a model ID that is newer than Cline's built-in list. Pick Anthropic if you only use Claude and prefer Cline's native Claude integration. You can switch between them at any time; the same key works in both.
How do you set up Cline with APIVAI step by step?
Step 1: Create an APIVAI key
- Sign up at apivai.com with your email.
- Top up your balance from $10 by card, crypto, Alipay or WeChat Pay. There is no free trial; you pay only for what you use.
- Open the Dashboard, create a key and copy it. You can give the key its own budget limit so Cline can never spend more than you planned.
Step 2: Configure the OpenAI Compatible provider
- In VS Code, open the Cline panel and click the settings (gear) icon.
- In API Provider, choose OpenAI Compatible.
- Fill in the fields as in the table below.
- Click Verify if your version shows the button, then save and start a task.
| Field | Value |
|---|---|
| API Provider | OpenAI Compatible |
| Base URL | https://api.apivai.com/v1 |
| API Key | Your APIVAI key |
| Model | claude-sonnet-4-6 (or any ID from GET /v1/models) |
| Max Output Tokens | 8192 or more (at least 4096) |
| Input Price / Output Price | Optional: $1.04 / $5.22 for Claude Sonnet 4.6 |
The Base URL must end in /v1 exactly once: Cline appends /chat/completions to it. The model configuration also has Context Window, Image Support and Computer Use; leave them at their defaults unless you know you need to change them.
The price fields only affect the cost estimate Cline shows for a task. Filling them in with APIVAI's prices makes that estimate match what you are actually billed; your real usage is always on the Dashboard.
To see which model IDs your key can use, run:
curl https://api.apivai.com/v1/models \ -H "Authorization: Bearer YOUR_APIVAI_KEY"
The model list changes over time, so copy IDs from this response or from the pricing page rather than from old tutorials.
Step 3 (optional): Use the Anthropic provider for Claude
- In API Provider, choose Anthropic.
- Paste your APIVAI key into Anthropic API Key.
- Tick Use custom base URL and enter
https://api.apivai.com. - Choose a Claude model from the Model dropdown.
Do not add /v1 here. Cline's Anthropic client adds /v1/messages to the base URL itself, so https://api.apivai.com/v1 would turn into /v1/v1/messages and fail with 404. If the Claude model you want is not in Cline's list yet, use the OpenAI Compatible provider and type its ID. More about this format is on the Claude API proxy page.
Which model should you choose in Cline?
Cline sends many requests per task, so the model's price per token matters more than in a chat app. Prices per 1M input / output tokens as of 2026-10-07:
| Model ID | Price (in / out) | Use it for |
|---|---|---|
claude-sonnet-4-6 | $1.04 / $5.22 | Default for everyday coding |
claude-sonnet-5-5 | $0.69 / $3.47 | Everyday coding, newer Sonnet |
claude-opus-5-5 | $1.39 / $6.96 | Hard bugs, large refactors |
claude-haiku-4-5 | $0.35 / $1.74 | Small edits, cheap and fast |
gpt-5.5 | $0.77 / $4.56 | GPT alternative, second opinion |
gpt-6-luna | $0.0144 / $0.0768 | Very cheap simple tasks |
A practical setup: use Claude Sonnet 4.6 or Claude Sonnet 5.5 by default, switch to Claude Opus 5.5 when a task keeps failing, and use Claude Haiku 4.5 for renames, comments and small fixes. GPT models only work through the OpenAI Compatible provider.
How much does Cline cost with APIVAI?
Each step of a Cline task resends the conversation and the files Cline has read, so input tokens add up quickly. Two realistic examples with Claude Sonnet 4.6:
- One medium task, such as adding a feature across a few files: about 20 requests of 30,000 input and 1,500 output tokens each. Cost: $0.781 with APIVAI, $2.25 at official prices.
- A working month of three such tasks a day for 22 days (1,320 requests): $51.52 with APIVAI, $149 at official prices.
The same month on Claude Haiku 4.5 would cost $17.31. These estimates ignore prompt caching and assume thinking tokens are included in the output figure; thinking tokens are billed as output. The Dashboard lists every request with its tokens and cost, so after a day you can replace these assumptions with your own numbers. For a wider comparison, see Claude API pricing in 2026.
How do you fix common Cline errors?
- 401 Unauthorized / invalid API key: the key was copied incompletely, deleted, or has reached its budget limit. Check it on the Dashboard. With the Anthropic provider, also make sure Use custom base URL is ticked; otherwise Cline sends your key to Anthropic directly.
- 404 Not Found: almost always the
/v1part. OpenAI Compatible needshttps://api.apivai.com/v1(one/v1, no trailing/chat/completions). Anthropic needshttps://api.apivai.comwith no/v1. - Model not found: the Model field must contain an exact ID such as
claude-sonnet-4-6, not a display name. Check the ID againstGET /v1/models. - Empty or cut-off replies: thinking is on by default and uses output tokens. Raise Max Output Tokens to 8192 (at least 4096).
- 429 Too Many Requests: the default limit is 60 requests per minute per key. Long agent runs can hit it; wait a moment or ask support to raise the limit.
The general format rules are on the OpenAI-compatible API page and in the docs.
FAQ
Can I use Claude and GPT in Cline with one key?
Yes. One APIVAI key works for every model. Use the OpenAI Compatible provider and change the Model field to switch between claude-sonnet-4-6 and gpt-5.5.
Should I use the OpenAI Compatible or the Anthropic provider?
OpenAI Compatible covers Claude and GPT with one setup and lets you type any model ID. The Anthropic provider is for Claude only and uses Claude's native format; enter the base URL without /v1.
Does APIVAI store my code?
No. The content of requests and responses is not logged. Only usage data such as model, token counts and cost is kept for billing.
Is there a subscription or free trial?
No subscription and no free credits. You top up from $10 and pay only for the tokens you use.
Can I use the same key in other tools?
Yes. The same key works in Roo Code, Cursor and Claude Code. Creating a separate key per tool makes the Dashboard easier to read.
Create an account, top up from $10 and paste your key into Cline.