Provider selection
Choose which providers serve you, and save the choice with your model, prompt and parameters as a preset you call with @name.
By default every request goes to the best provider available at that moment, balancing price, speed and reliability, and moves to the next provider of the same model if one fails. You can change what "best" means and which providers are allowed.
Pick what to optimize for
Add a profile to the model id:
| Model you send | Picks the provider with |
|---|---|
deepseek-v4.1-flash | The best balance of price, speed and reliability (balanced) |
deepseek-v4.1-flash:cost | The lowest price |
deepseek-v4.1-flash:latency | The fastest first token |
deepseek-v4.1-flash:throughput | The most tokens per second |
An unknown suffix is not an error: the request runs as balanced.
Allow or exclude providers
Provider lists live in a preset, so you set them once instead of on every request:
{
"name": "eu-only",
"model": "deepseek-v4.1-flash",
"routing": {
"only": ["provider-a", "provider-b"],
"sort": "cost"
}
}| Field | Effect |
|---|---|
routing.only | Only these providers may serve the request. Empty means any |
routing.ignore | These providers never serve it |
routing.sort | The default profile: balanced, cost, latency or throughput |
Then send "model": "@eu-only". A profile on the request still wins over the preset's sort:
@eu-only:latency uses the preset's providers but picks the fastest. If none of the allowed providers can
serve a request, it fails rather than going to one you excluded. Choosing providers never adds a fee: you
pay the live price.
Provider fallback
When a provider fails, the request moves to the next one serving the same model, and stays inside the providers the preset allows. See Reliability.
Presets
A routing preset is a named set of defaults that a request picks up by naming it. Use one to change the
model, prompt or providers behind an app without redeploying it: the app sends @support-bot, and you
change what @support-bot means in the console.
resp = client.chat.completions.create(
model="@support-bot",
messages=[{"role": "user", "content": "Where is my order?"}],
)What a preset holds
| Field | Used for |
|---|---|
name | What requests call it by. Letters, digits, - and _ |
model | The model to run, for example deepseek-v4.1-flash |
system_prompt | A system prompt for requests that don't send one |
params | Generation parameters such as temperature or max_tokens, for requests that don't set them |
routing | Which providers may serve it and what to optimize for; see Provider selection |
The request always wins: a system prompt or parameter it sends is kept, and the preset only fills what's
missing. A preset can't set model, messages or stream inside params.
Calling a preset
| Model you send | Runs |
|---|---|
@support-bot | The preset's model, with its defaults |
@support-bot/deepseek-v4.1-flash | That model instead of the preset's, with the preset's other defaults |
@support-bot:latency | The preset, picking the fastest provider; see profiles |
A request that names a preset that doesn't exist, or one that is disabled, fails with a 400. It never
falls through to a default model.
Manage presets
- In the console: Strategies. Create, edit, disable and delete presets there.
- From code: the routing presets API, with a key that has the
routing_preset:readandrouting_preset:writescopes.
curl https://api.spareinference.ai/v1/namespaces/me/routing-presets \
-H "Authorization: Bearer $SPARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "support-bot", "model": "deepseek-v4.1-flash", "system_prompt": "Answer in two sentences.", "params": {"temperature": 0.2}}'Changes apply from the next request. Disabling a preset keeps it for later; deleting it is permanent.
How is this guide?