Home → Help
404 on /v1/v1/messagesClaude Code works but Codex returns 404, or the reverseUnexpected token '<' — HTML where JSON was expectedThe key is valid and the model exists, yet nothing connectsNo trace of the failed request in the provider's usage logTwo SDK lineages, two conventions, one gateway hostname. Neither client is wrong; they simply disagree about who owns the /v1 segment. Getting it backwards produces either /v1/v1/… or a path with no version at all.
The resulting 404 is unusually hard to debug because it often never reaches the API. A gateway that serves its website on the same domain answers unknown paths with the marketing page — HTTP 200, Content-Type: text/html. The client then tries to parse HTML as JSON and reports a syntax error pointing nowhere near the real cause.
It also means the failure leaves no trace on the provider side. Support will say they see no requests from your key, and they are telling the truth: the request was answered by a web server before it ever became an API call.
Ask for the content type rather than reading the body — one command settles it:
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' \
-X POST 'YOUR_BASE_URL/chat/completions' \
-H 'Authorization: Bearer YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{"model":"YOUR_MODEL","messages":[{"role":"user","content":"hi"}]}'
application/json means the URL is right — even a wrong key answers in JSON. text/html means you are talking to a website, and the base URL is the problem.
/v1. New tools slot into one of the two without needing their own instructions./ can produce a double slash that routes to the website instead of the API.| Client | Base URL should be |
|---|---|
| Claude Code | host only — no /v1 |
| Anthropic SDK | host only — it appends /v1/messages |
| Codex | ends with /v1 |
| OpenAI SDK (Python, Node, Go) | ends with /v1 |
| Cursor, Cline, Roo Code | ends with /v1 |
| Cherry Studio, Chatbox, LobeChat | ends with /v1 |
https://apiclan.us for Claude Code and the Anthropic SDK, https://apiclan.us/v1 for Codex and everything OpenAI-compatible. Copy-paste configs for each client are in the quickstart.Last checked 2026-10-01. Written from problems diagnosed on a live OpenAI-compatible gateway, not collected from other sites.