enroute

Routing

One client, one request shape. enroute picks a model and can fall through a list when a provider is unavailable.

Import Enroute and Message. Pass a primary model and an optional models fallback list. The hosted gateway bills the workspace wallet at the upstream list price.

from enroute import Enroute, Message

client = Enroute()  # ENROUTE_API_KEY
response = client.chat(
    model="openai/gpt-5.6-luna",
    messages=[Message(role="user", content="Summarize this trace")],
    models=["anthropic/claude-sonnet-5", "google/gemini-3.7-flash"],
    temperature=0.2,
    max_tokens=400,
)
print(response.model, response.provider, response.text)

ChatRequest and ChatResponse are the typed request and result. Streaming uses the same fields with stream=True on the client or stream: true on POST /v1/chat/completions.

Optional per-request budget and retry settings live on the client: max_cost_usd and max_retries. A routing policy can be passed as policy= when you construct Enroute.