404 with an HTML page (no /v1 in the path)
Causes and fixes when you call Echo Token Station's API and get HTTP 404 with an HTML page instead of JSON. It happens when the path you call has no /v1.
If the path you call has no /v1, the request reaches the website instead of the API, and you get HTTP 404 with the website's HTML page. It happens even with a correct key.
Example
This is the beginning of the response (HTML; the rest is omitted).
HTML
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/>Common causes
- The base URL for the OpenAI format has no
/v1: for the OpenAI SDK and for the base URL of Codex CLI, Cline, Cursor, Dify and similar tools, usehttps://token.echohub.io/v1 - The base URL for
@ai-sdk/anthropichas no/v1: the Anthropic SDK and Claude Code do not take/v1, but@ai-sdk/anthropictakeshttps://token.echohub.io/v1 /v1was left out when you built the URL yourself: for examplehttps://token.echohub.io/chat/completions
How to fix
- Set the base URL for the SDK or tool you use as follows
| What you use | Base URL |
|---|---|
| The OpenAI format (OpenAI SDK, Codex CLI, Cline, Cursor, Dify and so on) | https:/ |
| The Anthropic SDK, Claude Code | https:/ |
@ai-sdk/ | https:/ |
- Check that the URL with
/v1returns JSON. If the last line shows200and above it is JSON with the list of models, the base URL is correct
bash
curl -sS -w '\n%{http_code}\n' "https://token.echohub.io/v1/models" \
-H "Authorization: Bearer $ECHO_API_KEY"If /v1 appears twice, you also get 404, but this time as JSON with Invalid URL (POST /v1/v1/…). Add /v1 to the base URL and check that your tool does not add another /v1.
Related
- API reference: the base URL for each SDK and tool
- Quickstart: your first call
- Errors and fixes: other 404 errors