API keys in Cursor, Cline and Continue

Published 2026-10-16 · Updated 2026-10-24

Every AI coding tool has the same escape hatch: a custom provider or “OpenAI-compatible” option where you supply a base URL, a key, and a model id. Here’s where it lives in each.

Cursor

Settings → Models → add a provider or override the OpenAI base URL. Paste the key, set the base URL (e.g. https://openrouter.ai/api/v1), then add the model id you want, anthropic/claude-sonnet-5, deepseek/deepseek-v4, whatever. One caveat: Cursor reserves some model names as built-ins; a custom model named like a managed one may not route to your provider. Rename it if calls never leave.

Cline (VS Code)

Open the Cline settings gear → API Provider → pick “OpenAI Compatible”. Fields: Base URL, API Key, Model ID. This is the cleanest integration, it takes literally any endpoint from the base-URL cheat sheet, including DeepSeek, Z.ai and Moonshot.

Continue

Edit config.yaml (or config.json on older versions):

models:
  - name: Kimi K3
    provider: openai
    model: kimi-k3
    apiBase: https://api.moonshot.ai/v1
    apiKey: ${MOONSHOT_API_KEY}
    roles: [chat, edit]

Continue reads env vars, so keep the key out of the file.

Aider (terminal)

export OPENROUTER_API_KEY="sk-or-v1-..."
aider --model openrouter/anthropic/claude-sonnet-5

Aider routes openrouter/-prefixed models through OpenRouter automatically; for other providers use --openai-api-base.

Xcode

Settings → Intelligence → Add Model Provider → “Internet Hosted”. URL is the bare host, and you can override the auth header name, needed for providers that want Authorization: Bearer when the default is x-api-key, or vice versa.

The recipe that works everywhere

  1. Provider = “OpenAI Compatible” (or “Custom”).
  2. Base URL from the cheat sheet.
  3. Key pasted in full, watch for truncation on long JWT keys.
  4. Model id spelled exactly as the provider’s /models endpoint lists it.
  5. Test with the smallest possible prompt before wiring it into an agent loop.