Skip to content

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

  1. Open Cursor Settings (Cmd/Ctrl + ,)
  2. Navigate to Cursor Settings > Models
  3. Add your API key in the provider section

.env Configuration

Create or edit .env in your project root:

Terminal window
# Anthropic
ANTHROPIC_API_KEY=sk-ant-...
# OpenAI
OPENAI_API_KEY=sk-...
# Google
GEMINI_API_KEY=...
# DeepSeek
DEEPSEEK_API_KEY=...
# Groq
GROQ_API_KEY=gsk_...

Model Configuration Format

Cursor uses modelId and apiKey pairs. In settings or .env:

Terminal window
# Set default model
CURSOR_MODEL_ID=claude-sonnet-4-20250514
ANTHROPIC_API_KEY=sk-ant-...

Available Model IDs

ProvidermodelId
Anthropicclaude-sonnet-4-20250514
Anthropicclaude-3-5-sonnet-20241022
OpenAIgpt-4o
OpenAIgpt-4o-mini
Googlegemini-2.0-flash
DeepSeekdeepseek-coder
Groqllama-3.3-70b-versatile

Windsurf Configuration

Settings UI

  1. Open Windsurf Settings
  2. Navigate to AI > Providers
  3. Enter your API key for each provider

.env Configuration

Windsurf uses a similar .env approach:

Terminal window
# Anthropic
ANTHROPIC_API_KEY=sk-ant-...
# OpenAI
OPENAI_API_KEY=sk-...
# Google
GEMINI_API_KEY=...
# DeepSeek
DEEPSEEK_API_KEY=...
# Groq
GROQ_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

Terminal window
export ANTHROPIC_API_KEY="sk-ant-..."

Model ID: claude-sonnet-4-20250514

OpenAI GPT

Terminal window
export OPENAI_API_KEY="sk-..."

Model ID: gpt-4o

Google Gemini

Terminal window
export GEMINI_API_KEY="..."

Model ID: gemini-2.0-flash

DeepSeek

Terminal window
export DEEPSEEK_API_KEY="..."

Model ID: deepseek-coder

Groq

Terminal window
export GROQ_API_KEY="gsk_..."

Model ID: llama-3.3-70b-versatile

Verification

  1. Open the editor’s AI panel
  2. Check that your configured model appears in the model selector
  3. Send a test prompt to confirm the provider responds
  4. Verify no API key errors appear in the output

Troubleshooting

  • Model not listed: Confirm the modelId is 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