Router-level compression
Setcompression on a router variant to compress all message templates in that variant. This is the most common setup - configure once, and every request through this variant benefits from compression.
Router with compression
Variant-level compression only applies to the router’s message templates. It does not affect messages sent by the user in the request. Individual templates can override the variant-level aggressiveness by setting their own
compression field.Message-level compression
You can compress specific messages in a chat completion request by adding acompression field to any message. Consecutive messages with the same aggressiveness are batched and compressed together. Non-consecutive compressed messages are processed separately.
compression field are compressed. Other messages are sent as-is.
Response
The response includes compression stats inmetadata.compression:
If no messages were compressed, the
compression field is omitted from the response.
Warnings
When compression is enabled but skipped or fails for specific messages, the response includes warnings inmetadata.attempts[].warnings:
- A message has compression enabled but is too short (below 250 tokens)
- The compression service fails for a message (the message is sent uncompressed)