Why Claude Code Returns HTML Instead of JSON From the RelayRouter API

A common error that looks like a JSON parsing failure can actually stem from a login redirect, an outdated hostname, a missing API path, or a proxy returning its own HTML error page. The guide advises checking the HTTP status code, Content-Type header, and final URL to identify the real cause. It recommends sending a small direct request with a model ID from the current dashboard, and keeping API keys in environment variables rather than shared logs. It also points out that OpenAI-compatible clients use the /v1/chat/completions route, while Claude Code needs an Anthropic Messages-compatible gateway at /v1/messages, so a simple path change is not enough. The author stresses confirming protocol support before configuring higher-level tools.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in