curl --request POST \
--url https://{host}/api/llm-gateway/admin/model-mappings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "<string>",
"upstream_model": "<string>",
"enabled": true,
"priority": 0,
"retry_on_429_count": 0,
"retry_on_429_max_wait_secs": 0,
"bare_alias": true,
"stream_idle_timeout_secs": 900,
"max_concurrent_requests": 5000,
"request_timeout_secs": 1800
}
'import requests
url = "https://{host}/api/llm-gateway/admin/model-mappings"
payload = {
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "<string>",
"upstream_model": "<string>",
"enabled": True,
"priority": 0,
"retry_on_429_count": 0,
"retry_on_429_max_wait_secs": 0,
"bare_alias": True,
"stream_idle_timeout_secs": 900,
"max_concurrent_requests": 5000,
"request_timeout_secs": 1800
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_alias: '<string>',
upstream_model: '<string>',
enabled: true,
priority: 0,
retry_on_429_count: 0,
retry_on_429_max_wait_secs: 0,
bare_alias: true,
stream_idle_timeout_secs: 900,
max_concurrent_requests: 5000,
request_timeout_secs: 1800
})
};
fetch('https://{host}/api/llm-gateway/admin/model-mappings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/llm-gateway/admin/model-mappings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'model_alias' => '<string>',
'upstream_model' => '<string>',
'enabled' => true,
'priority' => 0,
'retry_on_429_count' => 0,
'retry_on_429_max_wait_secs' => 0,
'bare_alias' => true,
'stream_idle_timeout_secs' => 900,
'max_concurrent_requests' => 5000,
'request_timeout_secs' => 1800
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/llm-gateway/admin/model-mappings"
payload := strings.NewReader("{\n \"provider_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_alias\": \"<string>\",\n \"upstream_model\": \"<string>\",\n \"enabled\": true,\n \"priority\": 0,\n \"retry_on_429_count\": 0,\n \"retry_on_429_max_wait_secs\": 0,\n \"bare_alias\": true,\n \"stream_idle_timeout_secs\": 900,\n \"max_concurrent_requests\": 5000,\n \"request_timeout_secs\": 1800\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/llm-gateway/admin/model-mappings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_alias\": \"<string>\",\n \"upstream_model\": \"<string>\",\n \"enabled\": true,\n \"priority\": 0,\n \"retry_on_429_count\": 0,\n \"retry_on_429_max_wait_secs\": 0,\n \"bare_alias\": true,\n \"stream_idle_timeout_secs\": 900,\n \"max_concurrent_requests\": 5000,\n \"request_timeout_secs\": 1800\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/model-mappings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_alias\": \"<string>\",\n \"upstream_model\": \"<string>\",\n \"enabled\": true,\n \"priority\": 0,\n \"retry_on_429_count\": 0,\n \"retry_on_429_max_wait_secs\": 0,\n \"bare_alias\": true,\n \"stream_idle_timeout_secs\": 900,\n \"max_concurrent_requests\": 5000,\n \"request_timeout_secs\": 1800\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "gpt-4o-mini",
"upstream_model": "gpt-4o-mini-2024-07-18",
"enabled": true,
"priority": 123,
"retry_on_429_count": 5,
"retry_on_429_max_wait_secs": 90,
"bare_alias": true,
"provider_name": "<string>",
"stream_idle_timeout_secs": 900,
"max_concurrent_requests": 5000,
"request_timeout_secs": 1800,
"budget_status": {
"scope": "org",
"target_kind": "llm_provider",
"target_id": "<string>",
"budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"budget_name": "<string>",
"period": "monthly",
"usage": 123,
"limit": 123
}
}{
"error": "BadRequest",
"message": "request_timeout_secs must be between 1 and 3600"
}Create a Model Route
Creates a model route. A 1:1 enablement (model_alias == upstream_model)
for an existing provider/model pair will fold into the existing row
rather than failing — this lets you re-issue the same create call
idempotently from automation.
curl --request POST \
--url https://{host}/api/llm-gateway/admin/model-mappings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "<string>",
"upstream_model": "<string>",
"enabled": true,
"priority": 0,
"retry_on_429_count": 0,
"retry_on_429_max_wait_secs": 0,
"bare_alias": true,
"stream_idle_timeout_secs": 900,
"max_concurrent_requests": 5000,
"request_timeout_secs": 1800
}
'import requests
url = "https://{host}/api/llm-gateway/admin/model-mappings"
payload = {
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "<string>",
"upstream_model": "<string>",
"enabled": True,
"priority": 0,
"retry_on_429_count": 0,
"retry_on_429_max_wait_secs": 0,
"bare_alias": True,
"stream_idle_timeout_secs": 900,
"max_concurrent_requests": 5000,
"request_timeout_secs": 1800
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_alias: '<string>',
upstream_model: '<string>',
enabled: true,
priority: 0,
retry_on_429_count: 0,
retry_on_429_max_wait_secs: 0,
bare_alias: true,
stream_idle_timeout_secs: 900,
max_concurrent_requests: 5000,
request_timeout_secs: 1800
})
};
fetch('https://{host}/api/llm-gateway/admin/model-mappings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/llm-gateway/admin/model-mappings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'model_alias' => '<string>',
'upstream_model' => '<string>',
'enabled' => true,
'priority' => 0,
'retry_on_429_count' => 0,
'retry_on_429_max_wait_secs' => 0,
'bare_alias' => true,
'stream_idle_timeout_secs' => 900,
'max_concurrent_requests' => 5000,
'request_timeout_secs' => 1800
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/llm-gateway/admin/model-mappings"
payload := strings.NewReader("{\n \"provider_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_alias\": \"<string>\",\n \"upstream_model\": \"<string>\",\n \"enabled\": true,\n \"priority\": 0,\n \"retry_on_429_count\": 0,\n \"retry_on_429_max_wait_secs\": 0,\n \"bare_alias\": true,\n \"stream_idle_timeout_secs\": 900,\n \"max_concurrent_requests\": 5000,\n \"request_timeout_secs\": 1800\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/llm-gateway/admin/model-mappings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_alias\": \"<string>\",\n \"upstream_model\": \"<string>\",\n \"enabled\": true,\n \"priority\": 0,\n \"retry_on_429_count\": 0,\n \"retry_on_429_max_wait_secs\": 0,\n \"bare_alias\": true,\n \"stream_idle_timeout_secs\": 900,\n \"max_concurrent_requests\": 5000,\n \"request_timeout_secs\": 1800\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/model-mappings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_alias\": \"<string>\",\n \"upstream_model\": \"<string>\",\n \"enabled\": true,\n \"priority\": 0,\n \"retry_on_429_count\": 0,\n \"retry_on_429_max_wait_secs\": 0,\n \"bare_alias\": true,\n \"stream_idle_timeout_secs\": 900,\n \"max_concurrent_requests\": 5000,\n \"request_timeout_secs\": 1800\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "gpt-4o-mini",
"upstream_model": "gpt-4o-mini-2024-07-18",
"enabled": true,
"priority": 123,
"retry_on_429_count": 5,
"retry_on_429_max_wait_secs": 90,
"bare_alias": true,
"provider_name": "<string>",
"stream_idle_timeout_secs": 900,
"max_concurrent_requests": 5000,
"request_timeout_secs": 1800,
"budget_status": {
"scope": "org",
"target_kind": "llm_provider",
"target_id": "<string>",
"budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"budget_name": "<string>",
"period": "monthly",
"usage": 123,
"limit": 123
}
}{
"error": "BadRequest",
"message": "request_timeout_secs must be between 1 and 3600"
}model_alias — the gateway tries
them in priority order (lowest first) and fails over to the next on
upstream errors.
Two kinds of routes
- 1:1 enablement (
model_alias == upstream_model) — exposes the upstream model under its own name, addressable as<provider>/<upstream_model>. Defaults tobare_alias: false. Re-issuing this call for an existing enablement folds into the existing row, making it idempotent. - Custom alias (
model_alias != upstream_model) — exposes the model under a friendly alias (e.g.team-coding-model). Defaults tobare_alias: trueso callers can use the plain name inmodel. Requires an existing 1:1 enablement on the same(provider, upstream_model)pair.
Example: an alias with failover
The simplest production setup is one alias backed by a primary route plus one or more failover routes:# Route 1: primary (priority 0)
curl -X POST https://app.barndoor.ai/api/llm-gateway/admin/model-mappings \
-H "Authorization: Bearer $BARNDOOR_JWT" \
-H "Content-Type: application/json" \
-d '{
"provider_id": "<openai-provider-id>",
"model_alias": "claude-opus-4-8",
"upstream_model": "claude-opus-4-8",
"priority": 0,
"bare_alias": true
}'
# Route 2: failover on Bedrock (priority 1)
curl -X POST https://app.barndoor.ai/api/llm-gateway/admin/model-mappings \
-H "Authorization: Bearer $BARNDOOR_JWT" \
-H "Content-Type: application/json" \
-d '{
"provider_id": "<bedrock-provider-id>",
"model_alias": "claude-opus-4-8",
"upstream_model": "us.anthropic.claude-opus-4-8",
"priority": 1,
"bare_alias": true
}'
Authorizations
JWT obtained through Barndoor's authentication flow. Pass the token
verbatim in Authorization: Bearer <token>. Use the Barndoor SDK's
loginInteractive() helper to obtain a token in scripts and notebooks.
Body
0 <= x <= 100 <= x <= 180Whether the route participates in bare-alias resolution. Defaults
to true for custom aliases (where model_alias != upstream_model)
and false for 1:1 enablement rows.
1 <= x <= 18001 <= x <= 100001 <= x <= 3600Response
The newly created or updated route
A Model Route maps a client-facing alias to a specific provider and
upstream model. One alias may have multiple routes; the gateway tries
them in priority order and fails over on upstream errors.
"gpt-4o-mini"
"gpt-4o-mini-2024-07-18"
Lower numbers are tried first within the same alias
Same-route retries on upstream 429 before failing over
0 <= x <= 10Cap on honoring upstream Retry-After (0 = use small built-in default)
0 <= x <= 180When true the route participates in plain-alias resolution
(e.g. model: "gpt-4o-mini"). When false it is only
addressable as <provider>/<upstream-model>.
Present on cross-provider listings
1 <= x <= 1800Cap on in-flight requests per gateway pod against this route
1 <= x <= 100001 <= x <= 3600Present (and only present) when one of this route's targeted budgets
with action_on_exhaust = block is currently exhausted. The
runtime drops this route until the budget rolls over.
Show child attributes
Show child attributes