cursor-api-key-management

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".

25 stars

Best use case

cursor-api-key-management is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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".

Teams using cursor-api-key-management should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/cursor-api-key-management/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/jeremylongshore/claude-code-plugins-plus-skills/cursor-api-key-management/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/cursor-api-key-management/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How cursor-api-key-management Compares

Feature / Agentcursor-api-key-managementStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Cursor API Key Management

Configure 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.

## Supported Providers

| 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 |
| Google | `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. |

## Configuration Steps

### OpenAI

1. Go to [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
2. Create a new API key (project-scoped recommended)
3. In Cursor: `Cursor Settings` > `Models` > check `Use own API key`
4. Paste key in the OpenAI API Key field
5. Select model from dropdown (e.g., `gpt-4o`)

### Anthropic

1. Go to [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys)
2. Create a new API key
3. In Cursor: `Cursor Settings` > `Models` > check `Use own API key`
4. Paste key in the Anthropic API Key field
5. Select Claude model from dropdown

### Google (Gemini)

1. Go to [aistudio.google.com/apikey](https://aistudio.google.com/apikey)
2. Create API key
3. In Cursor: `Cursor Settings` > `Models` > check `Use own API key`
4. Paste key in the Google API Key field

### Azure OpenAI

Azure requires additional configuration beyond a simple API key:

1. In Azure Portal: create an Azure OpenAI resource
2. Deploy your desired model (e.g., `gpt-4o`)
3. Note the **Endpoint URL** and **API Key** from the resource
4. In Cursor: `Cursor Settings` > `Models`:

```
Azure Configuration:
  API Key:        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  Endpoint:       https://your-instance.openai.azure.com
  Deployment:     your-gpt4o-deployment-name
  API Version:    2024-10-21
```

### Custom OpenAI-Compatible Endpoints

For self-hosted models (Ollama, vLLM) or third-party providers:

1. `Cursor Settings` > `Models` > `Add Model`
2. Model name: e.g., `llama-3.1-70b`
3. Check `Override OpenAI Base URL`
4. Enter base URL:

```
Ollama:        http://localhost:11434/v1
LM Studio:    http://localhost:1234/v1
Together AI:  https://api.together.xyz/v1
```

5. Enter API key if required by the provider
6. The model appears in the Chat/Composer model dropdown

## What BYOK Covers (and What It Does Not)

```
BYOK 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.

## Cost Management

### Monitoring Usage

