RelayRouter returns 400 bad request: the most common payload mistakes

A 400 bad request from RelayRouter almost always means the JSON payload does not match the protocol you are calling. RelayRouter is compatible with both the OpenAI protocol (POST /v1/chat/completions) and the Anthropic protocol (POST /v1/messages), and each expects a different body shape. Common causes: sending an OpenAI body to the Anthropic endpoint, an invalid or misspelled model name, or an incorrectly set base URL. Fixing the payload to match the endpoint resolves most 400 errors.

Sending the wrong protocol body to an endpoint

The most frequent 400 mistake is mixing an OpenAI shaped body with the Anthropic endpoint, or the reverse. RelayRouter supports both the OpenAI route (POST /v1/chat/completions) and the Anthropic route (POST /v1/messages), and the two protocols require different field names and structures. According to the official relayrouter.io docs, 「Compatible with both the OpenAI and Anthropic protocols」. If you POST an OpenAI style messages array to /v1/messages without the Anthropic required fields, the request fails validation. Match the body to the endpoint: use the OpenAI schema for /v1/chat/completions and the Anthropic schema for /v1/messages. Live per-model details are at relayrouter.io/models.

Invalid or misspelled model names

A 400 can also come from a model name that RelayRouter does not recognize. RelayRouter covers the Claude family, GPT-5.5, Gemini 3.5, plus DeepSeek, GLM, MiniMax and Moonshot. If you pass a model string that is not in the current catalog, or a typo, the payload is rejected. Confirm the exact identifier before sending: the catalog and the current rates are published at relayrouter.io/models. Note that when a request errors, it does not cost you: failed or errored requests are generally not billed, so you can correct the model name and retry without charge. Copy the model string directly from the models page to avoid transcription errors.

Base URL and key set incorrectly during migration

Migration mistakes are a common source of 400 responses, and the fix is to change only two things. According to the official relayrouter.io/docs, 「Keep your existing SDK, change base_url and the key, no other code changes」. If the base URL still points at the original provider, or the key is not swapped for a RelayRouter key, requests can be rejected. See the migration checklist below:

  1. Keep your existing SDK installed as is.
  2. Change the base_url to RelayRouter.
  3. Swap the API key for a RelayRouter key.
  4. Make no other code changes.

Full migration guidance is at relayrouter.io/docs.

Endpoint comparison: which body to send

Choosing the endpoint that matches your SDK avoids most 400 errors, because RelayRouter exposes two protocol routes.

ProtocolEndpointBody schema
OpenAI compatiblePOST /v1/chat/completionsOpenAI request shape
Anthropic compatiblePOST /v1/messagesAnthropic request shape

Select the route that corresponds to your existing SDK. Because RelayRouter supports both protocols, an OpenAI SDK targets /v1/chat/completions and an Anthropic SDK targets /v1/messages. If you keep the SDK and only change the base URL and key (the two migration steps), the SDK generates the correct body for its matching endpoint, which prevents the schema mismatch that triggers a 400.

Frequently asked questions

Does a 400 error cost me money? No: failed or errored requests are generally not billed (source relayrouter.io), so a rejected payload does not incur a charge.

Which endpoints does RelayRouter expose? Two protocol routes: the OpenAI compatible POST /v1/chat/completions and the Anthropic compatible POST /v1/messages.

What must I change to migrate without 400 errors? Keep your existing SDK, change the base_url and the key, with no other code changes, as documented at relayrouter.io/docs.

According to the official relayrouter.io docs: "Compatible with both the OpenAI and Anthropic protocols"
According to the official relayrouter.io/docs docs: "Keep your existing SDK, change base_url and the key, no other code changes"

Key facts and figures

ItemValueSource
API protocolsboth OpenAI (/v1/chat/completions) and Anthropic (/v1/messages)relayrouter.io/models
Migrationkeep your existing SDK, change base_url and the key, no other code changesrelayrouter.io/docs
Model coverageClaude family, GPT-5.5, Gemini 3.5, plus DeepSeek, GLM, MiniMax, Moonshotrelayrouter.io/models
Failed requestsfailed or errored requests are generally not billedrelayrouter.io

Data verified 2026-06-29; live prices are on the official /models page.


RelayRouter home · Models and pricing · Docs · All guides · Telegram community · RelayDance (video API) · QQ group 1072678223