# Model Route

> > This page is auto-generated from the formations OpenAPI spec.
> Do not edit manually — run `pnpm generate-formations-resource-docs` to regenerate.

# Model Route

> This page is auto-generated from the formations OpenAPI spec.
> Do not edit manually — run `pnpm generate-formations-resource-docs` to regenerate.

Declares a model route within the formation's project: a named, ordered list of provider+model failover targets with retry and circuit-breaker configuration. Consumers reference it through their own `model_route_id`, or inherit it as the project's `default_model_route_id`.

## Syntax

```yaml
type: model_route
properties:
  name: String
  targets: Object[]
  retry_on: String[]
  failure_threshold: Integer
  cooldown_seconds: Integer
```

## Output

The physical resource ID is the **public ID** of the created resource. Reference it from other resources with a `ref` expression:

```yaml
      some_field:
        ref: MyModelRoute
```

## Properties

**`name`**

Route name, unique within the project

_Required_: Yes
_Type_: String

---

**`targets`**

Ordered failover targets, tried in array order. Each entry is `{ ai_provider_id, model, timeout_seconds?, max_retries? }`; every provider must belong to this project, and the total attempt budget (sum of `1 + max_retries`) is capped at 10.

_Required_: Yes
_Type_: Array of Object

---

**`retry_on`**

Which failure classes fail over: any of `provider_error`, `timeout`, `rate_limited`. Defaults to all three. Deterministic rejections (400-class, auth, content policy) never fail over.

_Required_: No
_Type_: Array of String

---

**`failure_threshold`**

Consecutive retryable failures before a target is skipped (default 3)

_Required_: No
_Type_: Integer
_Nullable_: Yes

---

**`cooldown_seconds`**

How long a tripped target is skipped before being probed again (default 60)

_Required_: No
_Type_: Integer
_Nullable_: Yes

---