With BYOK, you pay the provider directly. Monitor costs at:
- OpenAI: [platform.openai.com/usage](https://platform.openai.com/usage)
- Anthropic: [console.anthropic.com/settings/billing](https://console.anthropic.com/settings/billing)
- Azure: Azure Cost Management portal

### Setting Spending Limits

Set monthly spending limits at the provider level:
- **OpenAI**: Settings > Limits > Set monthly budget
- **Anthropic**: Settings > Limits > Set spending limit
- **Azure**: Create budget alerts in Azure Cost Management

### Cost-Saving Strategies

1. **Use Auto mode**: Cursor selects cheaper models for simple tasks
2. **Default to Sonnet/GPT-4o**: Reserve Opus/o1 for hard problems
3. **Shorter context**: Use `@Files` not `@Codebase` when you know the location
4. **Fewer round-trips**: Write detailed prompts to reduce back-and-forth

### Approximate Token Costs (as of early 2026)

| 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.

## Security Best Practices

### Key Storage

Cursor stores API keys locally in its settings database:
- macOS: `~/Library/Application Support/Cursor/`
- Linux: `~/.config/Cursor/`
- Windows: `%APPDATA%\Cursor\`

Keys are stored in the local Cursor configuration, not in project files. They do not sync between machines.

### Rotation

1. Generate a new key at the provider
2. Update the key in `Cursor Settings` > `Models`
3. Revoke the old key at the provider
4. Verify Chat/Composer work with the new key

### Team Key Management

For teams using BYOK:
- **Individual keys**: Each developer uses their own key. Simplest setup, hardest to audit.
- **Shared project key**: Create a project-scoped key at the provider. Share via secure channel. Track usage per project.
- **Azure gateway**: Route all requests through a central Azure OpenAI deployment. Full audit logging, spending controls, model governance.

## Troubleshooting

| 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 |

## Enterprise Considerations

- **Compliance**: BYOK routes requests directly to the provider, bypassing Cursor's infrastructure. Verify this meets your data governance requirements.
- **Azure private endpoints**: Enterprise Azure deployments can use private endpoints for network-level isolation
- **Key rotation policy**: Implement quarterly key rotation as standard practice
- **SSO + BYOK**: Team admins can configure shared BYOK keys via the admin dashboard (Enterprise plan)

## Resources

- [Cursor API Keys Documentation](https://docs.cursor.com/advanced/api-keys)
- [Cursor Data Use Policy](https://cursor.com/data-use)
- [OpenAI API Reference](https://platform.openai.com/docs/api-reference)
- [Anthropic API Reference](https://docs.anthropic.com/en/api)

Related Skills

MCP Configuration Management

25
from ComeOnOliver/skillshub

## Overview

cursor-usage-analytics

25
from ComeOnOliver/skillshub

Track and analyze Cursor usage metrics via admin dashboard: requests, model usage, team productivity, and cost optimization. Triggers on "cursor analytics", "cursor usage", "cursor metrics", "cursor reporting", "cursor dashboard", "cursor ROI".

cursor-upgrade-migration

25
from ComeOnOliver/skillshub

Upgrade Cursor versions, migrate from VS Code, and transfer settings between machines. Triggers on "upgrade cursor", "update cursor", "cursor migration", "cursor new version", "vs code to cursor", "cursor changelog".

cursor-team-setup

25
from ComeOnOliver/skillshub

Set up Cursor for teams: plan selection, member management, shared rules, admin dashboard, and onboarding. Triggers on "cursor team", "cursor organization", "cursor business", "cursor enterprise setup", "cursor admin".

cursor-tab-completion

25
from ComeOnOliver/skillshub

Master Cursor Tab autocomplete, ghost text, and AI code suggestions. Triggers on "cursor completion", "cursor tab", "cursor suggestions", "cursor autocomplete", "cursor ghost text", "cursor copilot".

cursor-sso-integration

25
from ComeOnOliver/skillshub

Configure SAML 2.0 and OIDC SSO for Cursor with Okta, Microsoft Entra ID, and Google Workspace. Triggers on "cursor sso", "cursor saml", "cursor oauth", "enterprise cursor auth", "cursor okta", "cursor entra", "cursor scim".

cursor-rules-config

25
from ComeOnOliver/skillshub

Configure Cursor project rules using .cursor/rules/*.mdc files and legacy .cursorrules. Triggers on "cursorrules", ".cursorrules", "cursor rules", "cursor config", "cursor project settings", ".mdc rules", "project rules".

cursor-reference-architecture

25
from ComeOnOliver/skillshub

Reference architecture for Cursor IDE projects: directory structure, rules organization, indexing strategy, and team configuration patterns. Triggers on "cursor architecture", "cursor project structure", "cursor best practices", "cursor file structure".

cursor-prod-checklist

25
from ComeOnOliver/skillshub

Production readiness checklist for Cursor IDE setup: security, rules, indexing, privacy, and team standards. Triggers on "cursor production", "cursor ready", "cursor checklist", "optimize cursor setup", "cursor onboarding".

cursor-privacy-settings

25
from ComeOnOliver/skillshub

Configure Cursor privacy mode, data handling, telemetry, and sensitive file exclusion. Triggers on "cursor privacy", "cursor data", "cursor security", "privacy mode", "cursor telemetry", "cursor data retention".

cursor-performance-tuning

25
from ComeOnOliver/skillshub

Optimize Cursor IDE performance: reduce memory usage, speed up indexing, tune AI features, and manage extensions for large codebases. Triggers on "cursor performance", "cursor slow", "cursor optimization", "cursor memory", "speed up cursor", "cursor lag".

cursor-multi-repo

25
from ComeOnOliver/skillshub

Work with multiple repositories in Cursor: multi-root workspaces, monorepo patterns, selective indexing, and cross-project context. Triggers on "cursor multi repo", "cursor multiple projects", "cursor monorepo", "cursor workspace", "multi-root workspace".