Get API key

Use an OpenAI-Compatible API Key in Cline

To use a cline openai compatible api key, you pick the OpenAI Compatible provider in Cline's settings and fill in three fields: base URL, key and model ID. Here are the exact values for this API and the fixes for the usual failures.

Last updated

Glass code editor panel linked by a luminous cable and three-slot connector to a server tower, illustrating Cline setup

Key takeaways

  • Provider: OpenAI Compatible. Base URL: https://api.openaicompatibleapikey.com/v1. Model ID: uncensored.
  • Set the context window to 100,000 tokens and leave image support off, since the API is text only.
  • Cline makes many requests per task, so a full key (8 concurrent, 300 per minute) is more comfortable than the trial key.
  • A 30-step task of about 25,000 tokens per step costs about $0.13.

Before you start

Cline is a VS Code extension that works as a coding agent: it reads files, proposes edits and runs commands with your approval. It can use many providers. If yours is not on the built-in list, the OpenAI Compatible option lets you point it at any server that follows the OpenAI chat protocol.

You need a key from the API key page. Sign up with Google or email and password, then claim the $0.50 trial credit with one click, or top up from $20 in USDT or USDC. The model is a single open-weight model run by an independent provider, tuned to answer without content refusals for lawful adult use. It is not an official API of any model vendor, so test it on small tasks before you hand it a large one.

Check the extension's current documentation for where it keeps the key. Either way, avoid pasting the key into prompts or into files in the repository, and regenerate it on the key page if you ever do.

Settings to enter

  1. Open the Cline panel in VS Code and click the settings (gear) icon.
  2. Under API Provider, choose OpenAI Compatible.
  3. Base URL: https://api.openaicompatibleapikey.com/v1
  4. API Key: your key, pasted without quotes or spaces.
  5. Model ID: uncensored
  6. Open the model configuration section if your version has one and set the context window to 100000. Leave image support unchecked.
  7. Save the settings and send a small prompt.

Option names shift between Cline releases, so if one is missing, look for the nearest equivalent. The three core values do not change.

Why the extra settings matter

Context window. Cline decides when to trim a long conversation based on the window you declare. The model here has 100,000 tokens, prompt plus completion. Declaring a larger number than the real one leads to a request the server cannot take, and declaring a much smaller one makes Cline cut history that would have fit.

Images. This API is text only. If image input is enabled, Cline may attach screenshots, which the service cannot read. Keep it off.

Max output tokens. The completion can use whatever the prompt leaves free, and max_tokens is optional. If you set a cap in Cline, leave it generous enough for a full file edit, for instance 8,000 or more.

Tool calling is supported (tools, tool_choice, streamed tool_calls), and streaming works over SSE, which is how Cline shows output as it arrives.

Verify the key outside Cline

If Cline shows an error, check whether the key and URL work on their own:

curl https://api.openaicompatibleapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Reply with OK."}],"max_tokens":5}'

Or from Python:

from openai import OpenAI
import os

client = OpenAI(base_url="https://api.openaicompatibleapikey.com/v1", api_key=os.environ["API_KEY"])
print(client.models.list().data[0].id)

The second script should print uncensored. When the curl call works but Cline fails, the problem is in the Cline settings, usually a stray character in the key field or a base URL with extra path.

Keeping tasks inside the context window

With a 100,000-token window, the way you scope a task decides whether it succeeds. Cline adds file contents, command output and its own earlier messages to the conversation, and all of it counts.

  • Name the files. "Fix the date parsing in src/utils/dates.ts" gives the agent a target. "Fix the bugs in the project" makes it read broadly and burn the window on files that do not matter.
  • Exclude noise. Cline supports a .clineignore file, which works like .gitignore for what the agent may read. List build output, vendored dependencies, lock files and generated code.
  • One task per conversation. When a task is done, start a new one. Carrying old history forward is the most common way to run out of room.
  • Prefer targeted edits. Ask for a changed function rather than a rewritten file. Output tokens cost more than input tokens ($0.50 against $0.15 per 1M), and long rewrites are also where mistakes creep in.

