optimize_response
Decode a provider reply that was previously compressed with Kaizen, restoring the full JSON payload for downstream processing.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ktof | str | ✅ | KTOF response string returned by your provider (e.g., completion.output_text). |
options | DecodeOptions | ❌ | Control indentation or strictness during decode. |
Code example
Response example
Errors
400→ktofmissing or malformed.404→ Referenced payload ID expired (if using stored IDs instead of inline strings).
Notes
- Use this method together with
optimize_requestwhen building middleware for provider SDKs. - If you only need raw decompression without request/response semantics, use
decompress.