Skip to content
On this page

Core concepts

Model groups

Routing and pricing bundles assigned to API keys: different model mappings, prices, and model sets.

A model group lets the operator serve the same public model id through a different upstream, at a different price, and with a different model subset — per key. Create a Cheap and a Premium group and bind keys to each.

How it works

  • Each group row overrides a catalog model's provider, upstream_model, prices, multiplier, network fee, and advertised limits. Blank fields inherit the catalog row.
  • A key bound to a group resolves every request through that group. A group with model rows also becomes the key's model allowlist.
  • A group with no model rows is transparent: every public model, catalog routing, catalog prices.
  • Disabled groups reject traffic on bound keys with 403.

Precedence

LayerWins over
Key allowlistA non-empty api_keys.allowed_models still restricts the key, even inside a group.
Group model setWhen the group has rows, only those model ids are callable.
Account allowlistUsed when neither the key nor the group restricts models.
Account price overridesprice_overrides replace group and catalog prices at billing time.

Admin API

Method & pathPurpose
GET/POST /admin/groupsList or create groups.
GET/PATCH/DELETE /admin/groups/{id}Read (with models), update, or delete a group.
GET /admin/groups/{id}/modelsList the group's model overrides.
PUT /admin/groups/{id}/models/{model}Replace one model mapping: provider, upstream_model, prices, multiplier, fee, limits, enabled.
DELETE /admin/groups/{id}/models/{model}Remove the override (inherit catalog).
GET /admin/users/{id}/keysList a user's active keys with their group.
PATCH /admin/users/{id}/keys/{key_id}Bind or clear a key group: { "group_id": "cheap" | null }.

Example

POST /admin/groups
{ "id": "cheap", "name": "Cheap" }
PUT /admin/groups/cheap/models/deepseek-v4.1-flash-1017
{
"provider": "inferhub",
"upstream_model": "cb/deepseek-v4.1-flash",
"price_prompt_per_m": 0.02184,
"price_completion_per_m": 0.09048
}
PATCH /admin/users/{user_id}/keys/{key_id}
{ "group_id": "cheap" }

Catalog stays public

Groups never change GET /v1/models. The public catalog keeps catalog prices; group routing and pricing are applied per key at request and billing time.