Skip to main content

API Methods

Every SDK call follows the same shape: send structured JSON, receive a KTOF payload (or decoded data), and inspect the stats to quantify savings. Use the links below for detailed, language-specific docs.
MethodDescriptionRequest modelResponse highlights
KaizenClientConfigure base URL, headers, and lifecycle helpers.KaizenClientConfigAsync context manager, env loading
compressGeneric JSON → KTOF compression with size stats.EncodeRequestresult, stats
decompressExpand a KTOF string back into JSON.DecodeRequestdata, operation
optimizeCompression plus token stats in one round-trip.EncodeRequest + token_modelsstats, token_stats
optimize_requestEncode raw provider payloads (messages, tools, metadata).OptimizeRequestPayloadresult, schema echoes
optimize_responseDecode provider replies back into structured JSON.OptimizeResponsePayloadresult
prompts_encodeAuto-detect JSON snippets inside prompts and compress.PromptEncodePayloadresult, stats, optional token_stats
prompts_decodeHydrate a ktof string by ID or inline payload.PromptDecodePayloadresult, metadata, replay_meta
healthLightweight readiness probe.Nonestatus, uptime (when enabled)
Implementation references:
  • Source: python/kaizen_client/client.py
  • Models: python/kaizen_client/models.py
  • Tests: python/tests/test_client.py
Each method page includes the canonical request schema, code samples, expected responses, error shapes, and behavior notes.