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

# Override token limits for a session

> Set a custom context and output token limit for a single session when you create it, instead of using your organization's defaults.

Your organization's administrators can set default context and output token limits that apply to every session. When you create a session, you can override those defaults for that session only.

Use an override when one session needs a different budget than usual. For example, a large refactor may need more context, or a quick fix may not need the full default window.

## Set limits for a new session

You can only set session limits when you create the session. After the initial prompt, the session keeps the limits it started with.

1. Open the New Session page.
2. In the message composer, select the **Token Limits** button. It shows `Default` when no override is set and `Custom` when one is.
3. In the `Adjust Session Token Limits` dialog, enter a `Context Limit`, an `Output Limit`, or both. Each field's placeholder shows the default that applies to the selected model.
4. Select **Save**.

To go back to your organization's defaults, reopen the dialog and reset the values.

If the selected model has a maximum context size configured by your administrators, the dialog shows it and caps your input at that value.

<Warning>
  Setting a limit above the model's actual maximum may result in unexpected behavior.
</Warning>

## API

You can set limits when creating a session programmatically by passing the optional `limits` object:

```http theme={null}
POST /api/sessions
Content-Type: application/json

{
  "title": "Refactor payment service",
  "private": false,
  "model": "anthropic/claude-sonnet-4-6",
  "limits": {
    "context": 400000,
    "output": 64000
  }
}
```

Both `context` and `output` accept integers between 1 and 10,000,000. Omit the `limits` object to use your organization's defaults.


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