For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Logo
Resources
Log inGet a demo
GuidesAPI reference
GuidesAPI reference
    • Get started
    • Install skills
  • Features
    • Projects
    • Cost governance and savings
      • Overview
      • Using policies
      • Single provider
      • Priority
      • Performance
      • Intelligent
      • Build Your Own Router
    • Tool calling
    • Web search
    • Context compression
  • Security & Compliance
    • Customer blocklist
    • Geo-location routing
    • Prompt injection protection
    • Data loss prevention
    • Audit trail
    • Roles and permissions
    • Zero data retention
    • Provider terms

Get started

  • Overview
  • Introduction
  • Unified API
  • Linked Account
  • Merge Link
  • Use cases

Implementation

  • Sandboxes
  • SDKs
  • API access
  • Syncing data
  • Writing data
  • Data minimization
  • Supplemental data
  • Errors
  • Integration metadata

API reference

  • ATS
  • HRIS
  • Accounting
  • Ticketing
  • CRM
  • File Storage
  • Knowledge Base
  • Chat

Resources

  • Help Center
  • Merge.dev
  • Changelog
© Merge 2026Terms of usePrivacy policy
UnifiedAgent HandlerGateway
UnifiedAgent HandlerGateway
Resources
Log inGet a demo
On this page
  • How it works
  • Benchmark sources
  • Score overrides
  • Configuring BYOR
  • 1. Build your benchmark library
  • 2. Attach BYOR to a routing policy
  • Required permissions
  • FAQ
  • Next steps
FeaturesRouting policies

Build Your Own Router

Score-based routing that picks models against benchmarks you choose, with your own scores or evals

Was this page helpful?
Previous

Intelligent routing

Next

Multimodal

Build Your Own Router (BYOR) routes each request to the model with the highest score across a weighted blend of benchmarks you choose. Use it when the right model for your workload depends on evaluation criteria you measure, not on a generic cost or quality tier.

BYOR is configured entirely in the dashboard. There are no BYOR-specific fields you pass in individual POST /responses requests.


How it works

At request time, Gateway scores each eligible model with a weighted sum across the benchmarks in your configuration:

weighted_score = Σ (weight_b × score_b)

Weights you set in the dashboard must sum to 1.0. The model with the highest score wins.

Benchmarks tagged with a capability (for example “code”, “math”, “tool-use”) get a capability boost when Gateway’s prompt classifier detects that capability on the inbound request. The matched benchmark counts for more in the weighted sum, so a request that looks like code routes against your code-quality benchmarks more strongly.

If no model qualifies, Gateway routes to your configured fallback model. If there’s no fallback, the request fails.


Benchmark sources

You can mix three kinds of benchmarks in a single configuration. They all live in Configuration → Benchmarks in the dashboard.

SourceHow scores are producedWhen to use
PublishedMerge-maintained benchmark library, read-onlyYou want a quick start with well-known benchmarks like HumanEval or MMLU
Run evalsEval pipeline grades each model against a dataset of your prompts using a judge config (LLM model and traits or a custom rubric)You have prompts that represent your real workload and want scores grounded in them
Upload your ownYou paste a JSON map of {model_id: raw_score} and pick a scale (0-1, 0-10, 0-100)You already ran evals offline, or you have internal quality data you want to use directly

For eval-based and uploaded benchmarks, Gateway normalizes raw scores to the [0, 1] range before they enter the weighted sum, so a benchmark on a 0-100 scale combines cleanly with one on 0-10.

In the dashboard, Published benchmarks appear under Published benchmarks and the ones you create appear under Your benchmarks.


Score overrides

A score override is a per-cell fix on top of a benchmark. Use one when an upstream score for a single model on a single benchmark is wrong (or out of date) and you want to correct it without re-uploading the whole benchmark.

Overrides work on both Published and custom benchmarks. They’re stored separately and applied at routing time on top of the underlying value, so deleting the override restores the original score. Set or remove overrides from the pencil icon on each benchmark row in the BYOR config editor.


Configuring BYOR

Two steps, both in the dashboard:

1. Build your benchmark library

Open Configuration → Benchmarks. Published benchmarks appear under Published benchmarks; anything you’ve created appears under Your benchmarks. Click Define benchmark to add a new one, then pick how you want to populate it:

  • Run evals. Select a dataset (your own prompts or the prompt library), pick a capability tag, choose a judge model and rubric, and queue the run. Gateway grades each candidate model and saves the results as a benchmark.
  • Upload your own. Paste a JSON map of model scores, pick the scoring scale, and tag the benchmark with a capability. Gateway normalizes the scores.

2. Attach BYOR to a routing policy

Open Configuration → Routing and create or edit a policy. Pick Build Your Own Router as the strategy type, then either select a saved configuration from the Saved configs dropdown or pick New configuration to build one inline. The editor lets you:

  • Set a name and optional description
  • Add benchmarks and assign each a weight (use the Normalize to 100% button to balance them out)
  • Pick a fallback model
  • Turn on Auto-eval on new model so Gateway runs evals automatically when a new model is released into your routing pool

Save the policy and BYOR takes effect on the next request.


Required permissions

Creating, editing, or deleting BYOR configurations requires the Manage Build Your Own Router permission. Reading them requires View Build Your Own Router. Both are included in the Admin and Developer system roles by default. See Roles and permissions for the full matrix.


FAQ

Can I mix Published and custom benchmarks in the same configuration?

Yes. A BYOR configuration is a weighted blend across any benchmarks you select, regardless of source. The weights are what control influence, not the source.

What happens if no model qualifies at request time?

Gateway routes to your configured fallback model if one is set and eligible. If no fallback is configured, the request fails.

How is BYOR different from Intelligent routing?

Intelligent routing uses Gateway’s complexity classifier to pick a model tier per request. BYOR uses your weighted benchmark scores. Intelligent is the right pick when you want sensible defaults out of the box; BYOR is the right pick when you have evaluation criteria specific to your workload.

Can I update model scores without re-uploading the entire benchmark?

Yes, use a score override. Overrides are per-(benchmark, model) and stack on top of the underlying score. Delete the override to restore the original.

Will new models be scored automatically?

Only if you turn on Auto-eval on new model in the BYOR configuration. With it on, Gateway runs the configuration’s eval-derived benchmarks against any new model added to your routing pool. Published and uploaded benchmarks are not auto-extended; you’ll need to upload scores for new models or run evals.


Next steps

Routing policies overview

Compare BYOR with Priority and Intelligent

Intelligent routing

Tier-based routing driven by Gateway’s complexity classifier

Using routing policies

How Gateway resolves which policy applies to each request