Use with Claude Code

How to use Nexus API with Claude Code - Claude API integration tutorial. Configure ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN to connect Claude Code to Nexus API gateway.

Install Claude Code

Using pnpm:

pnpm install -g @anthropic-ai/claude-code

Using npm:

npm install -g @anthropic-ai/claude-code

Using yarn:

yarn global add @anthropic-ai/claude-code

Configure Environment Variables

Set environment variables in your terminal to use Nexus API:

Linux / macOS

# Set API base URL
export ANTHROPIC_BASE_URL=https://nexusapi.one/

# Set your API key (get it from https://nexusapi.one/console/token)
export ANTHROPIC_AUTH_TOKEN=sk-xxx

# Optional: set model
export ANTHROPIC_MODEL=claude-sonnet-4-5-20250929-thinking

Windows PowerShell

# Set API base URL
$env:ANTHROPIC_BASE_URL="https://nexusapi.one/"

# Set your API key (get it from https://nexusapi.one/console/token)
$env:ANTHROPIC_AUTH_TOKEN="sk-xxx"

# Optional: set model
$env:ANTHROPIC_MODEL="claude-sonnet-4-5-20250929-thinking"

Important: Replace sk-xxx with your actual API key. You can get it from the Console.

Start Using

After configuring environment variables, navigate to your project directory and run:

# Enter your project directory
cd my-project

# Start Claude Code
claude

Persistent Configuration

Add the environment variables to your shell config file to avoid setting them every time:

Linux / macOS

Add to ~/.bashrc or ~/.zshrc:

export ANTHROPIC_BASE_URL=https://nexusapi.one
export ANTHROPIC_AUTH_TOKEN=sk-xxx
export ANTHROPIC_MODEL=claude-sonnet-4-5-20250929-thinking

Windows PowerShell

Add to your PowerShell profile ($PROFILE):

$env:ANTHROPIC_BASE_URL="https://nexusapi.one/"
$env:ANTHROPIC_AUTH_TOKEN="sk-xxx"
$env:ANTHROPIC_MODEL="claude-sonnet-4-5-20250929-thinking"

VS Code Extension Configuration

If you use the Claude Code VS Code extension, add the following to your settings.json (press Ctrl+Shift+P / Cmd+Shift+P → "Preferences: Open User Settings (JSON)"):

{
  // ========== Claude Code Extension ==========
  "claudeCode.selectedModel": "claude-sonnet-4-5-20250929",
  "claudeCode.environmentVariables": [
    {
      "name": "ANTHROPIC_AUTH_TOKEN",
      "value": "sk-xxx"  // Replace with your API key from https://nexusapi.one/console/token
    },
    {
      "name": "ANTHROPIC_BASE_URL",
      "value": "https://nexusapi.one"
    },
    {
      "name": "API_TIMEOUT_MS",
      "value": "300000"
    }
  ],
  "claudeCode.preferredLocation": "sidebar"
}

Tips:

  • Replace sk-xxx with your actual API key from the Console
  • You can change selectedModel to any supported Claude model, e.g. claude-opus-4-5-20250929
  • API_TIMEOUT_MS sets the request timeout (default 300 seconds), increase it for long-running tasks
  • This also works with Cursor, Windsurf, and other VS Code-based editors