Message Transforms

Keep long contexts usable with automatic middle-out compression

Message transforms pre-process your `messages` array before routing. The `middle-out` strategy keeps the beginning and end of a conversation while compressing the middle when token or message count limits are exceeded.

middle-out-request.json
{
  "model": "anthropic/claude-haiku-4.5",
  "messages": [{ "role": "user", "content": "...large conversation payload..." }],
  "transforms": ["middle-out"],
  "max_tokens": 500
}
Disable transform
{
  "model": "anthropic/claude-haiku-4.5",
  "messages": [{ "role": "user", "content": "..." }],
  "transforms": []
}
When to use
Use transforms for support chats, iterative coding sessions, and agent logs where the first instructions plus latest turns are most important.