Skip to navigation

Routing

Pick a routing strategy and attach it to a Group or the organization

A routing policy picks the model and vendor for each request that sends default_routing as the model. Create policies on the Routing policies tab.

Routing strategies

StrategyHow it picks
PriorityThe highest-ranked model whose vendor is up, failing over on a timeout, throttle, or 5xx
Intelligent, Cost axisCheaper models for most prompts, capable ones for complex prompts (expected savings 40-60%)
Intelligent, Performance axisRoughly an even split between cheap and capable models (expected savings 20-35%)
Intelligent, Capability axisCapable models except for clearly simple prompts (expected savings 10-20%)

Client errors (400 to 404) never trigger failover.

Policies using other strategies are set in the Gateway console. They show Editable in Merge Gateway only on this tab.

Attach a policy to a Group or the organization

Each request uses, in order:

  1. The policy scoped to the employee’s Group
  2. The organization default
  3. No policy: the model named in the request

The Used by column shows All employees for the default, a Group name for a scoped policy, or Not used by any group. To change the default, choose Set as default from a policy’s row menu. An Inactive policy is never selected.

Model aliases

Each policy has an alias, @alias/<slug>, from its name. “Fast experiment” becomes @alias/fast-experiment, and the default is @alias/default. Send an alias as the model to use that policy, so employees can use different policies with the same key.

ANTHROPIC_BASE_URL=https://api-gateway.merge.dev/v1/anthropic
ANTHROPIC_MODEL=@alias/fast-experiment
  • Renaming a policy doesn’t change its alias. Changing the alias explicitly makes the old one return 404.
  • Deleting a policy deletes its alias
  • Aliases work on chat endpoints only, not embeddings, image, audio, or video

Route on request tags

Tag routing rules match request tags in priority order. The first match wins, and unmatched requests use the policy’s strategy. Configure them in the Gateway console.