Vichar Docs

Routing and failover

How requests pick a provider and what happens on errors.

Each vichar-* model can be served by more than one provider. For every request the gateway scores the eligible provider mappings for that model and picks the best healthy one, weighing provider stability, price, and whether the mapping supports the parameters you sent (tools, image input, structured outputs, and so on).

What happens on failure

  • If the chosen provider returns a retryable error (timeout, 429, 5xx) or the request fails before completing, the gateway retries on another provider serving the same model when one exists.
  • If no provider can serve the request, you get a gateway error (502/503) describing the failure.
  • x-no-fallback: true disables failover for the request; the first provider's error is returned as-is. Useful when debugging a specific provider mapping, which you can pin with a provider/model suffix on the model ID for mappings you have access to.

Provider access restrictions

Vichar can restrict which providers, models, or provider/model mappings your organization may use (for example, to honor a contract). Excluded mappings are skipped during routing and failover. A request pinned to an excluded mapping, or for a model with no permitted mapping left, fails with 403. Contact support to change the restriction.

Temporarily disabled providers

During an incident Vichar can temporarily disable a provider, a model, or a single provider/model mapping for all traffic. Disabled mappings are skipped during routing and failover; a request pinned to one, or for a model with nothing left to serve it, fails with 503, and /v1/models hides them until they are re-enabled.

Catalogue changes

Vichar's operators can add models and providers, or override a provider's price for a model, at runtime without a release. These mappings appear in /v1/models, route and fail over like any other, and are billed at the configured price. Temporarily disabling a provider or model applies to them too. Check /v1/models or Models for the current list and prices.

An operator-added provider is created from a template for its API style, so it does not have to be OpenAI-compatible. You still call it in the OpenAI format: the gateway translates each request, streamed or not, into the provider's style and reads usage back from it.

Operators can also delete any model or provider. A deleted model behaves as an unknown model (400 Unsupported model) and leaves /v1/models; a deleted provider is never routed to, so its models fail over to their other providers, and pinning it returns 400. Deletions can be restored at any time.

Session affinity

Requests carrying the same x-session-id header (sent automatically by many coding tools, or session_id / prompt_cache_key body fields) prefer the same provider when healthy, which improves provider-side cache hits.

Smart routing

auto/smart are meta-IDs that classify the request and route to one of your configured models. See Models for the default tiers and how to configure them.

How is this guide?

On this page