Integrate Toffee's semantic compression engine directly into your own applications. The API allows you to programmatically compress AI conversations, manage context bundles, and synchronize state across devices.
The Toffee API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.
https://api.toffee.ai/v1The Toffee API uses Firebase Auth ID tokens to authenticate requests. You can view and manage your API keys in the Toffee Dashboard.
All API requests must include your token in an Authorization HTTP header:
Authorization:Bearer <YOUR_FIREBASE_ID_TOKEN>/v1/compressCompresses a raw conversation array into an optimized .toffee bundle. This endpoint runs the full 8-stage semantic compression pipeline.
The raw conversation payload extracted from the AI platform.
Compression aggressiveness. Defaults to standard. Allowed values: minimal, standard, aggressive.
curl -X POST https://api.toffee.ai/v1/compress \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "profile": "standard", "conversation": { "platform": "chatgpt", "model": "gpt-4o", "turns": [ { "role": "user", "content": "Let's build a Next.js app." } ] } }'
The Toffee API implements rate limiting to ensure stability. Limits are applied per authenticated user account.
| Endpoint | Rate Limit | Window |
|---|---|---|
| POST /compress | 60 requests | Per minute |
| GET /bundles | 300 requests | Per minute |
Toffee uses conventional HTTP response codes to indicate the success or failure of an API request.
Everything worked as expected.
The request was unacceptable, often due to missing a required parameter.
No valid API key or Firebase token provided.
Too many requests hit the API too quickly. We recommend an exponential backoff.
Something went wrong on Toffee's end.