Claude Code Without Anthropic: ANTHROPIC_BASE_URL Proxy Setup & DeepSeek-V4 Pro Routing
Run Claude Code CLI against DeepSeek-V4 Pro and Qwen 3.8 Max without an Anthropic subscription or $50/mo API bills.
Commercial AI coding CLIs force developers into expensive proprietary API subscriptions with hard daily token caps. Unchained Code acts as a transparent, high-performance reverse proxy that intercepts standard Anthropic Messages API calls and dynamically maps them to open-weight frontier models like DeepSeek-V4 Pro, Qwen 3.8 Max, and Qwen3-Coder. You retain the exact same terminal ergonomics while reducing token spend by over 90%.
To use Claude Code without Anthropic: 1) Launch the Unchained gateway via 'npx unchained-code start --port 8787'. 2) Export 'export ANTHROPIC_BASE_URL=http://localhost:8787/v1' in your shell profile. 3) Run 'claude' normally in your terminal. All prompt streams, tool calls, and diff applications route to DeepSeek-V4 Pro or Qwen 3.8 Max with zero modification to your workflow.
Step-by-Step Walkthrough & User Guide
Install and Start the Local Unchained Gateway
Run 'npx unchained-code' or install globally with 'npm i -g unchained-code'. Start the gateway daemon on localhost port 8787.
Redirect the Anthropic Base URL in Shell Environment
Add 'export ANTHROPIC_BASE_URL=http://localhost:8787/v1' and 'export ANTHROPIC_API_KEY=unchained-local' to your ~/.zshrc or ~/.bashrc.
Launch Claude Code CLI in Any Repository
Execute 'claude' inside your project root. The CLI communicates transparently with Unchained Code's SSE proxy with full tool-calling support.
Inspect Real-Time Token Spend in Gateway Logs
Open http://localhost:8787/dashboard to monitor live token throughput, context cache hits, and margin savings per turn.
💡Pro Tips & Engineering Best Practices
- •Use DeepSeek-V4 Pro for deep reasoning and switch to Qwen 3.8 Max for high-speed multi-file architectural refactors.
- •Keep the local daemon running in tmux or systemd to avoid connection drops during long terminal sessions.
- •Verify proxy routing by running 'curl http://localhost:8787/v1/models' to see active upstream providers.
Code & Technical Integration
# ~/.zshrc configuration for Unchained Code Proxy
export ANTHROPIC_BASE_URL="http://localhost:8787/v1"
export ANTHROPIC_API_KEY="unchained-free-tier"
# Start Claude Code with zero Anthropic subscription fees
claude --verbose