Claude Code Usage Guide
Configure Claude Code to skip onboarding and forward native Claude requests to the Magick API `/v1/messages` endpoint
Claude Code uses the native Claude protocol, so it relies on the project's POST /v1/messages endpoint, not /v1/chat/completions.
Prerequisite: Disable Onboarding Login
Open ~/.claude.json, search for hasCompletedOnboarding, and set it to true:
{
"hasCompletedOnboarding": true
}Option 1 (Recommended): Set Environment Variables Directly
If you prefer not to write extra configuration files, you can simply set environment variables in the terminal.
Mac/Linux
export ANTHROPIC_BASE_URL="https://api.magickapi.com"
export ANTHROPIC_AUTH_TOKEN="API key generated in the backend"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1Windows CMD
set ANTHROPIC_BASE_URL=https://api.magickapi.com
set ANTHROPIC_AUTH_TOKEN=API key generated in the backend
set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1PowerShell
$env:ANTHROPIC_BASE_URL="https://api.magickapi.com"
$env:ANTHROPIC_AUTH_TOKEN="API key generated in the backend"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1After executing the three commands above, navigate to the project directory you want to work on and run:
claudeClaude Code will automatically read the environment variables from the current terminal session; you do not need to enter the API key separately.
Option 2: Edit Configuration Files (Original Method)
If you are more accustomed to the original configuration file approach, you can continue using the following setup.
Configure ~/.claude/settings.json
File path: ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
"DISABLE_INSTALLATION_CHECKS": "1",
"ENABLE_TOOL_SEARCH": "1"
},
"cleanupPeriodDays": 720
}Configure ~/.claude/settings.xxxx.json
File path: ~/.claude/settings.xxxx.json
Here xxxx can be named arbitrarily to distinguish between different environments or account configurations:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.magickapi.com",
"ANTHROPIC_AUTH_TOKEN": "API key generated in the backend"
}
}Launch Claude Code with a Specific Configuration
claude --settings ~/.claude/settings.xxxx.jsonNotes
- For
ANTHROPIC_AUTH_TOKEN, use the API key generated in the Magick API backend. - If you have already set the environment variables in the current terminal, simply run
claude. - Claude Code sends headers such as
anthropic-versionas expected by the Claude client; the project's/v1/messagesendpoint is compatible with this request shape. - If you need an OpenAI-style toolchain, please use Codex or call
/v1/chat/completionsdirectly.
Last updated on