Skip to main content

VS Code

Call TokenRoute from VS Code through the Cline, Codex or Claude Code extensions.

Download: code.visualstudio.com

Before you start

You need an API Key with available quota. Copy model names from the model list — they are case-sensitive.

Which extension​

Press Ctrl+Shift+X (Cmd+Shift+X on macOS) to open the Extensions panel:

ExtensionBest for
ClineEntering Base URL and model name by hand — most flexible, consistent across platforms
CodexUse the shared Codex configuration, then verify a call in the extension
Claude CodeUsing Claude models inside the IDE

All three share one API Key — no need to request separate ones.

Configuring Cline​

Once installed, open the extension panel and click settings in the top-right:

FieldWhat to enter
API ProviderOpenAI Compatible
Base URLhttps://api.smartwan.com/v1
OpenAI Compatible API KeyYour API Key
Model IDType the model name

Commonly used models:

deepseek-v4-pro
claude-sonnet-5
gpt-5.5
kimi-k2.6
grok-4.6

Click Done to save.

Configuring the Codex extension​

Codex CLI and the IDE extension share configuration layers. Follow Codex CLI to configure model_provider, model and model_providers.tokenroute in user-level ~/.codex/config.toml, then set the TOKENROUTE_API_KEY variable referenced by env_key.

Open the extension's gear menu and select Codex Settings → Open config.toml. Do not replace the complete provider configuration with unrelated OPENAI_* variables. After setting environment variables, fully exit VS Code and launch it from that terminal so the new process inherits them.

Shared configuration is documented in the official configuration guide. TokenRoute's minimal live test was performed in the CLI; still send a test message in the IDE as described below.

Configuring the Claude Code extension​

Start from Claude Code. These are Bash environment variables; confirm the IDE has loaded them with an actual call:

export ANTHROPIC_AUTH_TOKEN="sk-your-token"
export ANTHROPIC_BASE_URL=https://api.smartwan.com
Don't mix up the two URLs

Cline speaks the OpenAI-compatible protocol — Base URL includes /v1. Claude Code speaks the Anthropic protocol — Base URL excludes /v1. Swapping them yields a 404.

Setting environment variables​

OSCurrent terminalPersistent
WindowsPowerShell: $env:NAME="value"System environment variables, or just use the extension's settings
macOSexport NAME="value"Add to ~/.zshrc
Linuxexport NAME="value"Add to ~/.bashrc or ~/.zshrc

Restart VS Code after changing environment variables so it picks them up.

Verify​

Send a message in the extension's chat box. A normal response means you're connected.

Troubleshooting​

SymptomWhat to do
Cline returns 404Base URL needs /v1; the Claude Code extension does not
Auth failureCheck the key is complete and starts with sk-; restart VS Code after changing env vars
Model not foundModel ID must match the model list exactly — case-sensitive
Extension can't see env varsLaunch with code . from a terminal so VS Code inherits the shell environment

For more, see the FAQ.