Documentation
Getting Started
curl Quickstart
Test the Laghav API with curl — no SDK, no signup for the playground endpoint. Production calls require an API key.
✦Try the playground without any key
The
/v1/playground endpoint is public (no auth). Rate-limited to 10 calls/day per IP. Production calls use /v1/complete with an API key.Playground — no auth required
bash
curl -X POST https://api.laghav.ai/v1/playground \-H "Content-Type: application/json" \-d '{"text": "Hey I just wanted to ask you if you could possibly help me to understand what the main causes of the revenue drop were in the last quarter","content_type": "auto","aggressiveness": 0.5,"cf_turnstile_token": ""}'
Complete endpoint — requires API key
bash
curl -X POST https://api.laghav.ai/v1/complete \-H "Authorization: Bearer lgh_live_xxxxxxxxxxxx" \-H "Content-Type: application/json" \-d '{"messages": [{"role": "user", "content": "Summarize the key findings from last quarter earnings"}],"model": "auto","laghav_options": {"compress": true,"route": true,"cache": true,"score": true}}'
Example response
response.json
{id: "lgh_req_abc123",object: "chat.completion",choices: [{index: 0,message: {role: "assistant",content: "Key findings: Revenue declined 12% YoY..."},finish_reason: "stop"}],model: "claude-haiku-3-20240307",laghav_meta: {original_tokens: 847,compressed_tokens: 340,compression_ratio: 0.60,quality_score: 94,cost_original_usd: 0.000212,cost_actual_usd: 0.000085,saved_usd: 0.000127,routing_reason: "analytical",model_requested: "auto",rules_applied: ["filler", "preamble"],cache_hit: false,latency_overhead_ms: 18}}
Streaming with curl
bash
curl -X POST https://api.laghav.ai/v1/complete \-H "Authorization: Bearer lgh_live_xxxxxxxxxxxx" \-H "Content-Type: application/json" \--no-buffer \-d '{"messages": [{"role": "user", "content": "Write a short blog post"}],"model": "auto","stream": true}'# Receives Server-Sent Events (SSE)# data: {"choices":[{"delta":{"content":"Here"}}]}# data: {"choices":[{"delta":{"content":" is"}}]}# ...# data: {"laghav_meta": {...}} <- final chunk
Check your usage
bash
curl https://api.laghav.ai/api/usage/today \-H "Authorization: Bearer lgh_live_xxxxxxxxxxxx"
Health check
bash
curl https://api.laghav.ai/health