Cursor API Proxy Integration Guide: Custom Base URL Configuration

  • 发布时间
  • 语言en

Configure a custom API Key and Base URL in Cursor's Settings → Models to use Claude, GPT, or Gemini models with your site-issued key.

1. What is Cursor?

Cursor is an AI-native code editor built on VS Code, featuring deep integration of AI Chat, code generation (Composer/Chat), and intelligent code completion. It supports BYOK (Bring Your Own Key), allowing you to use your own API keys to connect to custom model endpoints. This is ideal for scenarios where you prefer not to purchase an official subscription or want to centralize model usage.

By connecting through an API proxy, you can use Claude, GPT, or Gemini models on a pay-per-token basis using your sk- key without needing a Cursor Pro subscription.

2. Preparation

  1. Log in to the Jizhi API console and generate a unique sk-xxxxxx key under "API Keys".
  2. Check the "Model Pricing" section to confirm the model slugs you wish to use (e.g., claude-sonnet-5, gpt-5.5, gemini-3.7-flash).
  3. Confirm the gateway address: https://www.relay-api.com.

3. Configuring Cursor

Open Cursor → Settings → Models → API Keys (or search for Models in the settings):

  1. Select the model provider (OpenAI for OpenAI, Anthropic for Claude, Google Gemini for Gemini).
  2. Enter your API Key: sk-your-key.
  3. Enter the Override Base URL: Use the corresponding gateway entry for the selected provider:
    • Claude / Anthropic: https://www.relay-api.com
    • GPT / OpenAI: https://www.relay-api.com/v1
    • Gemini: https://www.relay-api.com/v1beta
  4. Add the precise model ID in the Models list (copy the slug from the model library; do not use the display name).
  5. Click Verify to test the connection, then perform a quick test by sending a message in standard Chat to confirm everything is working correctly.

4. Verification and Troubleshooting

IssueResolution
401 / 403Key is invalid, disabled, or has insufficient balance; verify the sk- key and check your account balance.
404 / Model UnavailableThe model slug does not match the platform or is not enabled; check the model ID.
Verify succeeds but Agent failsProtocol differences in /chat/completions may exist; use standard Chat to verify basic connectivity first.
Tab completion not workingDedicated features like Tab Completion rely on Cursor's built-in models. This is a product limitation and not a Base URL configuration issue.

Security Recommendation: Do not commit keys to public repositories. It is recommended to create a separate key for each project and monitor your balance and usage details.

Base URL Note: Our site accepts both /v1beta/models/... and /v1beta/v1beta/models/... (as well as /v1/... and /v1/v1/...), so whether the client automatically appends /v1 or /v1beta does not affect the call. You can use either the root domain or the address with /v1beta in the Base URL field. Please copy the model ID from the "Model ID" list in the top right corner of the console's "Tokens" page.