Claude Code
Use NeuralGate as a drop-in backend for Claude Code. Route your coding queries through open-weight models on the NeuralGate network — faster, cheaper, and private.
Quick setup
Set these environment variables before launching Claude Code:
export ANTHROPIC_API_KEY="ngk_your_neuralgate_key"
export ANTHROPIC_BASE_URL="https://api.computeshare.servequake.com/v1"
Then start Claude Code normally:
claude
Persistent configuration
Add to your shell profile (~/.bashrc or ~/.zshrc) so it persists across sessions:
# NeuralGate for Claude Code
export ANTHROPIC_API_KEY="ngk_your_neuralgate_key"
export ANTHROPIC_BASE_URL="https://api.computeshare.servequake.com/v1"
source ~/.bashrc # or source ~/.zshrc
Claude Code config file
Alternatively, set it in Claude Code's config file at ~/.claude.json:
{
"apiKey": "ngk_your_neuralgate_key",
"apiBaseUrl": "https://api.computeshare.servequake.com/v1",
"model": "auto"
}
Choosing a model
For coding tasks, we recommend using a specific high-quality model rather than auto:
export ANTHROPIC_API_KEY="ngk_your_neuralgate_key"
export ANTHROPIC_BASE_URL="https://api.computeshare.servequake.com/v1"
# Then specify your model in Claude Code's config or via env:
export CLAUDE_MODEL="gemma-4-31B-it-Q8_0.gguf"
Check available models:
curl https://api.computeshare.servequake.com/v1/models \
-H "Authorization: Bearer ngk_your_key"
Using with privacy mode
If you're working on proprietary code and don't want any cloud fallback, enable privacy mode. This ensures your code never leaves the local hoster network:
{
"apiKey": "ngk_your_neuralgate_key",
"apiBaseUrl": "https://api.computeshare.servequake.com/v1",
"model": "auto",
"defaultHeaders": {
"X-Privacy-Mode": "true"
}
}
Verifying the connection
# Test that Claude Code can reach NeuralGate
curl https://api.computeshare.servequake.com/v1/chat/completions \
-H "Authorization: Bearer ngk_your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{"role": "user", "content": "Write a Python hello world"}],
"max_tokens": 100
}'
Cost comparison
| Provider | Model | Input | Output |
|---|---|---|---|
| Anthropic (direct) | Claude Sonnet | $3.00/1M | $15.00/1M |
| NeuralGate | Gemma 4 31B | $0.10/1M | $0.30/1M |
| NeuralGate | auto (local) | $0.00 | $0.00 |
For typical Claude Code usage (~100K tokens/day), NeuralGate can be 10–30x cheaper than Claude directly.
Troubleshooting
Claude Code shows "invalid API key"
Make sure your key starts with ngk_ and is set in ANTHROPIC_API_KEY. The variable name is intentional — Claude Code reads from that env var regardless of the actual provider.
Responses are slower than Claude
Open-weight models on community hosters may have higher latency than Anthropic's infrastructure. Use "tier": "fastest" in your config, or host your own GPU for the lowest latency.
Model doesn't follow complex instructions as well
Open-weight models have different strengths than Claude. Gemma 4 31B and Qwen 3.5 are excellent for coding but may behave differently on multi-step agentic tasks. For best results, use specific, clear instructions.
Getting 402 errors
Your credits are depleted. Check your balance at /portal and top up. Free accounts start with $5 in credits.