Logo SVG copied to clipboard
New Introducing paid plans for Manifest Cloud Learn more
OpenAI HTTP 400 Bad request

OpenAI 400 — Context length exceeded

What this error means

A 400 context_length_exceeded fires when input tokens plus max_tokens exceed the model's context window.

How to fix it

  • Trim or summarize history before sending
  • Lower max_tokens to leave room for the prompt
  • Move to a longer-context model for big inputs
Example error message
{
  "error": {
    "message": "This model's maximum context length is 128000 tokens.",
    "type": "invalid_request_error",
    "code": "context_length_exceeded"
  }
}

Frequently asked

Does max_tokens count toward the limit?

Yes. The window must fit prompt tokens plus the completion you reserve with max_tokens.

More OpenAI errors

CodeErrorAffected teams / 30 days
429 OpenAI 429 — Rate limit exceeded 68 View
401 OpenAI 401 — Invalid authentication 55 View
View all OpenAI errors
Route OpenAI through Manifest Live token usage, every model, and automatic fallback when OpenAI rate-limits or fails.

Don't let your requests fail again and again

Manifest fixes your bad LLM requests on the fly so they return successful responses before it reaches your agent. No downtime.

  • Deprecated / Not-found models
  • Wrong parameters
  • Malformed requests
  • Exceeded context windows