Providers and models
Any OpenAI compatible API
Declare a gateway in settings with your own tiers.
Any service that speaks the OpenAI chat completions format can be a provider. No code change is needed. Declare it in ~/.frontier/settings.json, because providers is a user only setting: a repository cannot add one, since a provider decides where your keys and code go.
{
"providers": [
{
"name": "my-gateway",
"baseUrl": "https://api.example.com/v1",
"apiKeyEnv": "MY_GATEWAY_API_KEY",
"models": {
"premium": ["their-best-model"],
"standard": ["their-fast-model"]
},
"pricing": {
"their-best-model": { "input": 3.0, "output": 15.0 },
"their-fast-model": { "input": 0.4, "output": 1.6 }
}
}
]
}Put the key in ~/.frontier/.env:
MY_GATEWAY_API_KEY=your-key-hereThe provider joins the tier system. Its premium models are tried right after the premium models of the providers listed before it, and so on down.
The fields
| Field | Meaning |
|---|---|
name | A label. Also the name shown in /providers and used in privacy.blockedProviders. |
preset | Start from a built in preset: openrouter, gemini, deepseek, groq, ollama, openai or anthropic. |
baseUrl | The API root, without a trailing slash. |
apiKeyEnv | The NAME of the environment variable that holds the key. Never the key. Use null for a server on this machine that needs no key. |
models | Model ids per tier: premium, standard, economy. |
pricing | Dollars per million tokens for each model: input, output, and optionally cached_input. A model with no price is shown with an unknown cost. |
headers | Extra request headers. |
userAgent | Overrides the User-Agent, for gateways that require a specific one. |
visionModels | Which of its models accept images. |
concurrency | Requests in flight to this provider. |
dataPolicy | local, no-training or standard. Used by privacy.noTraining. |
region | A label such as us or cn. |
balanceKind | deepseek if the gateway fronts DeepSeek and you want the credit lookup. |
reasoningEcho | true for a gateway that fronts DeepSeek and needs reasoning sent back. |
extraContent | true for a gateway that fronts Gemini. |
freeTier | Describes a free tier so the free lane can use it. See below. |
cost | free, paid or mixed. It decides the label on an answer (free lane or paid lane) and whether the paid lane question is asked. Without it a service counts as paid, unless every model has a written price of zero or the address is on this machine. |
By default Relief judges what a provider is from its base URL, and dataPolicy is standard unless the address is on this machine.
Describing a free tier
The free lane needs to know which models cost nothing and what a daily 429 switches off. For known hosts it works that out from the address. For a gateway of your own, describe it:
{
"freeTier": {
"freeFilter": "priced-zero",
"quotaScope": "provider",
"resetTimeZone": "UTC"
}
}freeFilter:priced-zero(the live model list shows a price per model, and free means zero),gemini-flash,all-chat(every chat model is free, as on a local server), ornone.quotaScope:model(each model has its own daily count),provider(the whole key shares one), ornone.resetTimeZone: the clock the daily count resets on.
Without freeTier, a custom gateway takes no part in the free lane.
Let setup do it
frontier setup offers "Another service", written for someone who has never typed a base URL. It asks for a name and the base URL, then:
- For an address on this computer (
http://localhost...) it asks whether the server wants a key. Most do not (Ollama, LM Studio). A server with no key must be on this computer: an internet address without a key is refused before anything is asked. - It asks the service for its own model list and offers what it found, at most five chat models, with speech, embedding and moderation models left out. Press Enter to use them or type your own names. If the service gives no usable list, it says why and you type one or two names from its website.
- The key, when there is one, is sent only to the address you typed, and a redirect is refused so it can never be handed to another host.
- It asks
Is it free to use?and the default answer is no. A free answer writes a zero price andcost: free, so the service joins the free lanes. A wrong "no" only means Relief asks once before using it under a free budget. - The data policy is saved as
unknownuntil you have read the service's terms.
A server on this computer, with no key
{
"providers": [
{
"name": "lm-studio",
"baseUrl": "http://localhost:1234/v1",
"apiKeyEnv": null,
"cost": "free",
"models": { "economy": ["your-model-name"] },
"pricing": { "your-model-name": { "input": 0, "output": 0 } }
}
]
}Check it
frontier doctorthen /providers inside the cockpit to see its models by tier.