Availability
The Prompt Compressor is available from Tyk AI Studio 2.3.0.
For how the plugin compresses requests, refer to Prompt Compressor.
Top-Level Settings
Policy Settings
Token counts are estimates. The plugin divides the number of UTF-8 bytes by 4, so the count depends only on the text.
If the configuration is not valid, the plugin logs an error and turns off compression. The plugin continues to load.
External Engines
A level 3 policy can send the selected text to an external compression service. The plugin supports two engines:- Headroom, at
POST <url>/v1/compress - LLMLingua-2, at
POST <url>/compressPrompt
- The URL must use
httporhttps, and it must not contain credentials. Put the token inengine_<name>_token. - The plugin sends the token as a bearer token, only over
httpsor to a loopback address. - The plugin does not connect to link-local addresses, such as cloud metadata endpoints. The plugin can connect to loopback and private addresses, for sidecars.
- The plugin ignores proxy settings and does not follow redirects.
$SECRET/ references, refer to Secrets Management.
Response Headers
The plugin adds these headers to responses, including streamed responses:
When
allow_client_bypass is true, a client can send the request header X-Tyk-Compression: off. The gateway removes this header before the request goes to the vendor.
Permissions and Scopes
Page Permissions
Each page of the plugin has its own permission. You give these permissions through roles, the same as for other plugin permissions.