BLACK FRIDAYUntil Dec 8 (Tue) 23:59 JSTUntil Dec 8

Docs404 with an HTML page

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

404The body is HTML, not JSON, and has no error type

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

  1. 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, use https://token.echohub.io/v1
  2. The base URL for @ai-sdk/anthropic has no /v1: the Anthropic SDK and Claude Code do not take /v1, but @ai-sdk/anthropic takes https://token.echohub.io/v1
  3. /v1 was left out when you built the URL yourself: for example https://token.echohub.io/chat/completions

How to fix

  1. Set the base URL for the SDK or tool you use as follows
What you useBase URL
The OpenAI format (OpenAI SDK, Codex CLI, Cline, Cursor, Dify and so on)https://token.echohub.io/v1
The Anthropic SDK, Claude Codehttps://token.echohub.io
@ai-sdk/anthropichttps://token.echohub.io/v1
  1. Check that the URL with /v1 returns JSON. If the last line shows 200 and 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.