Start here
Three commands answer most of it before you read any further:Authentication
401 — every request rejected
401 — every request rejected
x-api-key; OpenAI-style endpoints take
Authorization: Bearer. /v1/messages accepts either. Keys always start with lx1_.
See Authentication.Claude Code ignores the gateway and talks to Anthropic
Claude Code ignores the gateway and talks to Anthropic
/logout first, then re-run npx layerx1. Check
ANTHROPIC_BASE_URL is the bare origin — https://api.layerx1.com, with no /v1;
the Anthropic SDK appends the path itself.Codex can't find a key / missing LAYERX1_API_KEY
Codex can't find a key / missing LAYERX1_API_KEY
npx layerx1 setup --tool codex --key lx1_your_key (0.2.4+) so the key is stored as
experimental_bearer_token in ~/.codex/config.toml. See Codex CLI.Models
404 — no such model
404 — no such model
GET /v1/models. Unknown ids fail closed
rather than silently becoming something else, and the compatibility handles for foreign
SDK names are a finite list — an invented id is a 404 by design. See
Model routing.The model in the catalog page isn't in GET /v1/models
The model in the catalog page isn't in GET /v1/models
400 on a request with an image
400 on a request with an image
capabilities.vision on the catalog entry. See
Vision.422 — the model can't guarantee what you asked for
422 — the model can't guarantee what you asked for
tool_choice, a strict
response_format) that no placement of that model declares support for. Switch to a
model whose supported_parameters includes it, or drop the requirement.Output
Empty response, or an answer that stops mid-sentence
Empty response, or an answer that stops mid-sentence
finish_reason: "length" — you hit max_tokens. On a reasoning model, hidden
reasoning is charged against the same ceiling and can consume all of it, leaving
nothing for the answer. Raise the budget; 4,000+ is a safe floor on reasoning models.
See Reasoning.Unexpected thinking blocks break my client
Unexpected thinking blocks break my client
thinking, reasoning_effort or reasoning — often an SDK default.
Remove it.The stream just stops
The stream just stops
5xx: retry the whole request with backoff. See
Streaming.Limits and cost
429 with a short retry-after
429 with a short retry-after
retry-after exactly
and pace off the x-ratelimit-* headers instead of discovering the limit by hitting
it. Parallel agent fleets usually hit concurrency first. See Plans & limits.429 allowance_exhausted
429 allowance_exhausted
retry-after is the seconds to reset. Upgrading lifts it immediately.429 credits_exhausted with no retry-after
429 credits_exhausted with no retry-after
retry-after — only a top-up clears it. Branch on the two codes rather than retrying
both.Requests are slower than expected under load
Requests are slower than expected under load
429. It shows up as latency, not an error — so give client
timeouts headroom. See Reliability.Usage is burning faster than expected
Usage is burning faster than expected
x1-allowance-remaining on every response is the live figure. Two levers: move the hot
path to a cheaper tier, and make the prompt prefix stable so repeated context bills at
a cached rate where the model publishes one (Prompt caching).Getting help
support@layerx1.com
- What you sent — endpoint, model id, and the request body with secrets removed.
- What came back — the status code and the full
error.message. - When — a rough timestamp with timezone, so the trace can be found.
- The
x1-modelresponse header, if you have it — it names what actually served the request.