Use one API key in Cursor and Cline
I run qcode.cc, an independent API service (not official Anthropic, OpenAI or Google). The examples use QCode paths; swap the host for any compatible gateway.
The same third-party key can drive Cursor and the Cline VS Code extension if you set the matching OpenAI-compatible or Anthropic Base URL. This page is the short, vendor-neutral version of that setup, plus the mistakes that produce 404, 401 and model_not_available_on_endpoint.
Sources: Cline official OpenAI Compatible docs, OpenAI help: using OpenAI models in Cursor (BYOK scope), and — for the QCode worked example and Cursor 3.31.15 field names — QCode's Cursor guide and Cline guide (checked 2026-12-04). Cursor's own docs may change labels; confirm in Cursor Settings → Models and in Cursor's documentation. I run qcode.cc, an independent API service.
Which Base URL to paste
Editors append the API path for you. Paste only the prefix, with no trailing slash and without /chat/completions or /v1/messages.
| What you want to call | Typical setting | QCode worked example |
|---|---|---|
| Claude models (Anthropic Messages) | Anthropic Base URL — client appends /v1/messages | https://api.qcode.cc/api |
| GPT and many Chinese-family models (OpenAI Chat Completions) | OpenAI-compatible Base URL — client appends /chat/completions or /models | https://api.qcode.cc/openai/v1 |
On QCode, Claude IDs are not served on the OpenAI path and GPT IDs are not served on the Anthropic path. Sending the wrong family produces model_not_available_on_endpoint, which is a protocol error, not a bad key. Live IDs: qcode.cc/en/models. Other gateways may differ — follow their docs.
# Confirm the OpenAI-compatible path before pasting into the editor
curl -sS -H "Authorization: Bearer YOUR_API_KEY" \
https://api.qcode.cc/openai/v1/models
# Confirm the Anthropic path
curl -sS -X POST https://api.qcode.cc/api/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-sonnet-5-5","max_tokens":16,"messages":[{"role":"user","content":"ping"}]}'
Cursor
Open Cursor Settings → Models (on many builds, Ctrl+, / Cmd+,, or Ctrl/Cmd+Shift+J). You will typically see separate OpenAI and Anthropic API key fields, each with an "Override … Base URL" toggle.
- Sign in to your Cursor account first. Recent Cursor builds show a login gate before Models settings are usable; that is a Cursor account requirement, not something a third-party key replaces.
- For Claude: paste the key under Anthropic API, turn on
Override Anthropic Base URL, and enter the Anthropic prefix (QCode:https://api.qcode.cc/api). LeaveOverride OpenAI Base URLoff and empty. Add a Claude model id (for exampleclaude-sonnet-5-5orclaude-opus-5-5) with+ Add modelif it is not already listed, enable it, then use Verify if the build still has that button. - For GPT or Chinese models: paste the same key under OpenAI API, turn on
Override OpenAI Base URL, and enter the OpenAI-compatible prefix (QCode:https://api.qcode.cc/openai/v1). Add the exact model id (for examplegpt-6.2-solorglm-5.3). - Do not enable both overrides at once if you are calling Claude. On Cursor 3.31.15, that combination can route Claude requests to the OpenAI endpoint and fail with 422 /
model_not_available_on_endpoint. Switch the override when you switch families.
Limits you should expect (from OpenAI's Cursor help article and Cursor BYOK behavior documented there):
- Bring-your-own-key applies to local Chat and Agent features. It does not apply to Cursor Tab, Auto, Cloud or Background Agents, Automations, the Cursor CLI, or Cursor's API and SDK. Tab will not start using your gateway after you set a Base URL — that is intended.
- Requests still go through Cursor's backend for prompt building; a custom key is not a direct editor-to-gateway connection. If you need a client that talks to the gateway itself, use Claude Code, Codex CLI, Cline or a similar local client.
- On Cursor Teams / Enterprise plans, third-party model requests may still be billed at Cursor's token rate in addition to your gateway. Check Cursor's current plan terms.
- If Verify fails but the curl commands above return JSON, look for a trailing slash, a missing
/v1on the OpenAI path, or a model id that the protocol does not serve.
Step-by-step screenshots for QCode: docs.qcode.cc Cursor guide.
Cline (VS Code extension)
Official setup for an OpenAI-compatible provider is in Cline's OpenAI Compatible documentation: open the Cline settings panel (gear), set API Provider to OpenAI Compatible, then fill Base URL, API Key and Model ID. The Base URL is the provider's endpoint, not https://api.openai.com/v1.
For Claude, use Cline's Anthropic provider instead, enable Use custom base URL, and paste the Anthropic prefix.
| Goal | API Provider | QCode Base URL | Model ID examples |
|---|---|---|---|
| Claude | Anthropic, with "Use custom base URL" | https://api.qcode.cc/api | claude-opus-5-5, claude-sonnet-5-5 |
| GPT or Chinese models | OpenAI Compatible | https://api.qcode.cc/openai/v1 | gpt-6.2-sol, glm-5.3 |
- Include
/v1on the OpenAI Compatible URL. From Cline v4.1.25 the OpenAI Compatible provider uses the Base URL string verbatim and does not append/v1. Omitting it against QCode returns HTTP 404. (Older mental models of "the client always adds /v1" do not apply here.) - Do not put
/v1or/v1/messageson the Anthropic custom base URL. Cline appends/v1/messages; a doubled path returnsInvalid URL (POST /v1/v1/messages). - In OpenAI Compatible mode the model list may be empty — type the id by hand. In Anthropic mode, pick an id from the list when you can, so it matches what the extension expects.
- Cline 4.1.27's Anthropic stream parser does not accept a
web_search_tool_resultblock. If you see a red "Type validation failed" error mentioning that type, turn Web Search off under Feature Settings → AGENT and reload the window. The key and Base URL are not the cause. - Cline Desktop uses the same idea (provider + custom base URL) but different chrome; this page describes the VS Code extension. Current Cline builds have removed a custom Base URL field from the built-in Google Gemini provider UI, so this page does not claim a native Gemini setup inside Cline.
Screenshots for QCode: docs.qcode.cc Cline guide.
Using Cursor and Claude Code side by side
Cursor Chat / Composer follows the Models settings above. The claude CLI in the integrated terminal follows ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN (or a ~/.claude/settings.json env block). The two configs are independent and can share one key. See the environment variable reference and troubleshooting.
Related pages
Troubleshooting · Environment variables · Setup cheat sheet · How to evaluate a relay
Facts checked against docs.qcode.cc on 2026-12-05. I run qcode.cc. Pricing: qcode.cc/pricing (no free quota). Contact: hi@qcode.cc.