Skip to content

VS Code / Cursor / Trae Configuration Guide ​

Last updated: October 17, 2026 (Asia/Shanghai)

Related: Help Center · Claude Code · Codex · LLM API

Supported IDEs (all based on the VS Code ecosystem; extensions are largely compatible):

IDEDescription
VS CodeMicrosoft's official editor
CursorAI-enhanced editor
TraeByteDance's AI editor

Common extension options: the Claude Code extension, the Codex extension, and OpenAI-compatible agents such as Cline / Roo Code.


1. Prepare a token ​

Create a dedicated token in the console (e.g. vscode) and copy sk-xxxxxxxx. We recommend setting a quota cap.


2. Cursor built-in model settings ​

  1. Open Settings → Models (or Cursor Settings).
  2. Enter sk-xxxxxxxx in OpenAI API Key.
  3. Enable Override OpenAI Base URL and enter: https://ai.afp.net/v1 (with /v1).
  4. Add model and manually add the platform model ID, for example:
    • claude-sonnet-4-6
    • gemini-3.1-pro
    • kimi-k3
    • deepseek-v4-flash
  5. Click Verify / Save.

INFO

Some Cursor requests are sent from Cursor's cloud, so https://ai.afp.net must be publicly reachable. Features such as Tab completion may still use Cursor's own models and will not use your custom key.


3. Claude Code for VS Code ​

  1. Install the CLI in a terminal (the extension usually relies on the same configuration):
bash
npm install -g @anthropic-ai/claude-code
  1. Search for Claude Code in the extension marketplace and install the extension published by Anthropic.
  2. Configure ~/.claude/settings.json (the same as for Claude Code CLI):
json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxx",
    "ANTHROPIC_BASE_URL": "https://ai.afp.net",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "alwaysThinkingEnabled": true
}

Note: the Base URL for the Claude path does not include /v1. After changing it, fully quit and restart the IDE.


4. Codex extension ​

  1. npm install -g @openai/codex
  2. Install the OpenAI Codex extension.
  3. Configure ~/.codex/config.toml (base_url with /v1) and auth.json as described in Codex CLI.
  4. Restart the IDE. For the model field, enter an ID that has been verified to work on the platform.

5. Cline / Roo Code (OpenAI Compatible) ​

  1. Install the Cline or Roo Code extension.
  2. Set API Provider to OpenAI Compatible.
  3. Fill in:
    • Base URL: https://ai.afp.net/v1
    • API Key: sk-xxxxxxxx
    • Model ID: e.g. gemini-3.1-pro or claude-sonnet-4-6
  4. Save and test in the sidebar chat.

If the extension supports a custom Anthropic Base URL, use the following instead:

  • Provider: Anthropic
  • Custom Base URL: https://ai.afp.net (no /v1)
  • Key: the same sk-

6. Other OpenAI-compatible extensions ​

For any plugin that asks for an OpenAI Base URL, you usually enter https://ai.afp.net/v1. If you get a 404, check "with / without /v1" against this page and LLM API.


7. Troubleshooting ​

SymptomFix
Claude can't connectCheck whether the Base URL has an extra /v1, and restart the IDE after fixing it
Roo / Cline 404Check whether the Base URL is missing /v1
Cursor Verify failsCheck the key, public reachability, and whether the model ID matches /v1/models
Configuration changes don't take effectFully quit the process and reopen it; do not just Reload Window
Insufficient quotaCheck the balance and token quota in the console

How should I choose a model? ​

TypeExamplesScenario
General-purpose codingclaude-sonnet-4-6Daily recommendation
Heavy reasoningclaude-opus-4-8, claude-opus-5Complex refactoring
Multimodalgemini-3.1-proReading images, wide context
Cost-effectiveclaude-haiku-4-5, gemini-3.5-flash, deepseek-v4-flashSmall changes, completion-style tasks

Back to: Help Center