Skip to main content
POST
Create a routing policy

Authorizations

Authorization
string
header
required

An access token from Barndoor's identity provider, sent as Authorization: Bearer <token>. Use a service-account token from the OAuth 2.0 client-credentials grant for scripts and CI, or a signed-in user's token. The caller needs the admin role in the organization. Gateway API keys (bd-...) are not accepted here.

Body

application/json
model_alias
string
required

The alias callers send in model to use this policy. Cannot be one of the slots or the determiner.

slots
object[]
required

At least two slots, in order from the lightest to the most capable model.

context_breakpoints
integer<int32>[]

One fewer entry than slots, positive and strictly increasing. Defaults to [128000, 512000], which fits three slots; send your own for any other slot count.

default_slot_on_failure
integer<int32>

Slot used when the determiner cannot make a choice. Must be a valid slot number. Defaults to 1.

description
string | null
determiner_model_alias
string | null

The model that reads each request and picks a slot. Required.

determiner_prompt
string | null

Optional replacement for the determiner's built-in instructions, up to 8,000 characters.

enabled
boolean

Defaults to true.

posture
enum<string>

Defaults to balanced.

Available options:
savings,
balanced,
quality
router_input_max_chars
integer<int32>

How many characters of the request the determiner reads. Defaults to 12000.

Response

Created

A routing policy: a model alias that sends each request to one of its slots.

context_breakpoints
integer<int32>[]
required

Prompt sizes, in tokens, that set a minimum slot for very large requests. There is one fewer entry than slots, in strictly increasing order. Defaults to [128000, 512000].

created_at
string<date-time>
required
default_slot_on_failure
integer<int32>
required

Slot used when the determiner cannot make a choice. Defaults to 1.

enabled
boolean
required
id
string<uuid>
required
model_alias
string
required

The alias callers send in model to use this policy.

org_id
string<uuid>
required
posture
enum<string>
required

Which way the policy leans when the choice between slots is close.

Available options:
savings,
balanced,
quality
router_input_max_chars
integer<int32>
required

How many characters of the request the determiner reads. Defaults to 12000.

slots
object[]
required

The models the policy chooses between, in order from the lightest to the most capable. Slot numbers elsewhere are 0-based positions in this list.

updated_at
string<date-time>
required
description
string | null
determiner_model_alias
string | null

The model that reads each request and picks a slot.

determiner_prompt
string | null

Optional replacement for the determiner's built-in instructions. The slot list and output format are always added by the gateway.