Setup guide · Anthropic Messages

How to use Claude Code with the BangunWeb API

Claude Code is a coding agent in your terminal. It speaks the Anthropic-style API, which BangunWeb serves at router.bangunweb.com. Set three environment variables and run claude as usual, no Claude subscription needed.

About 2 minutes Tested live against router.bangunweb.com on 25 November 2026.

The three values you need

Base URL (Anthropic)
https://router.bangunweb.com
API key
bwr_live_YOUR_KEY
Model
bw-focus

Sign in and create an API key to have the blocks below filled in automatically. Until then you will see the example bwr_live_YOUR_KEY.

Get an API key →

Step by step

  1. Fastest: the one-line installer

    Run the command below. It signs you in with one click in the browser, installs Claude Code if missing, and writes the BangunWeb settings to ~/.claude/settings.json. Then jump to step 5.

    macOS / Linux
    curl -fsSL https://bangunweb.com/install/claude | BANGUNWEB_MODEL=bw-focus sh
    Windows PowerShell
    irm https://bangunweb.com/install/claude.ps1 | iex
  2. Or install manually

    Install Claude Code from its official instructions, then get a bwr_live_ key from the Keys tab in the BangunWeb AI dashboard.

  3. Set environment variables

    The base URL for Claude Code has NO /v1. Use ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY) so Claude Code does not ask you to approve the key.

    macOS / Linux
    # macOS / Linux (bash, zsh)
    export ANTHROPIC_BASE_URL="https://router.bangunweb.com"
    export ANTHROPIC_AUTH_TOKEN="bwr_live_YOUR_KEY"
    export ANTHROPIC_MODEL="bw-focus"
    export ANTHROPIC_DEFAULT_HAIKU_MODEL="bw-swift"
    claude
    Windows PowerShell
    # Windows PowerShell
    $env:ANTHROPIC_BASE_URL="https://router.bangunweb.com"
    $env:ANTHROPIC_AUTH_TOKEN="bwr_live_YOUR_KEY"
    $env:ANTHROPIC_MODEL="bw-focus"
    $env:ANTHROPIC_DEFAULT_HAIKU_MODEL="bw-swift"
    claude
    ~/.claude/settings.json
    // ~/.claude/settings.json (permanen / permanent)
    {
      "env": {
        "ANTHROPIC_BASE_URL": "https://router.bangunweb.com",
        "ANTHROPIC_AUTH_TOKEN": "bwr_live_YOUR_KEY",
        "ANTHROPIC_MODEL": "bw-focus",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "bw-swift"
      }
    }
  4. Make it permanent (optional)

    To avoid retyping, put the same variables in the "env" section of ~/.claude/settings.json.

  5. Run it

    Open your project folder and run claude. Type /status to confirm the base URL points to router.bangunweb.com.

ANTHROPIC_MODEL is the main model; ANTHROPIC_DEFAULT_HAIKU_MODEL is what Claude Code uses for small background tasks. Real Claude models (bw-apex, claude-sonnet-5.5) also work, but cost far more per request; see the model table.

Test your key first (30 seconds)

If this command replies with text, your key and model are correct. Any remaining problem is in the tool settings.

curl · Anthropic Messages
curl https://router.bangunweb.com/v1/messages \
  -H "x-api-key: bwr_live_YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"bw-focus","max_tokens":1024,"messages":[{"role":"user","content":"Halo"}]}'

Recommended models for coding

Pulled from the live catalog: only models that are currently active. Mode names (bw-...) never change and automatically fail over to a backup model when the main one has trouble.

ModelBest for Estimated cost per stepSuccess, 7 days
Focus (DeepSeek V4 Pro)mode bw-focus Everyday coding agent. The main pick.reads images $0.0028 99.9%
DeepSeek V4 Pro deepseek-v4-pro The model behind Focus, if you want a fixed model.reads images $0.0028 99.9%
Swift (DeepSeek V4.1 Flash)mode bw-swift Light tasks, summaries, titles, the small model.reads images $0.00078 100%
GPT 6 Sol gpt-6-sol Complex logic and code review.reads images $0.0013 100%
Apex (Claude Opus 5.5)mode bw-apex The hardest tasks. Much higher cost per request.reads images $0.080 99.3%
Claude Sonnet 5.5 claude-sonnet-5.5 Claude directly. Use sparingly.reads images $0.052 100%

One step = one typical coding-agent request (about 20 thousand tokens in and 1 thousand out) at the Saver package rate. A coding agent can send dozens of steps for a single task.

Troubleshooting

Claude Code asks you to log in to claude.ai

The variables were not picked up. Make sure ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are set in the same terminal, or put them in settings.json, then run claude again.

"Auth conflict" warning

You are still logged in to a Claude account or also set ANTHROPIC_API_KEY. Run /logout in Claude Code and remove ANTHROPIC_API_KEY, keeping only ANTHROPIC_AUTH_TOKEN.

404 on /v1/v1/messages

The base URL was written with /v1. For Claude Code use just https://router.bangunweb.com.

401 or "Unknown API key"

The key was copied wrong or has been revoked. Copy it again from the Keys tab in the AI dashboard (it starts with bwr_live_), with no leading or trailing spaces.

402 or "Not enough token balance"

Your token balance is empty or too low for one request on that model. Top up tokens, or switch to a cheaper model such as bw-swift.

"Model not available"

The model name must exactly match the list at GET https://router.bangunweb.com/v1/models (lowercase, with dots and hyphens). Do not add prefixes such as openai/.

404 Not Found

For OpenAI-style tools the base URL must end with /v1. For Anthropic-style tools (Claude Code) the base URL has NO /v1.

Empty or cut-off answers

Reasoning models spend part of the tokens on thinking. Raise max tokens (at least 1024) or remove the limit in the tool settings.

Feels slow

Coding agents send large contexts. Use bw-swift for light tasks, and start a new task when the conversation gets very long.

Guides for other tools

Start using AI Router in your tools

One key for DeepSeek, GPT, Claude and dozens of other models. Pay per token, no subscription. Sign up free, get 2M test tokens.