Docs menu
Using the API
Routing & savings
By default Sluice picks the cheapest healthy provider for your model. You can steer that, and several savings features work with no code change at all.
Routing controls
Optional fields on the request body:
optimize: true
Allow a cheaper model in the same quality tier. Off by default; the response says which model actually ran.
allowed_providers
Only route to these, e.g.
["groq", "together"].max_latency_ms
Providers slower than this are tried last.
cache: true / cache_ttl
Reuse the answer to an identical request (on by default at temperature 0). Repeats cost no provider fee; cache_ttl in seconds, default 3600.
model: "groq/llama-3.3-70b"
Prefix the model with a provider to pin the request to that host.
Costs & receipts
Every non-streaming response includes a sluice object and an x-sluice header; streams carry it in the final chunk.
cost_usd
What the provider charged for this call.
charged_usd
What you're billed — cost plus 5% of the saving. Never more than the model's direct price, unless failover had to use a pricier provider to complete the request.
baseline_cost_usd
What the same call would have cost at the model's direct/reference price.
saved_usd
baseline_cost_usd − charged_usd: what routing saved you on this call.
provider / model_used
Which provider served it and which model actually ran (relevant when optimize is on).
Pay less automatically
These lower your bill with no change to your code:
Cheapest provider
Every request goes to the cheapest healthy provider that serves your model.
Repeat cache
An identical request (temperature 0, or cache: true) is answered from cache — no provider fee, milliseconds instead of seconds. Scoped per account; never shared between customers.
Prompt caching
When a long prompt prefix repeats (system prompt, chat history, documents), Sluice marks it for the provider's prompt cache, where cached input costs a fraction of the normal price.
Batches
For work that can wait,
POST https://api.sluice.one/v1/batches uses providers' discounted batch capacity — typically about half price.Only pay for savings
Sluice's fee is 5% of what it saves you versus the direct price. If a call doesn't save you anything, there's no fee — so you're never worse off than calling the provider directly.