claude-haiku (claude-haiku-4-5) and claude-sonnet-5 route Anthropic first and the OpenRouter copy second; claude-sonnet stays on 4.5 unchanged. Both are priced in config/catalog.json at list price, so the metered startup check passes and a request served by the OpenRouter leg bills the same catalog price. A contract test ties tensorzero.toml, catalog.json and the built-in list prices together. relay-catalog gains a read-only cross-check against LiteLLM's MIT price JSON (relay-price-crosscheck CLI): it flags differences above 5% and never changes a price. First run flags the two llama alias routes, whose retail price differs from the gpt-oss model that now serves them. The provider canary route list now covers the two new routes (34 calls a day). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
332 lines
15 KiB
TOML
332 lines
15 KiB
TOML
# Relay's active Neon + Cloudflare R2 runtime config. Direct provider model
|
|
# names remain available; add operator-owned model/function tables below as the
|
|
# product catalog is promoted. Provider secrets come from the Providers page
|
|
# (encrypted in Postgres) or the environment; never from this file.
|
|
[gateway]
|
|
bind_address = "0.0.0.0:3000"
|
|
# Relay is independent of TensorZero's hosted services (see OWNERSHIP.md): never
|
|
# send pseudonymous usage analytics to howdy.tensorzero.com.
|
|
disable_pseudonymous_usage_analytics = true
|
|
|
|
# Gateway API-key authentication. Required for every Relay money/metering path:
|
|
# `RELAY_BILLING_ENABLED` and `RELAY_METERING_ENABLED` both abort startup without
|
|
# it, and the billing dashboard resolves spend by the calling key. Keys live in
|
|
# Postgres (`TENSORZERO_POSTGRES_URL`) and are created from the UI's API Keys
|
|
# page or `gateway --create-api-key`. Give the UI its own key via
|
|
# `TENSORZERO_API_KEY` and list that key's public id in `RELAY_OPERATOR_KEY_IDS`
|
|
# so the dashboard can aggregate spend across all keys.
|
|
[gateway.auth]
|
|
enabled = true
|
|
|
|
[gateway.observability]
|
|
enabled = true
|
|
backend = "postgres"
|
|
|
|
[object_storage]
|
|
type = "s3_compatible"
|
|
bucket_name = "env::R2_BUCKET_NAME"
|
|
region = "auto"
|
|
endpoint = "env::R2_S3_ENDPOINT"
|
|
|
|
# ┌────────────────────────────────────────────────────────────────────────────┐
|
|
# │ MODELS │
|
|
# │ │
|
|
# │ Operator-owned catalog. No secret is ever written into config. Every │
|
|
# │ provider resolves its key as a `dynamic::relay_*_api_key` credential that │
|
|
# │ the gateway supplies per request (crates/gateway/src/provider_keys.rs): │
|
|
# │ the key stored on the Providers page (AES-256-GCM under │
|
|
# │ RELAY_CREDENTIALS_KEY) or, when none is stored, the named env variable │
|
|
# │ (GROQ_API_KEY, OPENROUTER_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY). │
|
|
# │ │
|
|
# │ ANY SUBSET OF KEYS BOOTS. No location here reads `env::` directly, so a │
|
|
# │ missing provider key never aborts startup. A provider without a key is │
|
|
# │ DISABLED: a request whose every route needs a disabled provider is refused │
|
|
# │ with HTTP 503 `provider_not_configured`, and the Providers page / startup │
|
|
# │ log show it as "Not configured". Trade-off: batch-status polling carries │
|
|
# │ no request credentials, so batch inference needs a key stored in Relay. │
|
|
# │ │
|
|
# │ FAILOVER. Each model routes to its primary provider first and to OpenRouter │
|
|
# │ second: when the primary errors (outage, 5xx, exhausted retries, open │
|
|
# │ circuit, or no key) TensorZero retries the request on the next provider. │
|
|
# │ Billing prices the Relay model name (`tensorzero::model_name::<name>`), so │
|
|
# │ the retail price is identical whichever provider served the request. │
|
|
# │ │
|
|
# │ COST-FIRST DEFAULT. Groq's free tier serves `functions.chat` and the │
|
|
# │ unpinned `passport_text` default; OpenRouter is the free failover leg. │
|
|
# └────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
# Shorthand names (`tensorzero::model_name::groq::openai/gpt-oss-120b`,
|
|
# what Rally and Menivor send) use these per-provider-type defaults, so they
|
|
# resolve through the same Relay credential slots as the named models below.
|
|
[provider_types.groq.defaults]
|
|
api_key_location = "dynamic::relay_groq_api_key"
|
|
|
|
[provider_types.openrouter.defaults]
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
[provider_types.anthropic.defaults]
|
|
api_key_location = "dynamic::relay_anthropic_api_key"
|
|
|
|
[provider_types.openai.defaults]
|
|
api_key_location = "dynamic::relay_openai_api_key"
|
|
|
|
# Groq free-tier models. Named after the Groq model id so a shorthand request
|
|
# for the same id whose provider has no key (e.g.
|
|
# `tensorzero::model_name::openai::openai/gpt-oss-120b`) is resolved to this
|
|
# catalog entry by the gateway instead of failing.
|
|
#
|
|
# Groq retired llama-3.3-70b-versatile and llama-3.1-8b-instant (2026-09); the
|
|
# replacements are OpenAI's open-weight gpt-oss models, served by Groq and by
|
|
# OpenRouter under the same ids.
|
|
[models."openai/gpt-oss-120b"]
|
|
routing = ["groq", "openrouter"]
|
|
|
|
[models."openai/gpt-oss-120b".providers.groq]
|
|
type = "groq"
|
|
model_name = "openai/gpt-oss-120b"
|
|
api_key_location = "dynamic::relay_groq_api_key"
|
|
|
|
[models."openai/gpt-oss-120b".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "openai/gpt-oss-120b"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
[models."openai/gpt-oss-20b"]
|
|
routing = ["groq", "openrouter"]
|
|
|
|
[models."openai/gpt-oss-20b".providers.groq]
|
|
type = "groq"
|
|
model_name = "openai/gpt-oss-20b"
|
|
api_key_location = "dynamic::relay_groq_api_key"
|
|
|
|
[models."openai/gpt-oss-20b".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "openai/gpt-oss-20b"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
# COMPATIBILITY ALIASES for the retired Groq ids. Consumers that still send
|
|
# `tensorzero::model_name::llama-3.3-70b-versatile` (or the no-key shorthand
|
|
# `openai::llama-3.3-70b-versatile`, resolved to this entry) keep working and run
|
|
# on the gpt-oss replacement. A direct `groq::llama-3.3-70b-versatile` shorthand
|
|
# bypasses the catalog and fails at Groq: move consumers to the new ids.
|
|
[models."llama-3.3-70b-versatile"]
|
|
routing = ["groq", "openrouter"]
|
|
|
|
[models."llama-3.3-70b-versatile".providers.groq]
|
|
type = "groq"
|
|
model_name = "openai/gpt-oss-120b"
|
|
api_key_location = "dynamic::relay_groq_api_key"
|
|
|
|
[models."llama-3.3-70b-versatile".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "openai/gpt-oss-120b"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
[models."llama-3.1-8b-instant"]
|
|
routing = ["groq", "openrouter"]
|
|
|
|
[models."llama-3.1-8b-instant".providers.groq]
|
|
type = "groq"
|
|
model_name = "openai/gpt-oss-20b"
|
|
api_key_location = "dynamic::relay_groq_api_key"
|
|
|
|
[models."llama-3.1-8b-instant".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "openai/gpt-oss-20b"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
[models."gpt-4o-mini"]
|
|
routing = ["openai", "openrouter"]
|
|
|
|
[models."gpt-4o-mini".providers.openai]
|
|
type = "openai"
|
|
model_name = "gpt-4o-mini"
|
|
api_key_location = "dynamic::relay_openai_api_key"
|
|
|
|
[models."gpt-4o-mini".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "openai/gpt-4o-mini"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
[models."gpt-4o"]
|
|
routing = ["openai", "openrouter"]
|
|
|
|
[models."gpt-4o".providers.openai]
|
|
type = "openai"
|
|
model_name = "gpt-4o"
|
|
api_key_location = "dynamic::relay_openai_api_key"
|
|
|
|
[models."gpt-4o".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "openai/gpt-4o"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
[models."claude-sonnet"]
|
|
routing = ["anthropic", "openrouter"]
|
|
|
|
[models."claude-sonnet".providers.anthropic]
|
|
type = "anthropic"
|
|
model_name = "claude-sonnet-4-5"
|
|
api_key_location = "dynamic::relay_anthropic_api_key"
|
|
|
|
[models."claude-sonnet".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "anthropic/claude-sonnet-4.5"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
# Named Claude routes (RY-RL2). Anthropic first on Claude credits, then the
|
|
# OpenRouter copy of the same model. `claude-sonnet` above stays Sonnet 4.5
|
|
# unchanged; callers opt into a newer model by switching the route name only.
|
|
# Each route is priced in config/catalog.json at the model's list price, so a
|
|
# request served by the OpenRouter leg is billed the same catalog price.
|
|
[models."claude-haiku"]
|
|
routing = ["anthropic", "openrouter"]
|
|
|
|
[models."claude-haiku".providers.anthropic]
|
|
type = "anthropic"
|
|
model_name = "claude-haiku-4-5"
|
|
api_key_location = "dynamic::relay_anthropic_api_key"
|
|
|
|
[models."claude-haiku".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "anthropic/claude-haiku-4.5"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
[models."claude-sonnet-5"]
|
|
routing = ["anthropic", "openrouter"]
|
|
|
|
[models."claude-sonnet-5".providers.anthropic]
|
|
type = "anthropic"
|
|
model_name = "claude-sonnet-5"
|
|
api_key_location = "dynamic::relay_anthropic_api_key"
|
|
|
|
[models."claude-sonnet-5".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "anthropic/claude-sonnet-5"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
# ┌────────────────────────────────────────────────────────────────────────────┐
|
|
# │ EMBEDDING MODELS │
|
|
# └────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
[embedding_models."text-embedding-3-small"]
|
|
routing = ["openai", "openrouter"]
|
|
|
|
[embedding_models."text-embedding-3-small".providers.openai]
|
|
type = "openai"
|
|
model_name = "text-embedding-3-small"
|
|
api_key_location = "dynamic::relay_openai_api_key"
|
|
|
|
[embedding_models."text-embedding-3-small".providers.openrouter]
|
|
type = "openrouter"
|
|
model_name = "openai/text-embedding-3-small"
|
|
api_key_location = "dynamic::relay_openrouter_api_key"
|
|
|
|
# ┌────────────────────────────────────────────────────────────────────────────┐
|
|
# │ FUNCTIONS │
|
|
# │ │
|
|
# │ Named entry points the gateway exposes over `/inference` (and the │
|
|
# │ passport-conditioned `/v1/passport/generate` surface). A function selects a │
|
|
# │ variant at runtime, so `relay-billing` requires an explicit operator price │
|
|
# │ per function (fail-closed): publish the retail price in `relay-catalog` │
|
|
# │ config for each `tensorzero::function_name::<name>` selector before enabling │
|
|
# │ billing, otherwise a metered request is rejected rather than mispriced. │
|
|
# └────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
# General-purpose chat entry point.
|
|
#
|
|
# COST-FIRST. `default` runs on Groq's free tier (OpenRouter failover inside the
|
|
# model). `openai` and `anthropic` have no `weight`, which makes them TensorZero
|
|
# fallback variants: they are tried only when the sampled variant fails (outage,
|
|
# exhausted retries, open circuit, or no Groq/OpenRouter key), so a Groq
|
|
# incident degrades to a paid provider only when that provider has a key.
|
|
# Billing is per function selector, so the retail price does not change.
|
|
[functions.chat]
|
|
type = "chat"
|
|
|
|
[functions.chat.variants.default]
|
|
type = "chat_completion"
|
|
model = "openai/gpt-oss-120b"
|
|
weight = 1.0
|
|
|
|
[functions.chat.variants.openai]
|
|
type = "chat_completion"
|
|
model = "gpt-4o-mini"
|
|
|
|
[functions.chat.variants.anthropic]
|
|
type = "chat_completion"
|
|
model = "claude-sonnet"
|
|
|
|
# Passport-conditioned TEXT generation (scripts, captions, hooks, brand-voice
|
|
# copy). This is the modality Relay can serve end-to-end today: the passport
|
|
# client assembles the resolved conditioning into the request input and the
|
|
# gateway runs it through a real provider model. `provider`/`modality` and the
|
|
# owning `passport_id` arrive as `tensorzero::tags::*` for provenance.
|
|
#
|
|
# PROVIDER ROUTING. The passport's `provider` field selects which model runs:
|
|
# the passport-relay-client pins the variant named for that provider via the
|
|
# inference request's `variant_name` (lowercased provider id). Pinning bypasses
|
|
# weighted sampling, so each provider deterministically maps to its own model,
|
|
# and a `provider` with no variant here is rejected with `UnknownVariant` —
|
|
# i.e. an unsupported text provider fails closed rather than silently running
|
|
# on the wrong model. To add a text provider, add its `[models.*]` entry above
|
|
# and a variant below whose name is the lowercased provider id.
|
|
#
|
|
# `groq` carries weight = 1.0 so a passport_text call that does NOT pin a
|
|
# variant resolves to the free Groq model (cost-first default). `openai` and
|
|
# `anthropic` have no weight: they are never sampled, stay reachable by explicit
|
|
# provider pin, and double as failover variants when the Groq variant fails.
|
|
# Billing prices are per function selector
|
|
# (`tensorzero::function_name::passport_text`), so every provider variant bills
|
|
# at the one operator-published passport_text price regardless of model.
|
|
[functions.passport_text]
|
|
type = "chat"
|
|
|
|
# provider = "groq" -> openai/gpt-oss-120b (also the unpinned default).
|
|
[functions.passport_text.variants.groq]
|
|
type = "chat_completion"
|
|
model = "openai/gpt-oss-120b"
|
|
weight = 1.0
|
|
|
|
# provider = "openai" -> gpt-4o-mini.
|
|
[functions.passport_text.variants.openai]
|
|
type = "chat_completion"
|
|
model = "gpt-4o-mini"
|
|
|
|
# provider = "anthropic" -> claude-sonnet.
|
|
[functions.passport_text.variants.anthropic]
|
|
type = "chat_completion"
|
|
model = "claude-sonnet"
|
|
|
|
# NON-TEXT MODALITIES (image / voice / video).
|
|
#
|
|
# The passport model targets asset providers (Veo, Runway, Kling, HeyGen,
|
|
# ElevenLabs, local LoRA, …). TensorZero-native providers speak the LLM
|
|
# chat/embeddings contract and do NOT drive those asset backends, so these
|
|
# functions are intentionally left UNWIRED rather than aliased to an LLM that
|
|
# would return text where an asset is expected. A request for one of these
|
|
# modalities fails closed (unknown function) until the owner adds a Relay
|
|
# provider adapter. Uncomment and point at a real adapter-backed model once the
|
|
# corresponding integration exists:
|
|
#
|
|
# [functions.passport_image]
|
|
# type = "chat"
|
|
# [functions.passport_image.variants.default]
|
|
# type = "chat_completion"
|
|
# model = "<image-provider-model>"
|
|
# weight = 1.0
|
|
#
|
|
# [functions.passport_voice]
|
|
# type = "chat"
|
|
# [functions.passport_voice.variants.default]
|
|
# type = "chat_completion"
|
|
# model = "<voice-provider-model>"
|
|
# weight = 1.0
|
|
#
|
|
# [functions.passport_video]
|
|
# type = "chat"
|
|
# [functions.passport_video.variants.default]
|
|
# type = "chat_completion"
|
|
# model = "<video-provider-model>"
|
|
# weight = 1.0
|