Router Configuration

Each provider family has its own router configuration. A router is not selected by ID. Start with the LLM, Embedding, or Parser ModelProviderHandle, then obtain that provider’s router.

llm_router = workspace.llm_provider().router()
embedding_router = workspace.embedding_provider().router()
parser_router = workspace.parser_provider().router()
llmRouter := workspace.LLMProvider().Router()
embeddingRouter := workspace.EmbeddingProvider().Router()
parserRouter := workspace.ParserProvider().Router()

Updating the LLM router does not update the Embedding or Parser router.

Read current configuration

info() / Info() returns ProviderRouterConfig:

Field

Type

Description

strategy

string

Current routing strategy

health_check_interval

integer

Health-check interval; units and valid range are server-defined

max_retries

integer

Maximum retry setting

session_affinity

boolean

Whether session affinity is enabled

current = llm_router.info()
print(
    current.strategy,
    current.health_check_interval,
    current.max_retries,
    current.session_affinity,
)
current, err := llmRouter.Info(ctx)
if err != nil {
    return err
}
fmt.Println(
    current.GetStrategy(),
    current.GetHealthCheckInterval(),
    current.GetMaxRetries(),
    current.GetSessionAffinity(),
)

The public type defines the fields, but it does not define the strategy enum, the unit of health_check_interval, or valid numeric ranges. Read existing configuration first and obtain allowed values from the current product UI or server API contract.

Update the router

Updates use functional options. Pass only fields that you intend to change:

updated = llm_router.update(
    sdk.with_router_strategy(router_strategy),
    sdk.with_router_max_retries(max_retries),
)
updated, err := llmRouter.Update(
    ctx,
    sdk.WithRouterStrategy(routerStrategy),
    sdk.WithRouterMaxRetries(maxRetries),
)
if err != nil {
    return err
}

The remaining public options are:

updated = llm_router.update(
    sdk.with_router_health_check_interval(health_check_interval),
    sdk.with_router_session_affinity(session_affinity),
)
updated, err := llmRouter.Update(
    ctx,
    sdk.WithRouterHealthCheckInterval(healthCheckInterval),
    sdk.WithRouterSessionAffinity(sessionAffinity),
)

The return value is the complete ProviderRouterConfig saved by the service. To avoid competing updates overwriting one another, read fresh state first and serialize router mutations within a provider family. Call info() / Info() again after the update to verify the stored result.

Operational boundaries

  • A router belongs to a provider family, not to an individual backend or endpoint.

  • The SDK exposes read and update operations; it does not expose router creation or deletion.

  • Increasing max_retries can multiply external requests, latency, and cost. Do not raise it without understanding server retry semantics.

  • Health checks call configured model services. Use an interval approved for the deployment to avoid unnecessary external traffic.

  • The public SDK does not define the affinity key, lifetime, or failover behavior behind session_affinity; do not infer those semantics from the field name.

  • Ensure that the provider has usable backends and endpoints before changing routing. The client does not validate the entire topology.

See Provider Configuration for selecting a provider and creating a backend, and Backends and Endpoints for resource and address management.