Quickstart
Compress your first prompt in under 2 minutes.
1
Get your API key
Create a free account and copy your API key from the API Keys page. It looks like: zt_live_xxxxxxxxxxxx
2
Send your first request
Replace YOUR_KEY with your actual key.
bash
curl -X POST https://api.ziptoken.ai/api/v1/compress \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Please write a comprehensive and detailed summary of the key concepts in machine learning, including supervised learning, unsupervised learning, and reinforcement learning.",
"mode": "balanced"
}'3
Read the response
json
{
"compressed": "Summarize key ML concepts: supervised, unsupervised, reinforcement learning.",
"originalTokens": 38,
"compressedTokens": 12,
"ratio": 0.684,
"savedTokens": 26,
"qualityScore": 4,
"mode": "balanced",
"model": "rule-based"
}68% fewer tokens β same meaning preserved. Use compressed as the prompt to your LLM.
4
Use in Node.js / TypeScript
typescript
async function compress(text: string): Promise<string> {
const res = await fetch('https://api.ziptoken.ai/api/v1/compress', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ text, mode: 'balanced' }),
})
if (!res.ok) throw new Error(`ziptoken error: ${res.status}`)
const { compressed } = await res.json()
return compressed
}
// Drop-in with OpenAI
const prompt = await compress(userMessage)
const completion = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: prompt }],
})