RelayRouter returns 400 bad request: the most common payload mistakes

A 400 bad request from RelayRouter almost always signals a malformed payload: sending fields that do not match the protocol you called, using the wrong base URL for that protocol, or omitting the model identifier. RelayRouter speaks both the OpenAI protocol (POST /v1/chat/completions) and the Anthropic protocol (POST /v1/messages), so a request shaped for one endpoint but sent to the other will be rejected. Correct the base URL, key and payload shape, then retry.

Match the payload to the protocol and endpoint

The first cause of a 400 is a payload that does not match the endpoint you targeted. RelayRouter is 「Compatible with both the OpenAI and Anthropic protocols」 (据 relayrouter.io 官方文档), which means the OpenAI endpoint (POST /v1/chat/completions) expects an OpenAI style body, while the Anthropic endpoint (POST /v1/messages) expects an Anthropic style body. Mixing the two, for example posting a messages array formatted for Anthropic to the OpenAI path, produces a validation error. Confirm which of the two protocols your SDK uses, then send the request to the matching endpoint. See relayrouter.io/models for the supported protocols.

Include a valid model identifier

The second cause of a 400 is a missing or unrecognized model field. Every request must name a model that RelayRouter serves. The coverage includes the Claude family, GPT-5.5, Gemini 3.5, plus DeepSeek, GLM, MiniMax and Moonshot, so a total of at least 7 named model groups are available. A typo in the model string, or a model that is not on the current list, will be rejected before the request is processed. Verify the exact identifier against the live catalog at relayrouter.io/models and copy it verbatim into your payload. Because failed or errored requests are generally not billed, a rejected 400 request does not add to your usage.

Fix the base URL and key without other changes

The third cause of a 400 is pointing your SDK at the wrong base URL after migration. According to the official relayrouter.io/docs guidance, 「Keep your existing SDK, change base_url and the key, no other code changes」 (据 relayrouter.io/docs 官方文档). If the base URL still targets a different provider or the wrong RelayRouter protocol path, the request body and the endpoint will not agree, and a 400 follows. The fix is limited to two edits: set base_url to the correct RelayRouter path and supply your RelayRouter key. No other code changes are required. Review the migration steps at relayrouter.io/docs.

Comparison: common 400 triggers and fixes

The table below maps the three most common payload mistakes to their corrective actions.

MistakeSymptomFix
Payload does not match protocol400 on /v1/chat/completions or /v1/messagesSend an OpenAI body to the OpenAI endpoint, an Anthropic body to the Anthropic endpoint
Missing or unknown model400 validation errorCopy an exact identifier from the 7 plus model groups on relayrouter.io/models
Wrong base_url after migration400 or endpoint mismatchChange base_url and key only, no other code changes

Numbered checklist to resolve a 400

Follow these 4 steps to isolate and fix a 400 bad request.

  1. Identify which of the 2 protocols your SDK uses: OpenAI (/v1/chat/completions) or Anthropic (/v1/messages).
  2. Confirm the base_url and key are set for RelayRouter, with no other code changes.
  3. Verify the model string against the catalog at relayrouter.io/models.
  4. Retry: because failed or errored requests are generally not billed, testing corrections does not add charges.

FAQ

Does a 400 request get billed? No. Failed or errored requests are generally not billed, so a rejected 400 does not add to your usage.

Which protocols does RelayRouter accept? Both the OpenAI protocol (POST /v1/chat/completions) and the Anthropic protocol (POST /v1/messages).

What do I change to migrate an existing SDK? Keep your existing SDK, and change only the base_url and the key, with no other code changes (see 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