Configure BYOK API keys for OpenAI, Anthropic, Google, Azure, and custom models in Cursor. Triggers on "cursor api key", "cursor openai key", "cursor anthropic key", "own api key cursor", "BYOK cursor", "cursor azure key".
71
66%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./plugins/saas-packs/cursor-pack/skills/cursor-api-key-management/SKILL.mdConfigure Bring Your Own Key (BYOK) for AI model providers in Cursor. BYOK lets you use your own API keys to bypass Cursor's monthly quota, pay per token directly, and access models not included in Cursor's subscription.
| Provider | Key Format | Models Available |
|---|---|---|
| OpenAI | sk-proj-... or sk-... | GPT-4o, GPT-4o-mini, o1, o3, GPT-5 |
| Anthropic | sk-ant-api03-... | Claude Sonnet, Claude Opus, Claude Haiku |
AIzaSy... | Gemini 2.5 Pro, Gemini Flash | |
| Azure OpenAI | Azure portal key | Any deployed Azure OpenAI model |
| AWS Bedrock | IAM credentials | Claude, Titan, Llama models |
| OpenAI-compatible | Varies | Ollama, LM Studio, Together AI, etc. |
Cursor Settings > Models > check Use own API keygpt-4o)Cursor Settings > Models > check Use own API keyCursor Settings > Models > check Use own API keyAzure requires additional configuration beyond a simple API key:
gpt-4o)Cursor Settings > Models:Azure Configuration:
API Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Endpoint: https://your-instance.openai.azure.com
Deployment: your-gpt4o-deployment-name
API Version: 2024-10-21For self-hosted models (Ollama, vLLM) or third-party providers:
Cursor Settings > Models > Add Modelllama-3.1-70bOverride OpenAI Base URLOllama: http://localhost:11434/v1
LM Studio: http://localhost:1234/v1
Together AI: https://api.together.xyz/v1BYOK key used: Cursor model (always):
┌──────────────────────┐ ┌──────────────────────┐
│ Chat (Cmd+L) │ │ Tab Completion │
│ Composer (Cmd+I) │ │ Apply from Chat │
│ Agent Mode │ │ (diff application) │
│ Inline Edit (Cmd+K) │ │ │
└──────────────────────┘ └──────────────────────┘Tab Completion and Apply always use Cursor's proprietary models. You cannot route these through your own API key.
With BYOK, you pay the provider directly. Monitor costs at:
Set monthly spending limits at the provider level:
@Files not @Codebase when you know the location| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| GPT-4o | $2.50 | $10.00 |
| GPT-4o-mini | $0.15 | $0.60 |
| Claude Sonnet | $3.00 | $15.00 |
| Claude Opus | $15.00 | $75.00 |
| o1 | $15.00 | $60.00 |
A typical Composer session generating multi-file code uses 5K-20K tokens.
Cursor stores API keys locally in its settings database:
~/Library/Application Support/Cursor/~/.config/Cursor/%APPDATA%\Cursor\Keys are stored in the local Cursor configuration, not in project files. They do not sync between machines.
Cursor Settings > ModelsFor teams using BYOK:
| Error | Cause | Fix |
|---|---|---|
401 Unauthorized | Invalid or expired API key | Regenerate key at provider |
429 Rate Limited | Too many requests | Wait, or upgrade provider plan |
403 Forbidden | Key lacks model access | Enable model access at provider |
| Model not appearing | Key not saved or wrong provider | Re-enter key in Cursor Settings |
| Azure connection refused | Wrong endpoint or API version | Verify endpoint URL and version |
| Slow responses with BYOK | Provider rate limits apply | Check provider dashboard |
3e83543
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.