---
title: Cursor Integration
description: Use LLM Gateway with Cursor IDE — plan mode and agent mode both route through the gateway. Tab autocomplete and inline edit stay on Cursor's backend.
image: guides/cursor/overview.png
icon: Cursor
---

import { Step, Steps } from "fumadocs-ui/components/steps";
import { Callout } from "fumadocs-ui/components/callout";

Cursor is an AI-powered code editor built on VSCode. You can point Cursor's custom OpenAI base URL at LLM Gateway to use any of our 200+ models in the AI panel — both **plan mode** and **agent mode**.

<Callout type="info">
	**Plan and agent mode.** Cursor routes its AI panel — plan mode and agent mode
	— through the custom API key + base URL, so both work with LLM Gateway. Tab
	autocomplete and inline edit (Cmd/Ctrl + K) remain locked to Cursor's own
	backend and will not route through the gateway. If you want every request in
	your workflow to go through LLM Gateway, use a terminal agent like [Claude
	Code](/guides/claude-code), [Codex CLI](/guides/codex-cli),
	[Cline](/guides/cline), [Continue CLI](/guides/continue), or [Hermes
	Agent](/guides/hermes-agent).
</Callout>

![Cursor with LLM Gateway](/guides/cursor/overview.png)

<Callout type="info">
	**Using DevPass?** This integration also works with a
	[DevPass](https://devpass.llmgateway.io) plan key. Use root model IDs without
	a provider prefix (`claude-sonnet-4-5`, not `anthropic/claude-sonnet-4-5`) —
	provider-pinned routing is not available on coding plans; the gateway picks
	the provider for you.
</Callout>

## Prerequisites

- An LLM Gateway account with an API key
- Cursor IDE installed
- Basic understanding of Cursor's AI features

## Setup

Cursor supports OpenAI-compatible API endpoints, making it easy to integrate with LLM Gateway.

<Steps>
<Step>
### Get Your API Key

1. Log in to your [LLM Gateway dashboard](https://llmgateway.io/dashboard)
2. Navigate to **API Keys** section
3. Create a new API key and copy the key

![LLM Gateway API Keys](/guides/cursor/api-key.png)

</Step>

<Step>
### Configure Cursor Settings

1. Open Cursor and go to **Settings** then Click on "Cursor Settings"
2. Click on "Models"
3. Click on "Add OpenAI API Key"

![Cursor Settings](/guides/cursor/settings-1.png)

3. Scroll down to **OpenAI API Key** section
4. Click on **Add OpenAI API Key**

![Cursor API Key Input](/guides/cursor/settings-2.png)

5. Enter your LLM Gateway API key

6. In the same Models settings, find the **Override OpenAI Base URL** option
7. Enable the override option
8. Enter the LLM Gateway endpoint: `https://api.llmgateway.io/v1`

</Step>

<Step>
### Select Models

1. In the **Models** section, you can now select from available models
2. Choose any [LLM Gateway supported model](https://llmgateway.io/models):

![Cursor Model Selection](/guides/cursor/model-selection.png)

- For chat: Use models like `gpt-5`, `gpt-4o`, `claude-sonnet-4-5`
- For custom models: Add the provider name before the model name (e.g. `custom/my-model`)
- For discounted models: copy the ids from from the [models page](https://llmgateway.io/models?view=grid&filters=1&discounted=true)
- For free models: copy the ids from from the [models page](https://llmgateway.io/models?view=grid&filters=1&free=true)
- For reasoning models: copy the ids from from the [models page](https://llmgateway.io/models?view=grid&filters=1&reasoning=true)

</Step>

<Step>
### Test the Integration

1. Open any code file in Cursor
2. Try using the AI chat (Cmd/Ctrl + L) in plan mode
3. Then switch the panel to agent mode and run a small multi-file task

![Cursor AI Chat](/guides/cursor/test-1.png)
![Cursor AI Chat 2](/guides/cursor/test-2.png)

All AI requests will now be routed through LLM Gateway.

</Step>
</Steps>

## What Works (and What Doesn't)

Cursor honors the custom OpenAI base URL for the **AI panel** (Cmd/Ctrl + L) — both plan mode and agent mode. Tab autocomplete and inline edit still use Cursor's own backend, even after you save the LLM Gateway key.

### Works through LLM Gateway

- **Plan mode (Cmd/Ctrl + L)** — Ask questions, plan changes, get explanations, debug.
- **Agent mode** — Cursor's coding agent runs multi-file edits with your gateway models.

All of these requests route through LLM Gateway and appear in your dashboard.

### Does NOT work through LLM Gateway

- **Inline Edit (Cmd/Ctrl + K)** — Locked to Cursor's backend.
- **Autocomplete / Tab completion** — Locked to Cursor's backend.

If you want every request in your workflow — including edits and completions — to route through LLM Gateway, use [Claude Code](/guides/claude-code), [Codex CLI](/guides/codex-cli), [Cline](/guides/cline), [Continue CLI](/guides/continue), or [Hermes Agent](/guides/hermes-agent).

### Model Routing

With LLM Gateway's [routing features](/features/routing), 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.llmgateway.io/v1`
- Ensure your LLM Gateway account has sufficient credits

### Model Not Found

If you see "model not found" errors:

- Verify the model ID exists in the [models page](https://llmgateway.io/models)
- Check that you're using the correct model name format
- Some models may require specific provider configurations in your LLM Gateway dashboard

### Slow Responses

If responses are slow:

- Check your internet connection
- Monitor your usage in the LLM Gateway dashboard
- Switch to a faster chat model from the [models page](https://llmgateway.io/models)

### Autocomplete / inline edit still uses Cursor's models

This is expected. Cursor routes the AI panel — plan mode and agent mode — through the custom API key, but tab autocomplete and inline edit are locked to Cursor's own backend. See [What Works (and What Doesn't)](#what-works-and-what-doesnt) above.

<Callout type="info">
	Need help? Join our [Discord community](https://llmgateway.io/discord) for
	support and troubleshooting assistance.
</Callout>

## Benefits of Using LLM Gateway 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
