Using Cursor with Yi-AI Router
Connect Cursor through Yi-AI Router to access all models via a single API key, with centralized billing and automatic provider failover.
Quick Start
Prerequisites
- Cursor installed
- A Yi-AI account with an API Key (
sk-yi-...)
Configuration
Cursor supports custom OpenAI-compatible endpoints through its Override OpenAI Base URL feature.
Step 1: Open Cursor Settings
Open Cursor Settings (Cmd/Ctrl + ,), navigate to Models, then expand the API Keys section.
Step 2: Configure OpenAI Provider
Enable OpenAI API Key and fill in:
| Field | Value |
|---|---|
| OpenAI API Key | Your Yi-AI API Key (sk-yi-...) |
| Override OpenAI Base URL | https://www.yiairouter.com/api/v1 |
Step 3: Add Models
In the Models section, click + Add Model and enter model IDs from the Yi-AI catalog. For example:
claude-sonnet-4-20250514
claude-haiku-4-5
gpt-4o-mini
gemini-1.5-flash
You can browse all available models at your Yi-AI Dashboard or via the API at /api/v1/models.
Step 4: Select Model
Open the model picker in Cursor's chat or Composer panel and select one of the models you added. All requests will now route through Yi-AI Router.
How It Works
Yi-AI Router implements the OpenAI Chat Completions API (/api/v1/chat/completions). Cursor's OpenAI provider slot communicates with Yi-AI Router directly using its native protocol β no local proxy required. The platform handles model mapping, usage accounting, and billing.
Key features:
- Single API key for all models across providers
- Automatic model routing β deprecated models fall back to stable alternatives
- Centralized billing β all usage tracked in your Yi-AI dashboard
- No vendor lock-in β switch models without changing configuration
Model Discovery
Cursor can auto-discover available models from the /api/v1/models endpoint. After configuring the OpenAI provider, Cursor may automatically populate the model list. If not, add models manually using the IDs shown in the Yi-AI dashboard.
Troubleshooting
"Invalid API Key"
Make sure you're using your Yi-AI API key (sk-yi-...), not an OpenAI or other provider key.
Models not appearing
Verify your Yi-AI account has sufficient balance. Models with $0 balance may be restricted.
Request timeouts
If using a local development server (localhost), ensure the server is running. For the production gateway, check your network connection.
Model not found
Ensure the model ID matches exactly what's shown in the Yi-AI model catalog. Model IDs are case-sensitive.