Composite Groups
July 23, 2026 ยท View on GitHub
Composite groups are an admin routing layer for API keys that should choose a concrete provider from the requested model instead of binding the key to a single provider group. They support both built-in model detection and an admin-configured model route registry for public model aliases.
Supported Providers
Composite groups can route to these concrete account platforms:
- Anthropic
- Gemini
- OpenAI
- Antigravity
- Grok
The selected concrete platform is used for account selection, user platform quota checks, post-usage billing, ops error platform attribution, channel mapping/pricing lookup, and platform usage reporting.
Route Registry
Admins can configure routes on a composite group from the group list's
Routes action or through the admin API:
GET /api/v1/admin/groups/:id/composite-routesPOST /api/v1/admin/groups/:id/composite-routesPUT /api/v1/admin/groups/:id/composite-routes/:route_idDELETE /api/v1/admin/groups/:id/composite-routes/:route_idPOST /api/v1/admin/groups/:id/composite-routes/preview
Each route belongs to one composite group and contains:
public_model: model identifier the client sends.match_type:exactorprefix.target_platform: concrete provider platform.upstream_model: model identifier sent upstream. If omitted, the public model is reused.endpoint:any,messages,count_tokens,responses,chat_completions,embeddings,images, orgemini.priority: lower values win after match specificity.enabled: disabled routes are ignored by runtime resolution but remain visible to admins.
Resolution order is explicit route first, then built-in detection. When more
than one explicit route matches, exact matches beat prefix matches,
endpoint-specific routes beat any, longer prefixes beat shorter prefixes,
then lower priority, then lower route id.
For JSON-body endpoints, the gateway rewrites the request model field to the
route's upstream_model before dispatch. For Gemini native paths such as
/v1beta/models/{model}:generateContent, the gateway resolves {model} and
the handler forwards the resolved upstream model.
Built-In Detection
Composite routing detects common public model IDs and provider-prefixed IDs:
claude-*andanthropic/claude-*route to Anthropic.gemini-*andgoogle/gemini-*route to Gemini.gpt-*,o*,codex-*,text-embedding-*,dall-e-*, andopenai/*route to OpenAI.grok-*andxai/grok-*route to Grok.
Unknown or ambiguous model names fail closed with a client error instead of guessing a provider.
Admin Workflows
- Admins can create a group with platform
composite. - Admins can add, edit, delete, and preview composite model routes.
- Composite groups can copy accounts from concrete provider groups.
- Concrete provider accounts can be assigned directly to composite groups from account create/edit and bulk account workflows.
- Subscription payment plans can bind to a composite group when that group's
subscription_typeissubscription. The plan grants access to the composite group; each request is still billed and quota-checked against the resolved concrete provider platform. - Channel configuration exposes composite groups in concrete provider sections.
The channel
group_idspayload is still flat; provider-specific model mapping and pricing remain keyed by concrete platform.
Bucket 2 Setup: OpenAI + Claude + Gemini + Grok
Use one composite subscription group when one customer-facing plan should expose model aliases across OpenAI, Claude, Gemini, and Grok without issuing separate keys per provider.
-
Create concrete provider groups for the upstream account pools, for example
OpenAI Paid,Claude Paid,Gemini Paid, andGrok Paid. -
Create a
compositegroup withsubscription_typeset tosubscription. -
Assign provider accounts directly to the composite group, or copy accounts from the concrete provider groups during group creation.
-
Add explicit routes for public aliases that should not rely on built-in model detection:
Public model Endpoint Target platform Upstream model all/gpt-5responsesopenaigpt-5all/claude-sonnetmessagesanthropicclaude-sonnet-4-6all/gemini-progeminigeminigemini-2.5-proall/grokresponsesgrokgrok-4.3 -
Configure channel pricing and model mapping under the concrete platforms named in each route. Composite routing does not create pricing records.
-
Create a subscription payment plan for the composite group.
The same composite group can also rely on built-in detection for standard model
names such as gpt-*, claude-*, gemini-*, and grok-*. Explicit routes are
recommended for bundled plan aliases because they make endpoint, provider, and
upstream model attribution reviewable in the admin UI.
Limits
Composite routes choose a concrete provider and upstream model; they do not create synthetic model metadata, pricing, or upstream capability records by themselves. Keep channel pricing/model mapping configured for the concrete provider platforms that the routes target.
This PR intentionally does not implement:
- AUTO smart-routing among multiple providers for the same abstract task.
- Direct API-key binding to several existing groups without a composite group.
- Protocol-agnostic provider decoupling or a LiteLLM-style adapter rewrite.