Add a fallback array when you create the stream. Moon monitors live p95 latency per model and switches to the next entry when the current one crosses the budget you set.
await moon.chat.stream({ model: "claude-sonnet-5", fallback: ["claude-haiku-4-5", "gpt-4.2-mini"], budget_ms: 800 })
The switch is transparent to the client. Traces label which model actually served each request under the served_by field, so you can see the fallback rate in the Overview dashboard.
Moon supports fallbacks. Pass a list of models and Moon will use the first one that responds under your latency threshold:
moon.chat.stream({ model: "gpt-4.2-mini", fallback: ["claude-haiku-4-5"], budget_ms: 800 })
Each fallback attempt is recorded in the trace with timing. If every model in the chain exceeds the budget, the response returns from the fastest available at the moment the budget expired