curl --request PUT \
--url https://{host}/api/llm-gateway/admin/routing-policies/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"context_breakpoints": [
123
],
"default_slot_on_failure": 123,
"description": "<string>",
"determiner_model_alias": "<string>",
"determiner_prompt": "<string>",
"enabled": true,
"model_alias": "<string>",
"router_input_max_chars": 123,
"slots": [
{
"model_alias": "<string>",
"description": "<string>",
"label": "<string>"
}
]
}
'import requests
url = "https://{host}/api/llm-gateway/admin/routing-policies/{id}"
payload = {
"context_breakpoints": [123],
"default_slot_on_failure": 123,
"description": "<string>",
"determiner_model_alias": "<string>",
"determiner_prompt": "<string>",
"enabled": True,
"model_alias": "<string>",
"router_input_max_chars": 123,
"slots": [
{
"model_alias": "<string>",
"description": "<string>",
"label": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context_breakpoints: [123],
default_slot_on_failure: 123,
description: '<string>',
determiner_model_alias: '<string>',
determiner_prompt: '<string>',
enabled: true,
model_alias: '<string>',
router_input_max_chars: 123,
slots: [{model_alias: '<string>', description: '<string>', label: '<string>'}]
})
};
fetch('https://{host}/api/llm-gateway/admin/routing-policies/{id}', 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/routing-policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'context_breakpoints' => [
123
],
'default_slot_on_failure' => 123,
'description' => '<string>',
'determiner_model_alias' => '<string>',
'determiner_prompt' => '<string>',
'enabled' => true,
'model_alias' => '<string>',
'router_input_max_chars' => 123,
'slots' => [
[
'model_alias' => '<string>',
'description' => '<string>',
'label' => '<string>'
]
]
]),
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/routing-policies/{id}"
payload := strings.NewReader("{\n \"context_breakpoints\": [\n 123\n ],\n \"default_slot_on_failure\": 123,\n \"description\": \"<string>\",\n \"determiner_model_alias\": \"<string>\",\n \"determiner_prompt\": \"<string>\",\n \"enabled\": true,\n \"model_alias\": \"<string>\",\n \"router_input_max_chars\": 123,\n \"slots\": [\n {\n \"model_alias\": \"<string>\",\n \"description\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://{host}/api/llm-gateway/admin/routing-policies/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"context_breakpoints\": [\n 123\n ],\n \"default_slot_on_failure\": 123,\n \"description\": \"<string>\",\n \"determiner_model_alias\": \"<string>\",\n \"determiner_prompt\": \"<string>\",\n \"enabled\": true,\n \"model_alias\": \"<string>\",\n \"router_input_max_chars\": 123,\n \"slots\": [\n {\n \"model_alias\": \"<string>\",\n \"description\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/routing-policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context_breakpoints\": [\n 123\n ],\n \"default_slot_on_failure\": 123,\n \"description\": \"<string>\",\n \"determiner_model_alias\": \"<string>\",\n \"determiner_prompt\": \"<string>\",\n \"enabled\": true,\n \"model_alias\": \"<string>\",\n \"router_input_max_chars\": 123,\n \"slots\": [\n {\n \"model_alias\": \"<string>\",\n \"description\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"context_breakpoints": [
123
],
"created_at": "2023-11-07T05:31:56Z",
"default_slot_on_failure": 123,
"enabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "<string>",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"posture": "savings",
"router_input_max_chars": 123,
"slots": [
{
"model_alias": "<string>",
"description": "<string>",
"label": "<string>"
}
],
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"determiner_model_alias": "<string>",
"determiner_prompt": "<string>"
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}Update a routing policy
Updates a routing policy. Only the fields you send are changed; the merged result must still pass the same validation as a new policy.
curl --request PUT \
--url https://{host}/api/llm-gateway/admin/routing-policies/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"context_breakpoints": [
123
],
"default_slot_on_failure": 123,
"description": "<string>",
"determiner_model_alias": "<string>",
"determiner_prompt": "<string>",
"enabled": true,
"model_alias": "<string>",
"router_input_max_chars": 123,
"slots": [
{
"model_alias": "<string>",
"description": "<string>",
"label": "<string>"
}
]
}
'import requests
url = "https://{host}/api/llm-gateway/admin/routing-policies/{id}"
payload = {
"context_breakpoints": [123],
"default_slot_on_failure": 123,
"description": "<string>",
"determiner_model_alias": "<string>",
"determiner_prompt": "<string>",
"enabled": True,
"model_alias": "<string>",
"router_input_max_chars": 123,
"slots": [
{
"model_alias": "<string>",
"description": "<string>",
"label": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context_breakpoints: [123],
default_slot_on_failure: 123,
description: '<string>',
determiner_model_alias: '<string>',
determiner_prompt: '<string>',
enabled: true,
model_alias: '<string>',
router_input_max_chars: 123,
slots: [{model_alias: '<string>', description: '<string>', label: '<string>'}]
})
};
fetch('https://{host}/api/llm-gateway/admin/routing-policies/{id}', 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/routing-policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'context_breakpoints' => [
123
],
'default_slot_on_failure' => 123,
'description' => '<string>',
'determiner_model_alias' => '<string>',
'determiner_prompt' => '<string>',
'enabled' => true,
'model_alias' => '<string>',
'router_input_max_chars' => 123,
'slots' => [
[
'model_alias' => '<string>',
'description' => '<string>',
'label' => '<string>'
]
]
]),
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/routing-policies/{id}"
payload := strings.NewReader("{\n \"context_breakpoints\": [\n 123\n ],\n \"default_slot_on_failure\": 123,\n \"description\": \"<string>\",\n \"determiner_model_alias\": \"<string>\",\n \"determiner_prompt\": \"<string>\",\n \"enabled\": true,\n \"model_alias\": \"<string>\",\n \"router_input_max_chars\": 123,\n \"slots\": [\n {\n \"model_alias\": \"<string>\",\n \"description\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://{host}/api/llm-gateway/admin/routing-policies/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"context_breakpoints\": [\n 123\n ],\n \"default_slot_on_failure\": 123,\n \"description\": \"<string>\",\n \"determiner_model_alias\": \"<string>\",\n \"determiner_prompt\": \"<string>\",\n \"enabled\": true,\n \"model_alias\": \"<string>\",\n \"router_input_max_chars\": 123,\n \"slots\": [\n {\n \"model_alias\": \"<string>\",\n \"description\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/routing-policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context_breakpoints\": [\n 123\n ],\n \"default_slot_on_failure\": 123,\n \"description\": \"<string>\",\n \"determiner_model_alias\": \"<string>\",\n \"determiner_prompt\": \"<string>\",\n \"enabled\": true,\n \"model_alias\": \"<string>\",\n \"router_input_max_chars\": 123,\n \"slots\": [\n {\n \"model_alias\": \"<string>\",\n \"description\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"context_breakpoints": [
123
],
"created_at": "2023-11-07T05:31:56Z",
"default_slot_on_failure": 123,
"enabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_alias": "<string>",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"posture": "savings",
"router_input_max_chars": 123,
"slots": [
{
"model_alias": "<string>",
"description": "<string>",
"label": "<string>"
}
],
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"determiner_model_alias": "<string>",
"determiner_prompt": "<string>"
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}{
"error": {
"message": "retry_on_429_count must be between 0 and 10",
"type": "invalid_request_error"
}
}Authorizations
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.
Path Parameters
Record ID (UUID)
Body
Fields to change. Omitted fields are left unchanged.
New determiner model.
savings prefers the lighter slot when the choice is close, quality prefers the more capable one, and balanced (the default) leans neither way. Posture never overrides a routing rule or the caller's model access.
savings, balanced, quality Show child attributes
Show child attributes
Response
OK
A routing policy: a model alias that sends each request to one of its slots.
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].
Slot used when the determiner cannot make a choice. Defaults to 1.
The alias callers send in model to use this policy.
Which way the policy leans when the choice between slots is close.
savings, balanced, quality How many characters of the request the determiner reads. Defaults to 12000.
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.
Show child attributes
Show child attributes
The model that reads each request and picks a slot.
Optional replacement for the determiner's built-in instructions. The slot list and output format are always added by the gateway.