> ## Documentation Index
> Fetch the complete documentation index at: https://www.usenotra.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Long context

> Send long documents and conversations to writer-0.1: how the context window bounds the output, prompts with no room for an answer, request limits and holds.

writer-0.1 has a 262,144-token context window for the prompt and the output together.

## How the output is bounded

The output allowance is your output limit (`max_tokens`, `max_completion_tokens` or `max_output_tokens`), or 32,768 tokens without one. The gateway lowers it to the model's maximum of 32,768 tokens and to the room left after the prompt.

The gateway counts the prompt with the model's tokenizer. If the prompt leaves no room for an answer, the request fails with 400 `context_length_exceeded`. The gateway never truncates or drops messages, so shorten the prompt yourself: summarize earlier turns, or send only the parts of a document the answer needs.

## Request limits

* Up to 500 messages per request.
* Up to 1.45 MB of JSON. Larger bodies fail with 413 `request_too_large`.

## Tips for long prompts

* **Stream.** The model takes longer to start answering when it reads a large document. Streaming shows progress as soon as the plan starts, and avoids HTTP client timeouts on long answers.
* **Put the instruction first** and the document after it, in the user message.
* **Set a smaller output limit** when you don't need a long answer. Before calling the model, the gateway holds credits for the prompt plus the output allowance, and the token rate limit counts both. A smaller limit lowers both; you're still charged only for the tokens used. See [Rate limits](https://www.usenotra.com/docs/platform/account/rate-limits.md).

> [!TIP]
>
> Coding agents that resend a whole conversation can reach the context window. OpenCode compacts history before that by default. See [OpenCode and coding agents](https://www.usenotra.com/docs/platform/guides/coding-agents.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.