curl --request PATCH \
--url https://api.langdock.com/billing/v1/bring-your-own-keys/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"usageRequestsEnabled": true,
"workspaceUsageLimit": {
"type": "limited",
"amount": 1
},
"monthlyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionLimitsEnabled": true,
"agentLimitBehavior": {
"fallbackModelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
'import requests
url = "https://api.langdock.com/billing/v1/bring-your-own-keys/settings"
payload = {
"usageRequestsEnabled": True,
"workspaceUsageLimit": {
"type": "limited",
"amount": 1
},
"monthlyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionLimitsEnabled": True,
"agentLimitBehavior": { "fallbackModelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
usageRequestsEnabled: true,
workspaceUsageLimit: {type: 'limited', amount: 1},
monthlyBudgetPerPlan: {
standard: {type: 'limited', amount: 1},
power_user: {type: 'limited', amount: 1}
},
sessionLimitsEnabled: true,
agentLimitBehavior: {fallbackModelId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}
})
};
fetch('https://api.langdock.com/billing/v1/bring-your-own-keys/settings', 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://api.langdock.com/billing/v1/bring-your-own-keys/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'usageRequestsEnabled' => true,
'workspaceUsageLimit' => [
'type' => 'limited',
'amount' => 1
],
'monthlyBudgetPerPlan' => [
'standard' => [
'type' => 'limited',
'amount' => 1
],
'power_user' => [
'type' => 'limited',
'amount' => 1
]
],
'sessionLimitsEnabled' => true,
'agentLimitBehavior' => [
'fallbackModelId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
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://api.langdock.com/billing/v1/bring-your-own-keys/settings"
payload := strings.NewReader("{\n \"usageRequestsEnabled\": true,\n \"workspaceUsageLimit\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"monthlyBudgetPerPlan\": {\n \"standard\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"power_user\": {\n \"type\": \"limited\",\n \"amount\": 1\n }\n },\n \"sessionLimitsEnabled\": true,\n \"agentLimitBehavior\": {\n \"fallbackModelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.langdock.com/billing/v1/bring-your-own-keys/settings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"usageRequestsEnabled\": true,\n \"workspaceUsageLimit\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"monthlyBudgetPerPlan\": {\n \"standard\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"power_user\": {\n \"type\": \"limited\",\n \"amount\": 1\n }\n },\n \"sessionLimitsEnabled\": true,\n \"agentLimitBehavior\": {\n \"fallbackModelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/billing/v1/bring-your-own-keys/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"usageRequestsEnabled\": true,\n \"workspaceUsageLimit\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"monthlyBudgetPerPlan\": {\n \"standard\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"power_user\": {\n \"type\": \"limited\",\n \"amount\": 1\n }\n },\n \"sessionLimitsEnabled\": true,\n \"agentLimitBehavior\": {\n \"fallbackModelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}"
response = http.request(request)
puts response.read_body{
"currency": "USD",
"usageRequestsEnabled": true,
"workspaceUsageLimit": {
"type": "limited",
"amount": 1
},
"monthlyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionLimitsEnabled": true,
"agentLimitBehavior": {
"forced": "switch_model",
"fallbackModelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"weeklyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"usagePeriod": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"usagePeriodSpend": 1
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "BILLING_MODE_MISMATCH",
"details": {
"mode": "ai-models-included"
}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}Update Workspace Settings
Change the workspace usage limit, plan budgets, usage requests, and agent limit behavior
curl --request PATCH \
--url https://api.langdock.com/billing/v1/bring-your-own-keys/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"usageRequestsEnabled": true,
"workspaceUsageLimit": {
"type": "limited",
"amount": 1
},
"monthlyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionLimitsEnabled": true,
"agentLimitBehavior": {
"fallbackModelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
'import requests
url = "https://api.langdock.com/billing/v1/bring-your-own-keys/settings"
payload = {
"usageRequestsEnabled": True,
"workspaceUsageLimit": {
"type": "limited",
"amount": 1
},
"monthlyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionLimitsEnabled": True,
"agentLimitBehavior": { "fallbackModelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
usageRequestsEnabled: true,
workspaceUsageLimit: {type: 'limited', amount: 1},
monthlyBudgetPerPlan: {
standard: {type: 'limited', amount: 1},
power_user: {type: 'limited', amount: 1}
},
sessionLimitsEnabled: true,
agentLimitBehavior: {fallbackModelId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}
})
};
fetch('https://api.langdock.com/billing/v1/bring-your-own-keys/settings', 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://api.langdock.com/billing/v1/bring-your-own-keys/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'usageRequestsEnabled' => true,
'workspaceUsageLimit' => [
'type' => 'limited',
'amount' => 1
],
'monthlyBudgetPerPlan' => [
'standard' => [
'type' => 'limited',
'amount' => 1
],
'power_user' => [
'type' => 'limited',
'amount' => 1
]
],
'sessionLimitsEnabled' => true,
'agentLimitBehavior' => [
'fallbackModelId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
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://api.langdock.com/billing/v1/bring-your-own-keys/settings"
payload := strings.NewReader("{\n \"usageRequestsEnabled\": true,\n \"workspaceUsageLimit\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"monthlyBudgetPerPlan\": {\n \"standard\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"power_user\": {\n \"type\": \"limited\",\n \"amount\": 1\n }\n },\n \"sessionLimitsEnabled\": true,\n \"agentLimitBehavior\": {\n \"fallbackModelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.langdock.com/billing/v1/bring-your-own-keys/settings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"usageRequestsEnabled\": true,\n \"workspaceUsageLimit\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"monthlyBudgetPerPlan\": {\n \"standard\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"power_user\": {\n \"type\": \"limited\",\n \"amount\": 1\n }\n },\n \"sessionLimitsEnabled\": true,\n \"agentLimitBehavior\": {\n \"fallbackModelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/billing/v1/bring-your-own-keys/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"usageRequestsEnabled\": true,\n \"workspaceUsageLimit\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"monthlyBudgetPerPlan\": {\n \"standard\": {\n \"type\": \"limited\",\n \"amount\": 1\n },\n \"power_user\": {\n \"type\": \"limited\",\n \"amount\": 1\n }\n },\n \"sessionLimitsEnabled\": true,\n \"agentLimitBehavior\": {\n \"fallbackModelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}"
response = http.request(request)
puts response.read_body{
"currency": "USD",
"usageRequestsEnabled": true,
"workspaceUsageLimit": {
"type": "limited",
"amount": 1
},
"monthlyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionLimitsEnabled": true,
"agentLimitBehavior": {
"forced": "switch_model",
"fallbackModelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"weeklyBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"sessionBudgetPerPlan": {
"standard": {
"type": "limited",
"amount": 1
},
"power_user": {
"type": "limited",
"amount": 1
}
},
"usagePeriod": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"usagePeriodSpend": 1
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}{
"message": "<string>",
"code": "BILLING_MODE_MISMATCH",
"details": {
"mode": "ai-models-included"
}
}{
"message": "<string>",
"code": "<string>",
"details": {}
}bring-your-own-keys. Amounts are US dollars.
The call uses the workspace API key’s BILLING_API scope. Writes run as the key’s service account owner.
Base URL
https://api.langdock.com/billing/v1/bring-your-own-keys/settings
api.langdock.com with <your-deployment-url>/api/public in all requests.Prerequisites
- API key with the
BILLING_APIscope - The key owner is a service account that has not been deleted and has an active Admin membership
Update settings
PATCH accepts usageRequestsEnabled, workspaceUsageLimit, monthlyBudgetPerPlan, sessionLimitsEnabled, and agentLimitBehavior. Send at least one of them. A plan you omit from monthlyBudgetPerPlan keeps its budget. Nested fields you omit from agentLimitBehavior stay as they are.
curl -X PATCH https://api.langdock.com/billing/v1/bring-your-own-keys/settings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"monthlyBudgetPerPlan":{"power_user":{"type":"limited","amount":120}}}'
GET, with usagePeriodSpend set to null. Read the settings again to get spend.
A limited workspaceUsageLimit must be greater than zero. A limited plan budget may be zero.
Authorizations
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
- Option 1
- Option 2
Show child attributes
Show child attributes
Omitted plans keep their current values.
Show child attributes
Show child attributes
Omitted fields keep their current values. The resulting switch_model configuration must have a valid fallback model.
Show child attributes
Show child attributes
Response
Updated resource. Spending is null; GET retrieves spending.
USD included and extra chat/agent usage; excludes workflow, API, and backbone-model usage. Weekly budgets are monthly / 4; session budgets are weekly / 3 and null when disabled. PATCH returns null spending; GET retrieves spending.
USD - Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Forcing switch_model requires a valid fallback model. null forced uses each agent setting. fallbackModelId is the configured override; null uses the workspace backbone fallback.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
x >= 0Was this page helpful?