Cursor IDE Integration

Route Cursor AI requests through TheRouter.ai for model selection, fallbacks, and centralized spend controls.

Overview

Cursor supports OpenAI-compatible API providers. By pointing Cursor at TheRouter.ai you get access to 200+ models, automatic fallbacks, and unified billing across all providers.

Configuration

Open Cursor Settings and navigate to Models. Add a new OpenAI-compatible provider with these values:

text
Provider type: OpenAI-compatible
Base URL: https://api.therouter.ai/v1
API key: <your-therouter-api-key>

Replace <your-therouter-api-key> with a tenant key from the TheRouter.ai dashboard. After saving, let Cursor refresh the model list from/v1/models.

Model Selection

Use provider/model format when selecting models in Cursor. Popular choices for coding tasks:

text
anthropic/claude-sonnet-4.6   β€” Best default for coding
anthropic/claude-sonnet-4.5   β€” Stable high-quality fallback
openai/gpt-4o                 β€” Strong general-purpose model
google/gemini-2.0-flash-001   β€” Fast large-context option
anthropic/claude-opus-4.6     β€” Deep reasoning for complex tasks

Validation

Before picking a model in Cursor, verify that your key can list the exact model IDs exposed by TheRouter.ai:

bash
curl https://api.therouter.ai/v1/models \
  -H "Authorization: Bearer $THEROUTER_API_KEY" | head -c 400

Copy model IDs exactly from that response. Do not use upstream provider model names or dated variants unless they appear in /v1/models.

Troubleshooting

If Cursor reports model not found or a generic API error, the cause is usually one of these:

text
1. The Base URL is missing the /v1 suffix.
2. The API key is a management key instead of a tenant key.
3. The selected model ID does not exactly match an id returned by /v1/models.
4. Cursor cached an old model list; refresh the provider after updating the key.

Start debugging with /v1/models first. If the model is not in that list, Cursor will not be able to use it.

Using more than one coding client?
If your team switches between Cursor, Claude Code, OpenCode, Gemini CLI, and OpenClaw, use the cc-switch guide instead of hand-editing each local config separately.
Use exact aliases
TheRouter.ai routes standardized aliases such as anthropic/claude-sonnet-4.5. Upstream-only IDs like claude-sonnet-4-5-20250514,claude-opus-4-0-20250514, or gemini-2.0-flashare not guaranteed to exist and can return model not found.