Route by model name

Send a bare model name to /v1/chat/completions and CoreValue sends it to a provider you hold a key for.

With the OpenAI SDK pointed at https://gateway.corevalue.dev/v1, a request names only a model, so it would normally go to OpenAI. Routing by model name lets the same request reach the provider that actually serves that model: send claude-sonnet-4-5-20250929 to /v1/chat/completions, and if your organisation holds an Anthropic or Bedrock key, CoreValue sends it there and returns an OpenAI-format reply.

It is on for every organisation. There is nothing to configure.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.corevalue.dev/v1",
    api_key=os.environ["COVA_API_KEY"],
)

# No prefix, no second SDK: routed to a provider you hold a key for.
response = client.chat.completions.create(
    model="claude-sonnet-4-5-20250929",
    messages=[{"role": "user", "content": "Hello"}],
)

How the provider is chosen

For each eligible request, CoreValue:

  1. Looks the model up in its price registry. It accepts the registry name (as GET /v1/models lists it) or the provider's own id for the model.
  2. Keeps the providers that serve that model and that your organisation can reach: you have added a key for it on Gateway → Provider keys.
  3. Picks the one with the lowest list price for that model.

If the chosen provider is OpenAI, nothing changes. Otherwise the request is rewritten as if you had sent it to /gateway/v1 with that provider's prefix, for example anthropic/claude-sonnet-4-5-20250929, and is translated and mapped back exactly as a prefixed request would be.

The request is left on the OpenAI path, unchanged, when:

  • the registry does not know the model,
  • no provider you hold a key for serves it, or
  • the cheapest one you hold a key for is one this route cannot address (Vertex AI).

A request left on the OpenAI path is sent to OpenAI. Without an OpenAI key, it fails with No openai provider key available.

What it applies to

Only POST /v1/chat/completions in OpenAI format. These are never rerouted:

  • the Responses API (/v1/responses), embeddings, images, audio and the rest of the OpenAI API;
  • requests to /gateway/v1, where you have already named the provider with a prefix;
  • requests to a provider's own endpoint, such as /v1/messages (Anthropic), :generateContent (Gemini, Vertex AI) or /model/{id}/invoke (Bedrock).

It is not failover

Routing chooses one provider before the request is sent. If that provider then fails, CoreValue retries the same provider and does not try another one that serves the model. To fall over to another provider or model, add a fallback chain with Cova-Fallbacks, naming each fallback with its provider prefix, for example ["groq/llama-3.3-70b-versatile"].

See where a request went

The response says which provider served it:

HeaderRouted request
Cova-ProviderThe provider chosen, for example anthropic or bedrock
Cova-ModelThe model as sent to the provider, with the provider prefix, for example anthropic/claude-sonnet-4-5-20250929
Cova-Gateway-Modetranslated when the request went to Anthropic, Gemini or Bedrock

See Response headers. On Requests, the request is recorded under the provider that served it.

With key scopes and budgets

  • A key's Models scope is checked against the model you asked for, before routing. Its Providers scope is checked against the provider routing chose, so a key limited to Anthropic is refused if the request would be routed to Bedrock.
  • Budgets and key caps are charged at the price of the provider that served the request.

On this page