Documentation Index
Fetch the complete documentation index at: https://docs.getkaizen.io/llms.txt
Use this file to discover all available pages before exploring further.
Documentation Index
Fetch the complete documentation index at: https://docs.getkaizen.io/llms.txt
Use this file to discover all available pages before exploring further.
pip install kaizen-client
export KAIZEN_API_KEY="kaizen_xxx"
import os
from kaizen_client import KaizenClient, KaizenClientConfig
# Explicit configuration for reliable environment loading
config = KaizenClientConfig(
api_key=os.getenv("KAIZEN_API_KEY"),
base_url=os.getenv("KAIZEN_BASE_URL", "https://api.getkaizen.io/"),
timeout=float(os.getenv("KAIZEN_TIMEOUT", "30"))
)
client = KaizenClient(config)
import asyncio
import os
from kaizen_client import KaizenClient, KaizenClientConfig
async def main():
config = KaizenClientConfig(
api_key=os.getenv("KAIZEN_API_KEY"),
base_url=os.getenv("KAIZEN_BASE_URL", "https://api.getkaizen.io/"),
timeout=float(os.getenv("KAIZEN_TIMEOUT", "30"))
)
async with KaizenClient(config) as client:
encoded = await client.prompts_encode({
"prompt": {"messages": [{"role": "user", "content": "Compress me"}]},
"token_models": ["gpt-4o-mini"]
})
decoded = await client.prompts_decode({"ktof": encoded["result"]})
print("Reduction:", encoded["stats"]["reduction_ratio"])
print("Decoded:", decoded["result"]["messages"][0]["content"])
asyncio.run(main())