Skip to main content
Pass an ordered models array and enable fallbacks. NinjaChat first tries the strongest eligible rail for the first model, then advances safely when a provider or model cannot serve the request.
You are billed only for the successful execution. Failed infrastructure attempts do not become customer usage.

Parameters

If every candidate fails before producing output you get 502 all_providers_failed and are not charged; if no candidate is currently servable under your routing policy you get 503 no_eligible_model. With stream: true the connection is already open (the gateway commits the 200 and starts sending : keepalive comments as soon as your request is admitted), so the same failure arrives as an in-band error frame — data: {"error": {"code": "all_providers_failed", ...}} followed by data: [DONE] — exactly as a mid-stream failure would. Billing: metered usage comes from the successful resolved model and provider shown in the response.
Fallbacks protect reliability. Use Smart routing when you also want the router to choose the model class.