DEV Community

江流石
江流石

Posted on

Run Claude Code on free credits via a relay API (AgentRouter)

The official Claude API bills per token and wants a foreign card. A quicker way to try Claude Code for free: third-party relay stations that mirror the API and give you signup credit. Here's the AgentRouter setup.

Two environment variables:

export ANTHROPIC_BASE_URL="https://agentrouter.org"
export ANTHROPIC_AUTH_TOKEN="sk-****your-key****"
claude
Enter fullscreen mode Exit fullscreen mode

Notes:

  • Anthropic endpoint — base URL has no /v1 (Claude Code appends /v1/messages itself).
  • Use ANTHROPIC_AUTH_TOKEN (sent as Authorization: Bearer), not ANTHROPIC_API_KEY.
  • Can't fetch the model list? Copy the exact model string from the station and set ANTHROPIC_MODEL.
  • To make it stick, put it in ~/.claude/settings.json under env. Don't commit your key.

Several of these stations exist — all free, with signup + daily check-in credit, so you can just register the ones you want. Full list (models, credits, tested dates): AI relay station list

The signup links on that page carry my referral param; strip ?aff= if you'd rather not.

Top comments (0)