Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"pages": [
"features/aliases",
"features/user-path",
"features/cache"
"features/cache",
"features/failover"
]
},
{
Expand Down
71 changes: 71 additions & 0 deletions docs/features/failover.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: "Failover"
description: "Configure GoModel failover with manual rules, understand experimental auto mode, and know when fallback attempts run."
icon: "shuffle"
keywords: ["failover", "fallback"]
---

## Overview

GoModel exposes failover through the `fallback` config block.

When a request fails, GoModel can retry it against alternate models. For
predictable behavior, use manual mode.

## Manual Mode

Manual mode is the recommended mode today.

```yaml
fallback:
default_mode: "manual"
manual_rules_path: "config/fallback.json"
```

`config/fallback.json` is a JSON object where each model entry contains an
ordered candidate list (array); top-level keys are not ordered:

```json
{
"gpt-4o": [
"azure/gpt-4o",
"gemini/gemini-2.5-pro"
]
}
```

The order-sensitive part is the array under each model entry.

GoModel tries the listed candidates in order and stops on the first success.
Use bare model names like `gpt-4o` or provider-qualified selectors like
`azure/gpt-4o`.

If needed, you can override the mode per model with `fallback.overrides`.

## Auto Mode

<Note>
`auto` mode is experimental right now.
</Note>

```yaml
fallback:
default_mode: "auto"
manual_rules_path: "config/fallback.json"
```

Auto mode keeps any manual candidates first, then appends up to five extra
candidates from the current model registry. It prefers models with the same
request category, similar rankings, overlapping capabilities, and the same
family when possible.
Comment on lines +57 to +60
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Auto-mode category behavior is documented as a preference, but it is a filter.

Lines 55-56 say auto mode “prefers models with the same request category.” In implementation, candidates that do not support the required category are excluded before ranking, so this is effectively mandatory.

Proposed doc tweak
-Auto mode keeps any manual candidates first, then appends up to five extra
-candidates from the current model registry. It prefers models with the same
-request category, similar rankings, overlapping capabilities, and the same
-family when possible.
+Auto mode keeps any manual candidates first, then appends up to five extra
+candidates from the current model registry. Extra candidates must support the
+same request category, then are ranked by similarity in rankings, overlapping
+capabilities, and family preference when possible.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Auto mode keeps any manual candidates first, then appends up to five extra
candidates from the current model registry. It prefers models with the same
request category, similar rankings, overlapping capabilities, and the same
family when possible.
Auto mode keeps any manual candidates first, then appends up to five extra
candidates from the current model registry. Extra candidates must support the
same request category, then are ranked by similarity in rankings, overlapping
capabilities, and family preference when possible.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/features/failover.mdx` around lines 54 - 57, Update the wording in the
Auto mode description so it reflects that category matching is a hard filter
rather than a soft preference: change the sentence that currently reads “prefers
models with the same request category” to indicate candidates that do not
support the required category are excluded (e.g., “requires matching request
category” or “filters out models that don’t support the request category”) and
keep the rest of the sentence about ranking and family preference intact; target
the paragraph that begins “Auto mode keeps any manual candidates first…” and the
clause referencing “prefers models with the same request category.”


## When It Runs

Failover is attempted only after the primary request returns:

- `5xx`
- `429`
- model unavailable, unsupported, or not found style errors

It currently applies to translated `/v1/chat/completions` and `/v1/responses`
requests, not `/v1/embeddings`.
Loading