Guides

Cursor setup

LLMs Text

Configure Cursor with the 4AICode API

Cursor is a VS Code–based AI IDE. You can point its OpenAI-compatible settings—or the Claude Code extension—at 4AICode to share team tokens, quotas, and usage metering.

Before you start

  1. Create a token in Token management (sk-4ai-...).
  2. Pick a relay host:
    • Mainland China: https://relay.4aicode.net
    • International: https://relay.4aicode.com

Option A: Cursor model settings (OpenAI-compatible)

Best when you use Cursor’s built-in Chat / Agent with GPT-style models.

  1. Open Cursor Settings → Models.
  2. Enable the OpenAI API key / custom base URL options (labels vary by Cursor version).
  3. Set:
    • API Key: sk-4ai-<your-token>
    • Base URL: https://relay.4aicode.com/v1 (use .net on mainland networks)
  4. Choose a supported model ID such as gpt-6-astra or gpt-5.6-sol. See the model catalog.
  5. Send ping in a new chat, then confirm the call under Usage.

Cursor Chat and the Claude Code extension are independent. Chat uses the OpenAI-compatible settings; Claude Code uses the Anthropic Messages protocol.

Option B: Claude Code extension

Follow the VS Code / Cursor / Windsurf guide and set:

{
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://relay.4aicode.com" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-4ai-xxxxxxxxxxxxxxxx" }
  ]
}

Fully quit and reopen Cursor so the variables reload.

Troubleshooting

  • Still prompted to log in: OpenAI-compatible URLs need /v1; ANTHROPIC_BASE_URL does not.
  • Unknown model: Copy the exact ID from the model catalog.
  • 401 / 429: See 401 and 429.