Skip to main content
body_too_large means the body of a POST /v1/runs request is larger than OpenType accepts. Read this page if you send large documents, transcripts or JSON states in a run.

What happened

Route: POST /v1/runs. The body is over 4 MiB (4,194,304 bytes). The whole body counts: the prompt or state, the schema or questions, and the JSON syntax around them. The request was refused before a run existed. Nothing was stored and nothing was charged. POST /v1/router/select has the same 4 MiB cap and answers the same code. On every other route, a body over 1 MiB is refused with a plain-text 413 whose body begins Failed to buffer the request body, not with this JSON error. The response still carries the x-request-id header.
A body under 4 MiB can still be too large to run. Runs are also limited by their estimated input tokens: 262,144 for a decision run on Neon 1.1, 64,000 for a verdict run. Those limits return input_too_large.

How to fix

  1. Measure the encoded body in bytes, not characters: non-ASCII text takes more than one byte per character.
  2. Send only what the questions need. Drop unused fields from state, strip markup, and remove whitespace and pretty-printing from the JSON.
  3. Split a long document into several runs.
  4. Send the smaller request. The refused one never created a run, so its Idempotency-Key is still free and you may reuse it for the smaller body.

Example

Checking the size before sending:
  • Limits - the body cap next to every other limit.
  • input_too_large - the body fits, but the input is too many tokens.
  • Conventions - content type, body size and other request rules.
  • Problem codes - every code, its status, and whether a retry can help.