Docs menu
Core API
Chat completions
The core endpoint. The same request and response as OpenAI, plus a cost receipt on every call.
Endpoint
POST https://api.sluice.one/v1/chat/completions. Send the same JSON body you'd send OpenAI.
POST https://api.sluice.one/v1/chat/completions
{
"model": "llama-3.3-70b",
"messages": [
{ "role": "system", "content": "You are concise." },
{ "role": "user", "content": "Write a haiku about routing." }
],
"temperature": 0.7,
"max_tokens": 200
}Supported parameters
Standard OpenAI fields are honored and anything else is passed straight through to the model:
model
Required. A model name (Sluice picks the cheapest host) or provider/model to pin a host.
messages
Required. The usual system / user / assistant / tool message array.
temperature, top_p, stop, seed, n
Standard sampling and output controls, passed through.
max_tokens / max_completion_tokens
Output cap. Also used to reserve balance before the call runs.
tools, tool_choice
Function calling — see Tool calling.
response_format
JSON mode / JSON schema — see Structured outputs.
stream
Server-sent events — see Streaming.
Sluice-specific fields
A few optional fields steer routing and caching —
optimize, allowed_providers, max_latency_ms, cache, cache_ttl. They're stripped before the request reaches the provider. See Routing & savings.The response
OpenAI-shaped, with one addition — a sluice object describing the route and the cost.
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "llama-3.3-70b",
"choices": [
{ "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" }
],
"usage": { "prompt_tokens": 14, "completion_tokens": 20, "total_tokens": 34 },
"sluice": {
"request_id": "ios-...",
"provider": "groq",
"model_requested": "llama-3.3-70b",
"model_used": "llama-3.3-70b",
"cost_usd": 0.000021,
"charged_usd": 0.000021,
"baseline_cost_usd": 0.000089,
"saved_usd": 0.000064,
"cached": false,
"optimized": false,
"attempts": 1,
"latency_ms": 430
}
} RECEIPT · groq · llama-3.3-70b
Provider cost$0.000021
You're charged$0.000021
Direct price$0.000089
You saved$0.000064
The sluice receipt
Every call reports exactly what happened:
provider / model_used
Which provider served the request and which model actually ran.
model_requested
The model you asked for (differs from model_used only when optimize substitutes a cheaper one).
cost_usd
What the provider charged.
charged_usd
What you were billed (cost plus our share of the saving).
baseline_cost_usd
What the same call would cost at the model's direct price.
saved_usd
baseline − charged: what routing saved you.
cached
True if the answer came from cache (no provider fee).
optimized
True if a cheaper same-tier model was substituted.
attempts
How many providers were tried (more than 1 means failover happened).
latency_ms / request_id
Round-trip time, and an id for support and your request log.
Response headers
x-request-id
The request id, for correlating with your dashboard request log.
x-sluice
The receipt as JSON. On streams it carries the route (cost arrives in the final chunk).