As a rule of thumb, once Cline reports that the conversation is beyond roughly 80,000 tokens, finish the current step, commit your work, and begin a fresh task with a short summary of where things stand.

Troubleshooting

Error in ClineCauseFix
401 or "invalid API key"Wrong or reissued key, or whitespace in the fieldCopy the current key from the key page and paste again
404 or "not found"Base URL missing /v1, or includes /chat/completionsUse exactly the base URL above
Model not foundAnother provider's model nameEnter uncensored
429 with code concurrencyMore than 8 requests at once (2 on a trial key)Run fewer parallel tasks, let streams finish
429 with code rate_limitedMore than 300 per minute (60 on trial)Wait; Cline can retry
429 with Retry-After: 5Temporary overloadRetry after five seconds
Request too largeContext beyond 100,000 tokens or body over 8 MBStart a new task, attach fewer files

Failed requests are not charged, so retrying costs nothing extra. If a task derails halfway, reject the step in Cline and restate the instruction in smaller pieces; open-weight models vary in how well they follow long tool-use chains, and a shorter, more specific prompt often fixes it.

Prompts that work better with open-weight models

A hosted open-weight model is not tuned specifically for Cline's prompts, so give it help. These habits make a visible difference.

  1. State the goal and the check. "Add input validation to createUser and make npm test pass" beats "improve the code".
  2. Ask for a plan first. Cline has a planning mode. Review the plan, correct it, then switch to acting. Mistakes are cheaper to fix in a plan than in a diff.
  3. Approve steps manually at first. Auto-approve is convenient but removes your chance to catch a bad edit early. Turn it on only for read-only actions until you trust the results.
  4. Use version control. Commit before each task. If an edit goes wrong, you roll back with one command.
  5. Lower the temperature. If your Cline version exposes a temperature field for custom providers, 0.2 to 0.3 tends to give steadier code and tool use. The API passes it through.

If the model drops out of the expected tool format and Cline prints a complaint, reject the step and ask again in simpler words. It rarely takes more than one retry, and failed or refused requests are not charged.

What a task costs

Prices: $0.15 per 1M input tokens and $0.50 per 1M output tokens. Agents resend the conversation every step, so input dominates. Take a task of 30 steps with about 25,000 tokens in and 1,000 tokens out per step:

  • Input: 30 x 25,000 = 750,000 tokens x $0.15 / 1M = $0.1125
  • Output: 30 x 1,000 = 30,000 tokens x $0.50 / 1M = $0.015
  • Total: $0.1275

That is about 3 such tasks on the $0.50 trial credit (0.50 / 0.1275 = 3.9), and about 156 on a $20 top-up (20 / 0.1275 = 156.9). The balance shows in the X-Balance-USD response header. See the pricing page for bonus tiers, the documentation for parameters, and the article on using a Claude key in uncensored programs if you also keep another key around.

For longer sessions, keep an eye on the balance. A full day of agent work at the rate above, say ten tasks of $0.1275 each, is $1.275, which shows how small the cost per task is next to the time it saves or loses. The more useful number is how many tasks end with an edit you keep. Count that on your own repository for a day and compare.

Frequently asked questions

Which provider do I choose in Cline?

OpenAI Compatible. Then enter the base URL https://api.openaicompatibleapikey.com/v1, your key and the model ID uncensored.

Can Cline send screenshots to this model?

No. The API is text only, so keep image support switched off in the model settings.

Why do I see 429 errors?

You exceeded a limit: 8 concurrent requests and 300 per minute on a full key, or 2 and 60 on a trial key. The error code says which one.

Is the trial key enough for Cline?

It is enough to test the setup, but its 2 concurrent requests can be tight for agent workloads. A full key allows 8.

Get your key now

Sign up, copy the key, update your base URL. That’s all there is to the configuration.

Get API key