Chat Completions
Non-Streaming Request
Section titled “Non-Streaming Request”curl https://cavos.org/api/v1/chat/completions \ -H "Authorization: Bearer sk_live_abc123..." \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-4o-mini", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"} ], "temperature": 0.7, "max_tokens": 1024 }'Response
Section titled “Response”{ "id": "gen-abc123", "object": "chat.completion", "model": "openai/gpt-4o-mini", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 25, "completion_tokens": 8, "total_tokens": 33 }}Streaming Request
Section titled “Streaming Request”Add "stream": true to receive Server-Sent Events (SSE):
curl https://cavos.org/api/v1/chat/completions \ -H "Authorization: Bearer sk_live_abc123..." \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello!"}], "stream": true }'SSE Stream Format
Section titled “SSE Stream Format”data: {"choices":[{"delta":{"content":"Hello"},"index":0}]}
data: {"choices":[{"delta":{"content":"!"},"index":0}]}
data: {"choices":[{"delta":{},"finish_reason":"stop","index":0}],"usage":{"prompt_tokens":10,"completion_tokens":5}}
data: [DONE]Multi-Modal Messages
Section titled “Multi-Modal Messages”Send images alongside text:
{ "model": "openai/gpt-4o", "messages": [ { "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}} ] } ]}Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | — | Model ID (e.g., openai/gpt-4o-mini) |
messages | array | — | Array of message objects |
temperature | number | 1.0 | Randomness (0–2) |
max_tokens | number | — | Maximum response tokens |
stream | boolean | false | Enable SSE streaming |
top_p | number | 1.0 | Nucleus sampling |
stop | string[] | — | Stop sequences |
Usage Tracking
Section titled “Usage Tracking”Every request tracks token usage and cost. Usage is deducted from your credit balance in real-time. View usage history in the dashboard or via the API.