Use PixMind with Claude Code
Connect Claude Code through PixMind's Anthropic Messages-compatible endpoint and configure authentication, model discovery, and defaults.
PixMind provides the Anthropic Messages-compatible APIs Claude Code needs, including message generation, token counting, and model discovery.
1. Base URL
Claude Code appends /v1/messages to the Base URL, so use:
https://aihub-admin.aimix.pro/api-platform/anthropicThis maps to:
- Messages:
POST /api-platform/anthropic/v1/messages - Token counting:
POST /api-platform/anthropic/v1/messages/count_tokens - Model discovery:
GET /api-platform/anthropic/v1/models
Do not set the Base URL to .../api-platform/anthropic/v1/messages, because Claude Code will append the path again.
2. Configure Claude Code
Create a key in PixMind API Platform, then replace YOUR_API_KEY below with the actual key.
Method 1: Current PowerShell session (Windows)
$env:ANTHROPIC_BASE_URL="https://aihub-admin.aimix.pro/api-platform/anthropic"
$env:ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
$env:ANTHROPIC_MODEL="claude-sonnet-5"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5"
$env:CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY="1"These variables apply only to the current PowerShell window.
Method 2: Current shell session (macOS and Linux)
export ANTHROPIC_BASE_URL="https://aihub-admin.aimix.pro/api-platform/anthropic"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export ANTHROPIC_MODEL="claude-sonnet-5"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5"
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY="1"These variables apply only to the current shell session.
Method 3: Manual configuration (macOS, Linux, and Windows)
Manual configuration persists for every Claude Code project owned by the current user. Edit or create the user-level settings.json file:
- macOS and Linux:
~/.claude/settings.json - Windows:
%USERPROFILE%\.claude\settings.json, for exampleC:\Users\your-name\.claude\settings.json - WSL: use the Linux path
~/.claude/settings.json, not the Windows user-profile file
Add or merge the env object and replace YOUR_API_KEY with the actual API key:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://aihub-admin.aimix.pro/api-platform/anthropic",
"ANTHROPIC_MODEL": "claude-sonnet-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
"API_TIMEOUT_MS": "3000000"
}
}If the file already contains other settings, do not overwrite them. Merge only the missing fields and verify the commas between adjacent properties. JSON does not allow comments or a trailing comma. CLAUDE_CODE_AUTO_COMPACT_WINDOW changes the auto-compaction calculation window; it does not increase the model's actual context length.
If a first launch still stops at the Anthropic login or onboarding flow, edit the separate user state file:
- macOS and Linux:
~/.claude.json - Windows:
%USERPROFILE%\.claude.json
Merge hasCompletedOnboarding at the top level of that file. Do not put it inside the env object in ~/.claude/settings.json:
{
"hasCompletedOnboarding": true
}If .claude.json already contains other fields, preserve them and only add or update hasCompletedOnboarding.
ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer. You can use ANTHROPIC_API_KEY instead, which Claude Code sends as x-api-key; PixMind accepts both headers.
3. Start and verify
Start Claude Code from the same terminal:
claude --model claude-sonnet-5Then:
- Run
/statusand verify the Anthropic Base URL points to PixMind. - Run
/modelto view models discovered from the gateway. - Ask Claude Code to list workspace files to verify tool calls.
Gateway model discovery requires Claude Code 2.1.129 or later. Older versions can still select a model through ANTHROPIC_MODEL or claude --model <model-id>.
Available Claude models
claude-fable-5claude-opus-5claude-sonnet-5claude-opus-4-8claude-opus-4-8-cc
Troubleshooting
401 Unauthorized: verifyANTHROPIC_AUTH_TOKENorANTHROPIC_API_KEYis set in the same terminal that launches Claude Code.404 Not Found: the Base URL must stop at/api-platform/anthropic; do not add/v1/messagesmanually.- PixMind models are missing from the picker: upgrade Claude Code and enable
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1, or use--modeldirectly. - Chat works but files cannot be changed: review workspace trust, tool permissions, and the Claude Code permission mode.