# Context length exceeded

> Context length exceeded? The prompt plus output is larger than the model's window. How to shorten context, lower max_tokens or switch model.

A "context length exceeded" error means the prompt plus the requested output is larger than the model's context window. Shorten the conversation, lower max_tokens, or switch to a model with a larger window. Chat apps and coding agents resend the whole history on every turn, so long sessions reach the limit first.

## What causes it?

- A long chat history, sent again with every message.
- A max_tokens value that, added to the prompt, exceeds the window.
- Large files or tool results pasted into the conversation.

## How do I fix it?

In this order. [The Troubleshooting](https://outrun.to/docs/troubleshooting) has the full setup.

- Start a new session, or clear and summarise the history (/clear or /compact in coding agents).
- Lower max_tokens or the app's response length.
- Lower the context size setting in apps such as SillyTavern.
- Pick a model with a larger context window; each model page lists it.

**Cap the output**

```
{"model": "claude-sonnet-5-5",
 "messages": [...],
 "max_tokens": 4096}
```

## Questions

### Does a longer context cost more?

Yes. Every input token is billed, and the whole history is sent on each turn. Cached input lowers the cost on models that list a cached price.

### Where do I find a model's context window?

On its model page, under the price table.

### Does Outrun keep my prompts or outputs?

Outrun does not store your prompts, images or outputs unless you choose to save them.

## Related pages

- [SillyTavern: API returned an error (Bad Request)](https://outrun.to/fix/sillytavern-api-returned-an-error-bad-request)
- [Model not found (404)](https://outrun.to/fix/model-not-found-404)
- [Troubleshooting](https://outrun.to/docs/troubleshooting)
- [All error fixes](https://outrun.to/fix)
- [Get your API key](https://outrun.to/overview)

[Get your API key](https://outrun.to/key) [See all models and prices](https://outrun.to/pricing)
