Request too large or too long
If a request has too much text for the model, or the request body is too big, the API refuses it. Shorten the conversation, lower max_tokens, or send large documents in a smarter way. These errors do not go away on retry; the request has to change.
Codes you may see
| Status | Code | Message | Limit |
|---|---|---|---|
| 400 | context_length_exceeded | ”The request exceeds the model’s maximum context length. Shorten the messages or lower max_tokens.” | Input plus max_tokens must fit the model’s context window (262,144 tokens for most models). |
| 413 | payload_too_large | ”The request is too large.” | A request body of about 2 MB. |
| 413 | too_many_messages | ”The request has too many messages.” | 500 messages per request. |
Fixes
- Lower
max_tokens. The space reserved for the answer counts toward the window, so a largemax_tokenscan push a request over. - Trim old turns. Summarize or drop the oldest messages of a long conversation.
- Count before you send. Use token counting and trim when you are close to the limit.
- Send documents as files and quote only the relevant parts. See Files.
- For agents, turn on context management so older content is cleared automatically.
In the apps
| App | What to do |
|---|---|
| Web app | Start a new conversation for a new topic. |
| Syntic Desktop | ”This conversation is too long. Start a new chat or upgrade.” Start a new chat. |
| Syntic Code | Type /compact to summarize older messages, or /clear to start fresh. /context shows what fills the conversation. Syntic Code also compacts automatically when the conversation gets full. |
Related
Was this page helpful?