Create or update a gateway budget
curl --request PUT \
--url https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"manifest": {
"type": "tenant-budget-config",
"name": "<string>",
"limits": {
"cost_per_day": 123,
"cost_per_week": 123,
"cost_per_month": 123,
"cost_per_quarter": 123,
"cost_per_lifetime": 123
},
"applies_to": {
"type": "aggregate"
},
"mode": "enforce",
"when": {
"subjects": {
"users": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"teams": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"virtual_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
}
},
"models": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"provider_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"metadata": {}
}
},
"dryRun": false
}
'import requests
url = "https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets"
payload = {
"manifest": {
"type": "tenant-budget-config",
"name": "<string>",
"limits": {
"cost_per_day": 123,
"cost_per_week": 123,
"cost_per_month": 123,
"cost_per_quarter": 123,
"cost_per_lifetime": 123
},
"applies_to": { "type": "aggregate" },
"mode": "enforce",
"when": {
"subjects": {
"users": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"teams": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"virtual_accounts": {
"in": ["<string>"],
"not_in": ["<string>"]
}
},
"models": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"provider_accounts": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"metadata": {}
}
},
"dryRun": False
}
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({
manifest: {
type: 'tenant-budget-config',
name: '<string>',
limits: {
cost_per_day: 123,
cost_per_week: 123,
cost_per_month: 123,
cost_per_quarter: 123,
cost_per_lifetime: 123
},
applies_to: {type: 'aggregate'},
mode: 'enforce',
when: {
subjects: {
users: {in: ['<string>'], not_in: ['<string>']},
teams: {in: ['<string>'], not_in: ['<string>']},
virtual_accounts: {in: ['<string>'], not_in: ['<string>']}
},
models: {in: ['<string>'], not_in: ['<string>']},
provider_accounts: {in: ['<string>'], not_in: ['<string>']},
metadata: {}
}
},
dryRun: false
})
};
fetch('https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets', 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://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets",
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([
'manifest' => [
'type' => 'tenant-budget-config',
'name' => '<string>',
'limits' => [
'cost_per_day' => 123,
'cost_per_week' => 123,
'cost_per_month' => 123,
'cost_per_quarter' => 123,
'cost_per_lifetime' => 123
],
'applies_to' => [
'type' => 'aggregate'
],
'mode' => 'enforce',
'when' => [
'subjects' => [
'users' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'teams' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'virtual_accounts' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
]
],
'models' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'provider_accounts' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'metadata' => [
]
]
],
'dryRun' => false
]),
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://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets"
payload := strings.NewReader("{\n \"manifest\": {\n \"type\": \"tenant-budget-config\",\n \"name\": \"<string>\",\n \"limits\": {\n \"cost_per_day\": 123,\n \"cost_per_week\": 123,\n \"cost_per_month\": 123,\n \"cost_per_quarter\": 123,\n \"cost_per_lifetime\": 123\n },\n \"applies_to\": {\n \"type\": \"aggregate\"\n },\n \"mode\": \"enforce\",\n \"when\": {\n \"subjects\": {\n \"users\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"teams\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"virtual_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n }\n },\n \"models\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"provider_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"metadata\": {}\n }\n },\n \"dryRun\": false\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://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"manifest\": {\n \"type\": \"tenant-budget-config\",\n \"name\": \"<string>\",\n \"limits\": {\n \"cost_per_day\": 123,\n \"cost_per_week\": 123,\n \"cost_per_month\": 123,\n \"cost_per_quarter\": 123,\n \"cost_per_lifetime\": 123\n },\n \"applies_to\": {\n \"type\": \"aggregate\"\n },\n \"mode\": \"enforce\",\n \"when\": {\n \"subjects\": {\n \"users\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"teams\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"virtual_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n }\n },\n \"models\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"provider_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"metadata\": {}\n }\n },\n \"dryRun\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets")
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 \"manifest\": {\n \"type\": \"tenant-budget-config\",\n \"name\": \"<string>\",\n \"limits\": {\n \"cost_per_day\": 123,\n \"cost_per_week\": 123,\n \"cost_per_month\": 123,\n \"cost_per_quarter\": 123,\n \"cost_per_lifetime\": 123\n },\n \"applies_to\": {\n \"type\": \"aggregate\"\n },\n \"mode\": \"enforce\",\n \"when\": {\n \"subjects\": {\n \"users\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"teams\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"virtual_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n }\n },\n \"models\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"provider_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"metadata\": {}\n }\n },\n \"dryRun\": false\n}"
response = http.request(request)
puts response.read_body{
"tenantName": "<string>",
"name": "<string>",
"type": "<string>",
"manifest": {
"type": "tenant-budget-config",
"name": "<string>",
"limits": {
"cost_per_day": 123,
"cost_per_week": 123,
"cost_per_month": 123,
"cost_per_quarter": 123,
"cost_per_lifetime": 123
},
"applies_to": {
"type": "aggregate"
},
"mode": "enforce",
"when": {
"subjects": {
"users": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"teams": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"virtual_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
}
},
"models": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"provider_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"metadata": {}
},
"alerts": {
"thresholds": [
75,
90,
95,
100
],
"notification_target": [
{
"type": "email",
"notification_channel": "<string>",
"to_emails": [
"<string>"
]
}
]
}
},
"createdBySubject": {
"subjectId": "<string>",
"subjectSlug": "<string>",
"subjectDisplayName": "<string>",
"subjectPatName": "<string>",
"subjectControllerName": "<string>",
"subjectExternalIdentitySlug": "<string>"
},
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}LLM Gateway Budgets
Create or update a gateway budget
Creates or updates a budget manifest for the tenant. Budgets are upserted by manifest.name (unique per tenant).
PUT
/
api
/
svc
/
v1
/
llm-gateway
/
budgets
Create or update a gateway budget
curl --request PUT \
--url https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"manifest": {
"type": "tenant-budget-config",
"name": "<string>",
"limits": {
"cost_per_day": 123,
"cost_per_week": 123,
"cost_per_month": 123,
"cost_per_quarter": 123,
"cost_per_lifetime": 123
},
"applies_to": {
"type": "aggregate"
},
"mode": "enforce",
"when": {
"subjects": {
"users": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"teams": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"virtual_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
}
},
"models": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"provider_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"metadata": {}
}
},
"dryRun": false
}
'import requests
url = "https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets"
payload = {
"manifest": {
"type": "tenant-budget-config",
"name": "<string>",
"limits": {
"cost_per_day": 123,
"cost_per_week": 123,
"cost_per_month": 123,
"cost_per_quarter": 123,
"cost_per_lifetime": 123
},
"applies_to": { "type": "aggregate" },
"mode": "enforce",
"when": {
"subjects": {
"users": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"teams": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"virtual_accounts": {
"in": ["<string>"],
"not_in": ["<string>"]
}
},
"models": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"provider_accounts": {
"in": ["<string>"],
"not_in": ["<string>"]
},
"metadata": {}
}
},
"dryRun": False
}
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({
manifest: {
type: 'tenant-budget-config',
name: '<string>',
limits: {
cost_per_day: 123,
cost_per_week: 123,
cost_per_month: 123,
cost_per_quarter: 123,
cost_per_lifetime: 123
},
applies_to: {type: 'aggregate'},
mode: 'enforce',
when: {
subjects: {
users: {in: ['<string>'], not_in: ['<string>']},
teams: {in: ['<string>'], not_in: ['<string>']},
virtual_accounts: {in: ['<string>'], not_in: ['<string>']}
},
models: {in: ['<string>'], not_in: ['<string>']},
provider_accounts: {in: ['<string>'], not_in: ['<string>']},
metadata: {}
}
},
dryRun: false
})
};
fetch('https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets', 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://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets",
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([
'manifest' => [
'type' => 'tenant-budget-config',
'name' => '<string>',
'limits' => [
'cost_per_day' => 123,
'cost_per_week' => 123,
'cost_per_month' => 123,
'cost_per_quarter' => 123,
'cost_per_lifetime' => 123
],
'applies_to' => [
'type' => 'aggregate'
],
'mode' => 'enforce',
'when' => [
'subjects' => [
'users' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'teams' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'virtual_accounts' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
]
],
'models' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'provider_accounts' => [
'in' => [
'<string>'
],
'not_in' => [
'<string>'
]
],
'metadata' => [
]
]
],
'dryRun' => false
]),
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://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets"
payload := strings.NewReader("{\n \"manifest\": {\n \"type\": \"tenant-budget-config\",\n \"name\": \"<string>\",\n \"limits\": {\n \"cost_per_day\": 123,\n \"cost_per_week\": 123,\n \"cost_per_month\": 123,\n \"cost_per_quarter\": 123,\n \"cost_per_lifetime\": 123\n },\n \"applies_to\": {\n \"type\": \"aggregate\"\n },\n \"mode\": \"enforce\",\n \"when\": {\n \"subjects\": {\n \"users\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"teams\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"virtual_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n }\n },\n \"models\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"provider_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"metadata\": {}\n }\n },\n \"dryRun\": false\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://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"manifest\": {\n \"type\": \"tenant-budget-config\",\n \"name\": \"<string>\",\n \"limits\": {\n \"cost_per_day\": 123,\n \"cost_per_week\": 123,\n \"cost_per_month\": 123,\n \"cost_per_quarter\": 123,\n \"cost_per_lifetime\": 123\n },\n \"applies_to\": {\n \"type\": \"aggregate\"\n },\n \"mode\": \"enforce\",\n \"when\": {\n \"subjects\": {\n \"users\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"teams\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"virtual_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n }\n },\n \"models\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"provider_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"metadata\": {}\n }\n },\n \"dryRun\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{controlPlaneURL}/api/svc/v1/llm-gateway/budgets")
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 \"manifest\": {\n \"type\": \"tenant-budget-config\",\n \"name\": \"<string>\",\n \"limits\": {\n \"cost_per_day\": 123,\n \"cost_per_week\": 123,\n \"cost_per_month\": 123,\n \"cost_per_quarter\": 123,\n \"cost_per_lifetime\": 123\n },\n \"applies_to\": {\n \"type\": \"aggregate\"\n },\n \"mode\": \"enforce\",\n \"when\": {\n \"subjects\": {\n \"users\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"teams\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"virtual_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n }\n },\n \"models\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"provider_accounts\": {\n \"in\": [\n \"<string>\"\n ],\n \"not_in\": [\n \"<string>\"\n ]\n },\n \"metadata\": {}\n }\n },\n \"dryRun\": false\n}"
response = http.request(request)
puts response.read_body{
"tenantName": "<string>",
"name": "<string>",
"type": "<string>",
"manifest": {
"type": "tenant-budget-config",
"name": "<string>",
"limits": {
"cost_per_day": 123,
"cost_per_week": 123,
"cost_per_month": 123,
"cost_per_quarter": 123,
"cost_per_lifetime": 123
},
"applies_to": {
"type": "aggregate"
},
"mode": "enforce",
"when": {
"subjects": {
"users": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"teams": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"virtual_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
}
},
"models": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"provider_accounts": {
"in": [
"<string>"
],
"not_in": [
"<string>"
]
},
"metadata": {}
},
"alerts": {
"thresholds": [
75,
90,
95,
100
],
"notification_target": [
{
"type": "email",
"notification_channel": "<string>",
"to_emails": [
"<string>"
]
}
]
}
},
"createdBySubject": {
"subjectId": "<string>",
"subjectSlug": "<string>",
"subjectDisplayName": "<string>",
"subjectPatName": "<string>",
"subjectControllerName": "<string>",
"subjectExternalIdentitySlug": "<string>"
},
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
The created or updated budget.
Tenant the budget belongs to.
Budget name (unique per tenant).
Budget type (tenant-budget-config | team-budget-config).
The budget manifest.
- TenantBudgetConfig
- TeamBudgetConfig
Show child attributes
Show child attributes
Principal that created or last updated this budget.
Show child attributes
Show child attributes
System-generated Budget ID.
Creation timestamp.
Last-update timestamp.
Was this page helpful?
⌘I