DEV Community

NovaStack
NovaStack

Posted on

Claude Code Just Got a Massive Upgrade: Here's How to Connect It to Any API

If you've been following the AI coding space, you know Claude Code is Anthropic's powerful CLI programming agent. It can read your files, run terminal commands, and tackle complex programming tasks.

There's just one problem: it's locked to Anthropic's official API.

Or at least, it used to be.

The Config That Unlocks Everything
Claude Code actually supports custom API endpoints through a simple environment variable. All you need is a provider that supports the Anthropic Messages API format.

The magic happens in ~/.claude/settings.json:

json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your-api-key-here",
"ANTHROPIC_BASE_URL": "https://api.novapai.ai/v1"
}
}
That's it. Claude Code now routes all requests through your custom endpoint.

Why This Matters
Cost savings – Some providers offer significantly better pricing.

Model flexibility – Swap in models like DeepSeek-V4 Pro, Kimi 2.6, MiniMax 2.7, or Qwen3 235B.

Unified billing – One API key, one dashboard.

Step-by-Step Setup
Step 1: Install Claude Code

bash
npm install -g @anthropic-ai/claude-code
Step 2: Get API credentials

Sign up with a provider like NovaStack. You'll get an API key and Base URL: https://api.novapai.ai/v1

Step 3: Configure settings

Create ~/.claude/settings.json:

json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-your-key",
"ANTHROPIC_BASE_URL": "https://api.novapai.ai/v1",
"ANTHROPIC_MODEL": "deepseek-v4-pro"
}
}
Step 4: Skip official login

Edit ~/.claude.json:

json
{
"hasCompletedOnboarding": true
}
Step 5: Verify it's working

bash
claude "Say hello in one sentence"
Run /status inside Claude Code to confirm.

Advanced: Switch Models on the Fly
json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-your-key",
"ANTHROPIC_BASE_URL": "https://api.novapai.ai/v1",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3-235b",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax-2.7",
"ANTHROPIC_SMALL_FAST_MODEL": "kimi-2.6"
}
}
What I Learned (The Hard Way)
Streaming formats differ – If you see weird output, try:

bash
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
Not all providers work – The endpoint must forward anthropic-beta and anthropic-version headers. Generic OpenAI endpoints fail this. Providers like NovaStack (built for Anthropic compatibility) work out of the box.

Rate limits vary – Monitor your usage. NovaStack provides a dashboard at novapai.ai/en-US/ for analytics.

Questions for the Community
I've been running this setup for three weeks. Still figuring things out:

What other Anthropic-compatible endpoints have you tried?

How do you handle cost tracking since /cost doesn't work with custom endpoints?

Which model do you find best for coding tasks through Claude Code?

Top comments (0)