Endpoints
Provider routing & fallbacks
Choose, order and filter upstream providers with api14 provider routing, and set fallbacks across models so requests keep working when one fails.
Try it in the playgroundMany models are served by several upstream providers, each with its own price, speed and data policy. By default, requests are load-balanced across providers by price and uptime, and fall back to another provider when one fails. Use the provider object to change this, and models to fall back across different models.
The provider object
| Field | Type | Description |
|---|---|---|
order | string[] | Providers to try first, in order, e.g. ["Anthropic", "Amazon Bedrock"]. |
allow_fallbacks | boolean | false stops the request from going to providers outside order or only (default true). |
only | string[] | Allow only these providers. |
ignore | string[] | Never use these providers. |
sort | string | "price", "throughput" or "latency" instead of load balancing. |
data_collection | string | "deny" excludes providers that may store or train on prompts. "allow" is the default. |
require_parameters | boolean | Only use providers that support every parameter in your request (e.g. tools, response_format). |
quantizations | string[] | Allowed precisions, e.g. ["fp8", "bf16"]. |
max_price | object | Upper price limits in USD per million tokens, e.g. { "prompt": 1, "completion": 3 }. |
{
"model": "meta-llama/llama-3.3-70b-instruct",
"messages": [{ "role": "user", "content": "Hello" }],
"provider": {
"order": ["Groq", "Fireworks"],
"allow_fallbacks": true,
"data_collection": "deny",
"sort": "throughput"
}
}
The :nitro variant is a shortcut for sort: "throughput", and :floor is a shortcut for sort: "price". See Model ids.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.chat.completions.create({
"model": "openai/gpt-5-mini",
"messages": [
{
"role": "user",
"content": "Explain vector databases in two sentences."
}
]
});
console.log(result.choices[0].message.content);
Model fallbacks with models
Pass a list of models. If the first one fails (an outage, rate limit, moderation or context length error), the next one is tried:
{
"models": ["anthropic/claude-sonnet-4.5", "openai/gpt-5-mini", "google/gemini-2.5-flash"],
"messages": [{ "role": "user", "content": "Summarize this ticket." }]
}
modelis optional whenmodelsis set. If you send both,modelis tried first.- Every model in the list must pass the gateway checks before the request is sent: it must exist and be enabled, be on your key's model allowlist, and be included in your plan. One model that fails the checks rejects the whole request (
403 model_not_allowed,403 plan_requiredor404 model_not_found). - You are billed only for the model that answered, at its own price. The response's
modelfield tells you which one it was.
Response
{
"id": "gen-1760000000-route",
"model": "openai/gpt-5-mini",
"provider": "OpenAI",
"choices": [{ "index": 0, "finish_reason": "stop", "message": { "role": "assistant", "content": "..." } }],
"usage": { "prompt_tokens": 140, "completion_tokens": 60, "total_tokens": 200, "cost": 0.000155 }
}
provider shows which upstream provider served the request. Generation lookup shows the full routing details.
Errors
If no provider matches your filters (e.g. only together with require_parameters), the upstream returns 404 "No endpoints found". Other errors are the same as for Chat completions. See Errors.