Integration Guide: Connecting Cursor to RouterHub

This guide explains how to configure Cursor to use the RouterHub API gateway as its backend. Cursor is an AI-powered code editor built on VS Code, featuring an agent mode for autonomous coding, tab completions, inline edits, and more.

By routing Cursor through RouterHub, you get access to hundreds of models through a single API key, automatic provider failover, and centralized usage tracking.

Beta: The Cursor integration relies on Cursor's Override OpenAI Base URL feature. Behavior may change as Cursor updates their client.

Quick Start

Cursor supports RouterHub through its Override OpenAI Base URL feature. This routes requests from Cursor's OpenAI provider override through RouterHub's OpenAI-compatible endpoint.

Step 1: Get Your RouterHub API Key

  1. Sign up or log in at RouterHub
  2. Navigate to your API Keys page in the dashboard
  3. Create a new API key
  4. Copy your key (starts with sk-)

Step 2: Configure Cursor

  1. Open Cursor Settings (gear icon or Cmd/Ctrl + ,)
  2. Navigate to Models, then expand the API Keys section
  3. Toggle on OpenAI API Key, then:
    • Paste your RouterHub API key into the OpenAI API Key field
    • Toggle on Override OpenAI Base URL and set it to:
https://api.routerhub.ai/v1/cursor

Important: The base URL must be https://api.routerhub.ai/v1/cursor. This dedicated endpoint normalizes Cursor's request format (including Responses API payloads) into the standard OpenAI Chat Completions format before routing.

Step 3: Add Models

After connecting, add the models you want to use. In the Models section, click + Add model and enter a RouterHub model ID:

anthropic/claude-opus-4.8
anthropic/claude-opus-4.7
anthropic/claude-opus-4.6
google/gemini-3.5-flash
openai/gpt-5.5

Tip: You can find all available model IDs in your RouterHub dashboard under the Models section, or refer to the Models page.

Step 4: Select a Model

Open the model picker in the chat or agent panel and select one of the models you added. Your requests will now route through RouterHub.

How It Works

RouterHub exposes a dedicated Cursor endpoint at /v1/cursor/chat/completions that normalizes Cursor's request format into the standard OpenAI Chat Completions format before routing. When Cursor sends a Responses API payload (with an input field instead of messages), the endpoint transparently routes it through the Responses pipeline and converts the result back into Chat Completions format. When you configure Cursor to use RouterHub's base URL, all chat and agent requests are routed through RouterHub, which then forwards them to the appropriate upstream provider.

The endpoint handles each model family transparently:

Reasoning models are fully supported: reasoning summaries are preserved and streamed back in Chat Completions format so Cursor renders them inline. For thinking models that spend several seconds before emitting visible tokens, the endpoint sends SSE keep-alive heartbeats during provider silence so Cursor keeps the connection open instead of showing “reconnecting.”

Component Description
Base URL https://api.routerhub.ai/v1/cursor — the dedicated Cursor-compatible endpoint
API Key Your RouterHub API key, used for authentication and usage tracking
Model IDs Use RouterHub model identifiers (e.g. anthropic/claude-opus-4.6)

Why Use RouterHub with Cursor?

Access to Hundreds of Models

Cursor's built-in BYOK only supports a handful of providers. With RouterHub, you get access to hundreds of models across dozens of providers — all through the single OpenAI provider override.

Provider Failover

If one provider is unavailable or rate-limited, RouterHub automatically routes to another, keeping your coding sessions uninterrupted.

Organizational Controls

For teams, RouterHub provides centralized budget management. Set spending limits, allocate credits, and monitor usage across developers using Cursor from your RouterHub dashboard.

Usage Visibility

Track which models your team uses, monitor costs in real-time, and understand usage patterns from a single dashboard — regardless of the underlying provider.

Limitations

Troubleshooting

Issue Solution
Invalid API key Make sure you're using your RouterHub API key (starts with sk-), not a key from another provider.
Model not found Ensure the model ID exactly matches the format shown in your RouterHub dashboard (e.g. anthropic/claude-opus-4.6).
Base URL error The override URL must be https://api.routerhub.ai/v1/cursor. Do not add a trailing slash or extra path segments.
Tool call failures Verify that the model you've selected supports tool calling. Some models (e.g. certain DeepSeek variants) may have limited tool support.
Streaming issues Ensure your network / proxy allows Server-Sent Events (SSE). RouterHub streams responses by default.

Resources