Cursor Integration
Cursor is an AI-powered code editor built on VSCode. You can configure Cursor to use LLM API for enhanced AI capabilities, access to multiple models, and better cost control.
Prerequisites
Before you start, make sure you have:
- An LLM API account with an API key
- Cursor IDE installed
- A Cursor plan that supports custom models — using your own API key and base URL is a Pro feature
Setup
Cursor speaks the OpenAI-compatible API, so pointing it at LLM API takes just a few minutes. LLM API is a gateway: one key and one base URL give you access to every model from every provider.
Get your API key
- Open the API Keys page — make sure you're signed in
- Create a new key (or regenerate an existing one if you need to)
- Copy it and store it somewhere safe — it's shown only once
(Optional) Wire up your other tools in one shot
Already using other AI coding tools — Claude Code, Aider, Zed, Continue, opencode? The llm-setup configurator points them all at LLM API in a single run and stores your key once, so you don't paste it into a dozen places.
macOS / Linux
curl -fsSL https://llmapi.ai/install | bash
Windows
irm https://llmapi.ai/install.ps1 | iex
INFO
Cursor stores its settings in app state, so the configurator can't write them for you — instead it
prints the exact values to paste (the same ones in the next steps). It writes config
automatically for terminal tools like Claude Code and Aider. Full details in the llm-setup
guide.
You can safely skip this step and configure Cursor by hand below.
Point Cursor at LLM API
- Open Settings and go to the Models tab
- Open the API Keys section
- Toggle OpenAI API Key on, and paste the LLM API key from step 1
- Toggle Override OpenAI Base URL on, and set it to
https://api.llmapi.ai/v1
Add the models you want
In the Models section, add any LLM API supported model by its ID:
- For chat: use models like
gpt-5, gpt-4o, or claude-sonnet-4-5
- For a specific provider: prefix the model with the provider name, e.g.
openai/gpt-5, anthropic/claude-sonnet-4-5, google/gemini-2.0-flash-exp
- For custom models: prefix with the provider name, e.g.
custom/my-model
- For discounted / free / reasoning models: copy the exact ID from the models page —
discounted ·
free ·
reasoning
Test the connection
- Switch Cursor's agent (or chat model) to the custom model you just added
- Send any request — for example, open the AI chat (Cmd/Ctrl + L) and ask a quick question
If you get a reply, you're connected — every AI request now routes through LLM API.
SUCCESS
You're all set! Cursor's chat and inline edit now run through LLM API. Tab autocomplete is the
exception — see Limitations.
Limitations
Cursor treats custom API keys as a chat-only feature, so a few things won't route through LLM API no matter how you configure it:
- Tab autocomplete always uses Cursor's built-in models. There is no way to point completions at a custom endpoint — only chat and inline edit (Cmd/Ctrl + K) honor your key and base URL.
- Agent features may fall back to Cursor's backend. Cursor's docs state that custom API keys "only work with chat models" — advanced agent capabilities (background agents, some Composer flows) can require Cursor-hosted models and may fail or silently ignore the override.
- Requests still pass through Cursor's servers. Your key is stored in Cursor's secure storage and sent along with each request to Cursor's backend (encrypted in transit), which then calls LLM API. Cursor's Zero Data Retention guarantees do not apply when using a custom key.
- A paid Cursor plan is required. The OpenAI key / base URL override is not available on the free tier.
- Settings can't be automated. Cursor keeps these values in app state (not a config file), so tools like
llm-setup can only print the values for you to paste — there's no supported way to set them from a script.
If full routing through LLM API matters to you (including completions and agents), consider a tool with first-class custom-provider support — Zed, Continue, or Claude Code.
Features
Once configured, you can use all of Cursor's AI features with LLM API:
AI Chat (Cmd/Ctrl + L)
- Ask questions about your code
- Request code explanations
- Get debugging help
- Generate new code
Inline Edit (Cmd/Ctrl + K)
- Edit code with natural language instructions
- Refactor functions
- Add features to existing code
WARN
Tab autocomplete is not included — it always runs on Cursor's built-in models (see
Limitations).
Advanced Configuration
Using Different Models for Different Features
Cursor allows you to configure different models for different features:
- Chat Model: Use a powerful model like
gpt-5 or claude-sonnet-4-5
- Provider Specific Model: Use a provider specific model like
openai/gpt-5, anthropic/claude-sonnet-4-5, google/gemini-2.0-flash-exp
- Custom Model: Use a custom model like
custom/my-model
- Free Model: Use a free model like
routeway/deepseek-r1t2-chimera-free
- Reasoning Model: Use a reasoning model like
canopywave/kimi-k2-thinking
This gives you the best balance of performance and cost.
Model Routing
With LLM API's routing features, you can:
- Chooses cost-effective models by default for optimal price-to-performance ratio
- Automatically scales to more powerful models based on your request's context size
- Handles large contexts intelligently by selecting models with appropriate context windows
Troubleshooting
Authentication Errors
If you see authentication errors:
- Verify your API key is correct
- Check that the base URL is set to
https://api.llmapi.ai/v1
- Ensure your LLM API account has sufficient credits
Model Not Found
If you see "model not found" errors:
- Verify the model ID exists in the models page
- Check that you're using the correct model name format
- Some models may require specific provider configurations in your LLM API dashboard
Slow Responses
If responses are slow:
- Check your internet connection
- Monitor your usage in the LLM API dashboard
- Consider switching chat to a faster model (e.g.
gpt-4o-mini)
Benefits of Using LLM API with Cursor
- Multi-Provider Access: Use models from OpenAI, Anthropic, Google, Open-source models and more
- Cost Control: Track and limit your AI spending with detailed usage analytics
- Caching: Reduce costs with response caching
- Analytics: Monitor usage patterns and costs