# Cline, Roo Code, Kilo Code, Cursor: API Key Setup

> Set up one OpenAI-compatible API key in Cline, Roo Code, Kilo Code and Cursor: exact field names, base URL, model IDs, test results and error fixes.

Source: https://goiapi.com/en/blog/cline-roo-code-kilo-code-cursor-api-key
Updated: 2026-12-05

Author: GoiAPI, December 5, 2026

To use your own API key in Cline, pick **OpenAI Compatible** as the API Provider, then fill in three fields: the Base URL (`https://api.goiapi.com/v1` for GoiAPI), your API key, and the exact model ID, such as `gpt-6.1-sol`. Roo Code uses the same three fields, and Kilo Code asks for them in a **Custom provider** dialog. Cursor has an **Override OpenAI Base URL** switch that does the same job, but with limits you should know about before you rely on it.

This guide covers all four tools from one key. It lists the field names each tool uses (checked against each tool's documentation on December 5, 2026), shows what happened when we sent requests to every model through the OpenAI format, and explains the errors you are most likely to hit.

Disclosure: GoiAPI wrote this guide and sells API access to the models it mentions.

## Quick reference: where the key goes in each tool

All four tools speak the OpenAI Chat Completions format, so the same three values work everywhere:

| Value | What to enter |
|---|---|
| Base URL | `https://api.goiapi.com/v1` |
| API key | Your key, which starts with `sk-...` |
| Model ID | The model's ID in lowercase, for example `gpt-6.1-sol`, `deepseek-v4-pro-0813` or `glm-5.3` (not the display name "GPT-6.1 Sol") |

And here is where each tool asks for them:

| Tool | Where to find it | Option to pick | Model field | Status |
|---|---|---|---|---|
| Cline | Settings (gear icon) → **API Provider** | **OpenAI Compatible** | **Model** | From Cline docs, checked Dec 5, 2026 |
| Roo Code | Settings → **API Provider** | **OpenAI Compatible** | **Model** | From Roo Code docs (last updated May 15, 2026), checked Dec 5, 2026 |
| Kilo Code | **Settings** → **Providers** tab → **Custom provider** | **Provider API**: **OpenAI Compatible** | **Models** | From Kilo Code docs, checked Dec 5, 2026 |
| Cursor | **Settings** → **Models** | **OpenAI API Key** + **Override OpenAI Base URL** | **Add model** | Not verified on the current Cursor version |

If "OpenAI-compatible" is new to you, our explainer on [what an OpenAI-compatible API is and how base URLs work](https://goiapi.com/en/blog/openai-compatible-api) covers the background in a few minutes.

## Before you start: key, base URL and model ID

The examples use GoiAPI. Any other OpenAI-compatible service works the same way; swap in its base URL, key and model IDs.

1. [Create an account](https://goiapi.com/en/signup) and verify your email.
2. Top up your balance with USDT (TRC20 or BEP20) or Binance Pay. There is no credit card and no monthly fee. Top-ups are final and non-refundable, so add only what you plan to use.
3. In the dashboard, open **API Keys**, create a key and copy it right away: it is shown only once.

Two settings on the key are worth using for coding agents, because an agent can send a lot of requests in one session:

- **A daily or monthly spending limit** in USD. When the limit is reached, requests are rejected with `429` until the next period starts, instead of draining your balance.
- **Allowed models**, so the key can only call the models you picked. A model outside the list returns `403`.

The full list of model IDs is on the [models page](https://goiapi.com/en/models). You can also call `GET https://api.goiapi.com/v1/models` with your key to see exactly which models that key may use; [listing models](https://goiapi.com/en/docs/list-models) is not charged.

When we called `GET /v1/models` on December 3, 2026, it returned the 9 models on the pricing page. Each entry has only `id`, `object`, `created` and `owned_by`. There is no context length field, which matters for Cline's Context Window setting (more on that below). The response headers for our test key were `x-ratelimit-limit-requests: 60` and `x-ratelimit-reset-requests: 60s`: 60 requests per minute. Your key may have a different limit, but keep it in mind, because agents fire requests back to back.

## Set up Cline with an OpenAI-compatible API key

Cline is a VS Code extension that works as a coding agent: it reads files, edits code and runs terminal commands after you approve them. Following [Cline's OpenAI Compatible page](https://docs.cline.bot/provider-config/openai-compatible) (checked December 5, 2026):

1. Open the Cline panel in the VS Code sidebar and click the gear icon.
2. Set **API Provider** to **OpenAI Compatible**.
3. **Base URL**: paste `https://api.goiapi.com/v1`. Cline's docs point out that this must be your service's endpoint, not OpenAI's own URL. Stop at `/v1`; Cline adds `/chat/completions` itself.
4. **API Key**: paste your `sk-...` key.
5. **Model**: type the model ID exactly, for example `gpt-6.1-sol`.
6. Save, then send a short message such as "Hello" to test it.

GoiAPI's own [Cline and Roo Code setup page](https://goiapi.com/en/docs/integrations/cline) shows the same steps.

### Cline Model Configuration: what to fill in

The **Model Configuration** section is optional. It holds:

- **Max Output Tokens**: the most tokens the model may write in one reply.
- **Context Window**: how much text the model can read in one call.
- **Image Support** and **Computer Use**: whether the model accepts images and can drive a browser or computer.
- **Input Price** and **Output Price**: used by Cline to show you a running cost estimate.

For prices, copy the per-1M-token figures from the [GoiAPI pricing page](https://goiapi.com/en/pricing). For example, GPT-6.1 Sol is $0.13 input and $0.78 output per 1M tokens (checked on December 5, 2026). Prices can change, so check the page before you enter them.

For Context Window, don't guess a large number. Neither the pricing page nor `GET /v1/models` lists context length per model at the moment, so leave the default or choose a conservative value. We have not tested how this field behaves with GoiAPI.

For Max Output Tokens, two things pull in opposite directions:

- GoiAPI holds funds based on the `max_tokens` a tool sends before calling the model, then charges actual usage and releases the rest. A very high value can trigger a `402` when your balance is low. See [limits and balance](https://goiapi.com/en/docs/limits-and-balance).
- Reasoning models spend part of their output budget thinking before they answer. Set the cap too low and the reply can come back empty (details in the test results below).

## Set up Roo Code: same fields as Cline

Roo Code is another VS Code coding agent, and its [OpenAI Compatible page](https://roocodeinc.github.io/Roo-Code/providers/openai-compatible) (last updated May 15, 2026, checked December 5, 2026) uses the same fields as Cline:

1. Click the settings icon in the Roo Code panel.
2. Set **API Provider** to **OpenAI Compatible**.
3. **Base URL**: `https://api.goiapi.com/v1`
4. **API Key**: your key.
5. **Model**: the model ID, for example `gpt-6.1-sol`.
6. Optionally adjust **Model Configuration** (Max Output Tokens, Context Window, Image Support, Computer Use, Input Price, Output Price), save, and send a test message.

One difference matters: Roo Code's docs say it supports only native tool calling, with no XML-based alternative, so the model must support OpenAI-style tool calling. We have not run a full agent task with tool calls in Roo Code, so give your chosen model a small task (for example, "list the files in this folder") before starting real work. If you see tool-calling errors, try another model.

## Set up Kilo Code with a custom provider

Kilo Code adds services differently: instead of choosing from a dropdown, you create a custom provider. From [Kilo Code's OpenAI-compatible docs](https://kilo.ai/docs/providers/openai-compatible) (checked December 5, 2026):

1. Open **Settings** (gear icon) and switch to the **Providers** tab.
2. Scroll to the bottom and click **Custom provider**.
3. Fill in the dialog:
   - **Provider ID**: a unique ID, for example `goiapi`.
   - **Display name**: the label you will see, for example `GoiAPI`.
   - **Provider API**: **OpenAI Compatible**.
   - **Base URL**: `https://api.goiapi.com/v1`. Kilo also accepts the full endpoint, `https://api.goiapi.com/v1/chat/completions`.
   - **API key**: your key.
   - **Models**: add the model IDs you want. Kilo's docs say it fetches the list automatically when the base URL exposes an OpenAI-compatible models endpoint, which GoiAPI does at `/v1/models`; you can also type IDs by hand or click **Fetch models** to retry.
   - **Headers**: optional, leave empty.
4. Click **Submit**, then pick the new provider and a model in the chat panel.

Kilo's docs note that token limits and tool calling options are set by editing its `kilo.jsonc` config file.

### Kilo Code and Claude: the Anthropic Messages option

The **Provider API** list also offers **OpenAI Responses** and **Anthropic Messages**. Anthropic Messages calls Claude models in Anthropic's own format, which is the format GoiAPI recommends for Claude. With that format the base URL is `https://api.goiapi.com` with **no** `/v1`, because clients add `/v1/messages` themselves (see the [Anthropic Messages docs](https://goiapi.com/en/docs/anthropic-messages)). When we sent a request to a doubled path, `/v1/v1/messages`, on December 3, 2026, the API returned `404`.

We have not tested how Kilo Code builds the path for this option, so we don't recommend it yet. If you try it, send one short message and check the **Request history** page in the dashboard before using it for real work.

## Cursor: custom API key and Override OpenAI Base URL

Cursor (often searched as "Cursor AI") is a code editor with built-in AI. Of the four tools, it is the one where a custom key is least predictable, and we have not verified these steps on the current Cursor version.

**The documentation has moved.** On December 5, 2026, `cursor.com/docs` returned a `308` redirect to `docs.grok.com/build`. The [API keys page there](https://docs.grok.com/build/agents-window/help/models-and-usage/api-keys), which refers to the product as Grok Build, says custom keys work only with chat models, Tab completion keeps using the built-in models, and it does not mention a base URL override at all.

**The switch still exists, with side effects.** Threads on the Cursor forum from August to October 2026 (Cursor 3.12.17 and 3.21.18) show that **Override OpenAI Base URL** is still a toggle. Cursor staff confirmed two behaviors there:

- The override is global. While it is on, Cursor's own OpenAI-family models are sent to your custom endpoint too, and they fail if your endpoint doesn't serve them ([forum thread, August 21, 2026](https://forum.cursor.com/t/cursor-managed-models-are-routed-through-override-openai-base-url/169088)). The workaround staff gave is to switch the override off when you want Cursor's models and on for your own.
- The OpenAI key and the override "apply to every model that is not a Claude or Gemini model" (Cursor staff, [September 23, 2026](https://forum.cursor.com/t/custom-openai-override-and-cursor-models-cannot-both-stay-enabled/172795)). In other words, a model ID starting with `claude-` may not go through your base URL at all. With Cursor, pick a GPT, DeepSeek or GLM model ID.

Forum users have also reported that a custom model ID matching one of Cursor's built-in names is rejected, so use IDs that are clearly your own, such as `gpt-6.1-sol` or `deepseek-v4-pro-0813`.

> **Not verified on the current Cursor version (December 5, 2026).** The steps below come from GoiAPI's [Cursor setup page](https://goiapi.com/en/docs/integrations/cursor) and match the setting names used on the forum, but your screen may differ.

1. Open Cursor → **Settings** → **Models**.
2. In **OpenAI API Key**, paste your key.
3. Turn on **Override OpenAI Base URL** and paste `https://api.goiapi.com/v1`.
4. Click **Add model**, type a non-Claude model ID (for example `gpt-6.1-sol`), and turn it on.
5. Pick that model in the chat panel and send "Hello".
6. Turn the override off again when you want to use Cursor's own models.

If you can't find the override switch or anything equivalent in your version, we don't know of another way to point Cursor at a different endpoint. In that case, Cline, Roo Code or Kilo Code are the practical alternatives inside VS Code.

## Test results: 9 models through the OpenAI format

All four setups above use the OpenAI format, so on December 3, 2026 we sent the same short one-sentence question to every model through `POST /v1/chat/completions`, the endpoint these tools call, with `max_tokens` set to 200. To run a similar check yourself:

```bash
curl https://api.goiapi.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.1-sol","max_tokens":200,"messages":[{"role":"user","content":"Hello"}]}'
```

| Model ID | Maker | HTTP status (main run) | Reasoning tokens in output |
|---|---|---|---|
| `claude-haiku-5-5` | Anthropic | 200 | No |
| `claude-opus-5-5` | Anthropic | 200 | n/a |
| `deepseek-v4-pro-0813` | DeepSeek | 200 | No |
| `deepseek-v4.1-flash` | DeepSeek | 200 | Yes |
| `gpt-6-luna` | OpenAI | 200 | No |
| `gpt-6.1-sol` | OpenAI | 200 | No |
| `gpt-6.2-sol` | OpenAI | 200 | No |
| `glm-5.3` | Zhipu (GLM) | 200 | Yes |
| `glm-5.3-flash` | Zhipu (GLM) | 200 | Yes |

We ran each model once, so treat this as a snapshot, not a benchmark. Three things from these runs affect how you configure the tools.

### Claude through the OpenAI format works, but less reliably

Both Claude models answered in the main run. In a later run the same day, however, three calls to `claude-haiku-5-5` through `/v1/chat/completions` all returned `503`, while calls to the same model through the Anthropic format (`/v1/messages`) kept returning `200`. GoiAPI's [OpenAI Chat Completions docs](https://goiapi.com/en/docs/openai-chat-completions) recommend the Anthropic format for Claude, and say that calling a model through a format it does not support returns `503`.

So you can type `claude-haiku-5-5` or `claude-opus-5-5` into the Model field of Cline, Roo Code or Kilo Code, but send a test message first, and switch to a GPT, DeepSeek or GLM model if `503` keeps coming back. If Claude is your main model, a tool that speaks the Anthropic format, such as Claude Code, is the steadier option: see our [Claude Code API key setup guide](https://goiapi.com/en/blog/claude-code-api-key).

### Claude requests carry a fixed block of input tokens

With `claude-haiku-5-5`, a message containing only the letter "a" was billed as 134 input tokens; our estimate of the fixed part per request is roughly 115 to 130 input tokens. GoiAPI does not add anything to what you send and bills exactly the token counts in `usage`; this fixed part is already inside those numbers. On a short question it is most of the input. On the multi-thousand-token requests a coding agent sends, it is a small share. When comparing models, look at real token counts on the **Request history** page instead of guessing from prompt length.

### Reasoning models need room in Max Output Tokens

`deepseek-v4.1-flash`, `glm-5.3` and `glm-5.3-flash` returned reasoning tokens: text the model "thinks" before answering. Those tokens count as output and are billed. In one of our runs, `deepseek-v4.1-flash` with `max_tokens: 400` used the whole budget on reasoning and returned an empty answer, which was still billed. With these models, don't set Max Output Tokens very low.

## How to estimate what a coding session costs

The cost of a request is `input tokens × input price + output tokens × output price`, with prices per 1M tokens. Coding agents resend file contents and the conversation on every step, so input tokens usually dominate.

As an illustration only (not a measurement): a session that adds up to 2,000,000 input tokens and 100,000 output tokens on `gpt-6.1-sol` would cost 2 × $0.13 + 0.1 × $0.78 = $0.338 at the prices checked on December 5, 2026. Your real numbers depend on the size of your project and how long the agent works, so check the **Request history** page after your first session, or plug your own numbers into the [cost calculator](https://goiapi.com/en/tools/cost-calculator). For a fuller explanation of tokens and per-token prices, see [AI API tokens and what 1M tokens costs](https://goiapi.com/en/blog/ai-api-tokens-pricing).

GoiAPI prices for the models in this guide, per 1M tokens in USD (source: [goiapi.com/en/pricing](https://goiapi.com/en/pricing), checked on December 5, 2026):

| Model ID | Input | Output | Cache read |
|---|---|---|---|
| `claude-haiku-5-5` | $0.0221 | $0.1105 | $0.00221 |
| `claude-opus-5-5` | $0.442 | $2.21 | $0.0221 |
| `deepseek-v4-pro-0813` | $0.144144 | $0.432432 | $0.014495 |
| `deepseek-v4.1-flash` | $0.0408408 | $0.1225224 | $0.0040664 |
| `gpt-6-luna` | $0.0208 | $0.1248 | $0.002106 |
| `gpt-6.1-sol` | $0.13 | $0.78 | $0.013026 |
| `gpt-6.2-sol` | $0.13 | $0.78 | $0.013026 |
| `glm-5.3` | $0.144144 | $0.432432 | $0.014495 |
| `glm-5.3-flash` | $0.0408408 | $0.1225224 | $0.0040664 |

## Common errors and how to fix them

These are the status codes you will see most often after setting up any of the four tools. The messages below are the English messages from GoiAPI's [error codes page](https://goiapi.com/en/docs/error-codes).

| Status | What it usually means in these tools | Fix |
|---|---|---|
| `401` | Missing, mistyped or revoked key. Message: `The API key is invalid or has been revoked.` or `Missing API key. Send your key in the Authorization: Bearer <key> header or the x-api-key header.` | Paste the key again and watch for stray spaces. Create a new key if it was revoked. |
| `402` | Balance too low to hold funds for the request: `Your balance is too low for this request (about ${amount} needs to be held). Please top up your balance.` | Top up, or lower Max Output Tokens so the hold is smaller. |
| `403` | The key is valid but restricted: `This API key is not allowed to use the model {model}.` or not allowed from your IP. | Update the key's allowed models or IPs in the dashboard. |
| `404` | Wrong model ID or wrong path: `The model {model} does not exist. See the list at /v1/models.` | Use the model ID (`gpt-6.1-sol`), not the display name ("GPT-6.1 Sol"). Make sure the base URL ends in `/v1` for OpenAI Compatible, and isn't doubled to `/v1/v1`. |
| `429` | Per-minute request limit reached (60 per minute on our test key), the daily or monthly spending limit you set was hit, or the model is overloaded. | Wait for the seconds in `Retry-After`. Spending-limit errors include `x-should-retry: false`, so retrying right away won't help. |
| `503` | Maintenance, the model is temporarily not responding, or the model isn't available in the OpenAI format. | Retry later. For Claude models, if `503` repeats, switch models or use a tool that speaks the Anthropic format. |

A failed request that returns no content is not charged, unless you cancelled it yourself. Every response carries an `x-request-id` header; include it when you [contact support](https://goiapi.com/en/contact) so the request can be looked up quickly.

Cline's and Roo Code's docs list their own messages for the same problems: "Invalid API Key" (check the key), "Model Not Found" (check the model ID against that base URL) and connection errors (check the base URL and your network).

## When a custom API key is not the right choice

A custom key makes sense when you want to pay per token you actually use, switch models whenever you like, and pay with USDT instead of a card (see [using the Claude API without a credit card](https://goiapi.com/en/blog/claude-api-without-credit-card)). It is the wrong fit in a few cases:

- **You use Cursor mainly for Tab.** Custom keys don't apply to Tab completion, so you would still need a Cursor plan for it.
- **You need models GoiAPI doesn't offer.** As of December 5, 2026, the catalog has 9 models from Anthropic, OpenAI, DeepSeek and Zhipu (GLM). There is no Gemini and no Claude Sonnet. Larger multi-model gateways list far more models.
- **Your company needs a data processing agreement directly with Anthropic or OpenAI.** In that case, use their APIs directly.

If you live in the terminal rather than an editor, the same key also works with [Codex CLI through a custom provider](https://goiapi.com/en/blog/codex-cli-custom-provider), and [Claude Code Router](https://goiapi.com/en/blog/claude-code-router) lets Claude Code use GPT, DeepSeek and GLM models.

## FAQ

### What base URL do I use for Cline's OpenAI Compatible provider?

Use the base URL of the service your key belongs to, ending at `/v1`. For GoiAPI that is `https://api.goiapi.com/v1`. Don't add `/chat/completions`; Cline appends it. Don't use `https://api.openai.com/v1` with a key from another service.

### Can I use Claude models in Cline or Roo Code with an OpenAI-compatible key?

Yes, if the service exposes Claude through the OpenAI format. With GoiAPI, `claude-haiku-5-5` and `claude-opus-5-5` answered through `/v1/chat/completions` in our main test on December 3, 2026, but a later run returned `503` for Haiku while the Anthropic format kept working. Test first, and keep a GPT, DeepSeek or GLM model as a backup choice.

### Can one API key be used in Cline, Roo Code, Kilo Code and Cursor at the same time?

Yes. A key isn't tied to one tool. Still, a separate key per tool is safer: you can set a spending limit on each, see which tool spent what, and revoke one without breaking the others. All keys on an account draw from the same balance, and the per-minute request limit applies to each key.

### Why does Cline say "Model Not Found"?

The model ID doesn't exist at that base URL. The most common cause is typing the display name ("GPT-6.1 Sol") instead of the ID (`gpt-6.1-sol`). Call `GET /v1/models` with your key to see the exact IDs your key can use.

### Does a custom API key work with Cursor Tab?

No. According to the Cursor documentation (now at docs.grok.com/build, checked December 5, 2026), custom keys only work with chat models, and Tab completion keeps using the built-in models.

### Why did turning on Override OpenAI Base URL break Cursor's own models?

The override is global. While it is on, Cursor sends its own OpenAI-family models to your endpoint too, and they fail if your endpoint doesn't serve them. Cursor staff confirmed this on the forum in August 2026. Turn the override off to use Cursor's models.

### Where do I set Max Output Tokens and Context Window?

In Cline and Roo Code, under **Model Configuration** in the provider settings. In Kilo Code, in the `kilo.jsonc` config file. Leave Context Window at the default or a conservative value, and don't set Max Output Tokens so low that reasoning models run out of room.

### How do I stop an agent from spending too much?

Set a daily or monthly spending limit on the key when you create it in the dashboard. Requests that would go over the limit are rejected with `429` instead of being charged. Topping up only what you plan to use also caps your exposure, since top-ups are final and non-refundable.

## Get started with GoiAPI

1. [Sign up](https://goiapi.com/en/signup) and verify your email.
2. Top up with USDT (TRC20 or BEP20) or Binance Pay. No credit card or monthly fee; top-ups are final, so add only what you plan to use.
3. Create an API key, set a spending limit, and paste it into Cline, Roo Code, Kilo Code or Cursor with the base URL `https://api.goiapi.com/v1` and a model ID from the [pricing page](https://goiapi.com/en/pricing).

The [quickstart](https://goiapi.com/en/docs/quickstart) walks through the same steps with a test call you can run from your terminal.
