---
title: "Cursor"
description: "Cursor calls pirouter through the OpenAI API Key with Override OpenAI Base URL set to https://api.pirouter.ai/v1, plus full model IDs added by hand; only chat features go through pirouter, and Agent mode works best with Claude or Gemini."
canonical: "https://pirouter.ai/docs/integrations/cursor"
last-updated: "2026-10-18"
lang: "en"
source: "content/docs/en/integrations/cursor.mdx"
---

# Cursor

Cursor calls pirouter through the OpenAI API Key with Override OpenAI Base URL set to https://api.pirouter.ai/v1, plus full model IDs added by hand; only chat features go through pirouter, and Agent mode works best with Claude or Gemini.

In [Cursor](https://cursor.com), turn on the OpenAI API Key under **Settings → Models** with a pirouter key, set Override OpenAI Base URL to `https://api.pirouter.ai/v1`, and add pirouter model IDs by hand. Chat then runs on pirouter's models.

> **Warning:** This page is written from Cursor's official documentation and answers on its official forum. It has not been verified with a real Cursor account yet.

## Prerequisites

- A pirouter API key. If you do not have one, create it with the [quickstart](https://pirouter.ai/docs/quickstart.md).
- A paid Cursor plan that allows your own API keys: Premium, Super or Ultra for individuals (or legacy Pro and above), or Teams and Enterprise. Free and Plus do not allow your own keys.

* Two things to know:
  - Only chat models use your own key. Tab completion always runs on Cursor's own models.
  - Requests go to Cursor's servers first, where the prompt is built, and are sent to pirouter from there, not straight from your machine.

## Configure

OpenAI is the only provider in Cursor whose base URL you can change, so requests through pirouter use the OpenAI protocol and go to `POST /v1/chat/completions`.

1. Open **Cursor Settings → Models**.
2. Turn on **OpenAI API Key** and paste your pirouter key.
3. Turn on **Override OpenAI Base URL** and enter `https://api.pirouter.ai/v1` (keep `/v1`, and do not add `/chat/completions`).
4. In the model list, click **Add Custom Model** and enter a full model ID, such as `anthropic/claude-sonnet-5.5` or `openai/gpt-6.1-sol`. For the models available, see the OpenAI column of the protocol table in [Models & protocols](https://pirouter.ai/docs/models.md#which-protocols-each-model-accepts).

![Illustration: Cursor's Models settings with OpenAI API Key on and a masked key, Override OpenAI Base URL set to https://api.pirouter.ai/v1, and two added models, anthropic/claude-sonnet-5.5 and openai/gpt-6.1-sol](/docs/shots/cursor-settings.en.svg)

Write model IDs in full, with the vendor prefix. Cursor treats a bare name starting with `claude-` as an Anthropic model and sends it with the Anthropic key instead.

### Use Claude or Gemini in Agent mode

In Agent mode, Cursor builds requests for GPT models in the Responses format but sends them to the Chat Completions endpoint. Cursor's official forum confirms this as a known issue. pirouter does not convert between formats, so these requests fail (the forum reports a `400`). In Agent mode, pick a Claude or Gemini model ID, and use GPT models in Ask mode.

## Verify

Start a new chat, switch to Ask mode, pick `anthropic/claude-sonnet-5.5` and send `Reply with exactly: pong`.

You should see the reply `pong`.

The request shows up in the console [Logs](https://pirouter.ai/docs/guides/logs.md), with `/v1/chat/completions` in the **Endpoint** column.

## Troubleshooting

### GPT models return 400 in Agent mode

An error like `Missing required parameter: 'messages'` is the Responses format issue described above. Switch to a Claude or Gemini model ID, or use Ask mode.

### Cursor's own models fail

While Override OpenAI Base URL is on, Cursor's own models fail with `This model does not support custom API keys`. The setting applies to every model that is not Claude or Gemini. To use Cursor's own models, turn off OpenAI API Key first.

### Cannot connect

If Cursor says it cannot reach the model provider, first check that the base URL is `https://api.pirouter.ai/v1`. If that does not help, set HTTP Compatibility Mode to HTTP/1.1 under **Settings → Network**.

## Not verified yet

None of the steps on this page have been verified with a real account yet, in particular:

- Whether a model ID with a slash, such as `anthropic/claude-sonnet-5.5`, can be added and is sent unchanged.
- Whether tool calls complete in Agent mode with Claude or Gemini.
- Which endpoint the key verification button in settings calls.

## Related links

- [Use your own API keys in Cursor](https://cursor.com/help/models-and-usage/api-keys): official help article
- [Cursor models and pricing](https://cursor.com/docs/models-and-pricing): which plans allow your own keys
