Claude Code 404 on third-party gateways: host root vs /v1
Disclosure: I am affiliated with DaoXE. DaoXE is a multi-model multi-protocol API gateway (OpenAI Chat Completions / Responses, Anthropic Messages / Claude protocol). Not available in mainland China. This is a debugging guide for allowed regions — not advice to bypass provider or government rules.
If you use Claude Code against a third-party gateway and get 404 on the first request, check the base URL before blaming the model.
The failure mode
Claude Code talks Anthropic Messages and appends its own path (roughly /v1/messages).
| Setting | Result |
|---|---|
ANTHROPIC_BASE_URL=https://daoxe.com/v1 |
Client may call https://daoxe.com/v1/v1/messages → 404 |
ANTHROPIC_BASE_URL=https://daoxe.com |
Client calls https://daoxe.com/v1/messages → correct |
This is the most common “gateway is broken” false alarm.
Correct env (DaoXE example)
export ANTHROPIC_BASE_URL="https://daoxe.com" # host root — NO /v1
export ANTHROPIC_AUTH_TOKEN="your_daoxe_api_key"
# optional: exact model id from your account catalog
# export ANTHROPIC_MODEL="YOUR_EXACT_MODEL_ID"
Then:
claude
Prove the path with curl first
Use an exact model ID from your account (GET /v1/models with your key). Keep max_tokens tiny.
export DAOXE_API_KEY="your_key"
export DAOXE_MODEL="exact_id_from_account"
curl --fail-with-body -sS \
-H "x-api-key: $DAOXE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d "{\"model\":\"$DAOXE_MODEL\",\"max_tokens\":8,\"messages\":[{\"role\":\"user\",\"content\":\"Reply with OK\"}]}" \
https://daoxe.com/v1/messages
If curl works and Claude Code 404s, it is almost always base URL shape, not balance.
How this differs from Cline / Continue
| Client | Protocol | Base |
|---|---|---|
| Cline / Continue / OpenAI SDK | Chat Completions | https://daoxe.com/v1 |
| Claude Code | Anthropic Messages | https://daoxe.com (host root) |
One gateway, two base URL shapes. That is multi-protocol — not a bug.
VN context (billing vs path)
In Vietnam, card/checkout failures are common. Debug in order:
- Key works:
GET https://daoxe.com/v1/models - Messages smoke (curl above)
- Claude Code env (host root)
- Only then chase model quality / latency
Don’t debug the IDE while access or path is wrong.
Full client matrix
- CLIENT_SETUP.md
- CLAUDE_CODE.md
- Sister post (Cline/Continue setup): https://viblo.asia/p/wire-cline-continue-claude-code-to-one-multi-protocol-gateway-when-card-checkout-fails-PoL7emEk4vk
Vietnamese summary
Claude Code hay bị 404 nếu ANTHROPIC_BASE_URL có sẵn /v1 (sẽ thành /v1/v1/messages). Đúng: để host root https://daoxe.com, token từ dashboard, model ID lấy từ tài khoản. Smoke bằng curl Messages (max_tokens=8) trước khi mở CLI. Bài do người liên quan DaoXE viết — không phải hướng dẫn vượt quy định.
All Rights Reserved