Cursor & Windsurf Integration
Cursor & Windsurf Integration
Cursor and Windsurf are AI-native code editors that support multiple LLM providers. Both use similar .env or settings-based configuration for API keys and model selection.
Overview
- Cursor - VS Code-based editor with built-in AI features
- Windsurf - AI-first IDE with integrated coding assistant
Both editors allow you to bring your own API keys for various providers.
Cursor Configuration
Settings UI
- Open Cursor Settings (
Cmd/Ctrl + ,) - Navigate to Cursor Settings > Models
- Add your API key in the provider section
.env Configuration
Create or edit .env in your project root:
# AnthropicANTHROPIC_API_KEY=sk-ant-...
# OpenAIOPENAI_API_KEY=sk-...
# GoogleGEMINI_API_KEY=...
# DeepSeekDEEPSEEK_API_KEY=...
# GroqGROQ_API_KEY=gsk_...Model Configuration Format
Cursor uses modelId and apiKey pairs. In settings or .env:
# Set default modelCURSOR_MODEL_ID=claude-sonnet-4-20250514ANTHROPIC_API_KEY=sk-ant-...Available Model IDs
| Provider | modelId |
|---|---|
| Anthropic | claude-sonnet-4-20250514 |
| Anthropic | claude-3-5-sonnet-20241022 |
| OpenAI | gpt-4o |
| OpenAI | gpt-4o-mini |
gemini-2.0-flash | |
| DeepSeek | deepseek-coder |
| Groq | llama-3.3-70b-versatile |
Windsurf Configuration
Settings UI
- Open Windsurf Settings
- Navigate to AI > Providers
- Enter your API key for each provider
.env Configuration
Windsurf uses a similar .env approach:
# AnthropicANTHROPIC_API_KEY=sk-ant-...
# OpenAIOPENAI_API_KEY=sk-...
# GoogleGEMINI_API_KEY=...
# DeepSeekDEEPSEEK_API_KEY=...
# GroqGROQ_API_KEY=gsk_...Model Selection
In Windsurf settings, specify the model with modelId and apiKey:
{ "windsurf.models": [ { "modelId": "claude-sonnet-4-20250514", "apiKey": "${ANTHROPIC_API_KEY}" }, { "modelId": "gpt-4o", "apiKey": "${OPENAI_API_KEY}" } ]}Provider-Specific Setup
Anthropic Claude
export ANTHROPIC_API_KEY="sk-ant-..."Model ID: claude-sonnet-4-20250514
OpenAI GPT
export OPENAI_API_KEY="sk-..."Model ID: gpt-4o
Google Gemini
export GEMINI_API_KEY="..."Model ID: gemini-2.0-flash
DeepSeek
export DEEPSEEK_API_KEY="..."Model ID: deepseek-coder
Groq
export GROQ_API_KEY="gsk_..."Model ID: llama-3.3-70b-versatile
Verification
- Open the editor’s AI panel
- Check that your configured model appears in the model selector
- Send a test prompt to confirm the provider responds
- Verify no API key errors appear in the output
Troubleshooting
- Model not listed: Confirm the
modelIdis spelled correctly - Authentication failed: Regenerate your API key and update
.env - Slow responses: Switch to Groq for faster inference
- Rate limits: Check provider dashboard for usage and tier info