Create or replace an end user's execution policy
curl --request PUT \
--url https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"budgetCredits": "<string>",
"maxChargeCredits": "<string>",
"allowProviders": [
"<string>"
],
"denyProviders": [
"<string>"
],
"allowEndpoints": [
"<string>"
],
"denyEndpoints": [
"<string>"
],
"allowModels": [
"<string>"
],
"denyModels": [
"<string>"
],
"maxConcurrentReservations": 500000,
"maxCallsPerPeriod": 500000,
"maxCallsPerLoop": 500000
}
'import requests
url = "https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy"
payload = {
"budgetCredits": "<string>",
"maxChargeCredits": "<string>",
"allowProviders": ["<string>"],
"denyProviders": ["<string>"],
"allowEndpoints": ["<string>"],
"denyEndpoints": ["<string>"],
"allowModels": ["<string>"],
"denyModels": ["<string>"],
"maxConcurrentReservations": 500000,
"maxCallsPerPeriod": 500000,
"maxCallsPerLoop": 500000
}
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({
budgetCredits: '<string>',
maxChargeCredits: '<string>',
allowProviders: ['<string>'],
denyProviders: ['<string>'],
allowEndpoints: ['<string>'],
denyEndpoints: ['<string>'],
allowModels: ['<string>'],
denyModels: ['<string>'],
maxConcurrentReservations: 500000,
maxCallsPerPeriod: 500000,
maxCallsPerLoop: 500000
})
};
fetch('https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy', 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.paywithlocus.com/api/credits/end-users/{externalUserId}/policy",
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([
'budgetCredits' => '<string>',
'maxChargeCredits' => '<string>',
'allowProviders' => [
'<string>'
],
'denyProviders' => [
'<string>'
],
'allowEndpoints' => [
'<string>'
],
'denyEndpoints' => [
'<string>'
],
'allowModels' => [
'<string>'
],
'denyModels' => [
'<string>'
],
'maxConcurrentReservations' => 500000,
'maxCallsPerPeriod' => 500000,
'maxCallsPerLoop' => 500000
]),
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.paywithlocus.com/api/credits/end-users/{externalUserId}/policy"
payload := strings.NewReader("{\n \"budgetCredits\": \"<string>\",\n \"maxChargeCredits\": \"<string>\",\n \"allowProviders\": [\n \"<string>\"\n ],\n \"denyProviders\": [\n \"<string>\"\n ],\n \"allowEndpoints\": [\n \"<string>\"\n ],\n \"denyEndpoints\": [\n \"<string>\"\n ],\n \"allowModels\": [\n \"<string>\"\n ],\n \"denyModels\": [\n \"<string>\"\n ],\n \"maxConcurrentReservations\": 500000,\n \"maxCallsPerPeriod\": 500000,\n \"maxCallsPerLoop\": 500000\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://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"budgetCredits\": \"<string>\",\n \"maxChargeCredits\": \"<string>\",\n \"allowProviders\": [\n \"<string>\"\n ],\n \"denyProviders\": [\n \"<string>\"\n ],\n \"allowEndpoints\": [\n \"<string>\"\n ],\n \"denyEndpoints\": [\n \"<string>\"\n ],\n \"allowModels\": [\n \"<string>\"\n ],\n \"denyModels\": [\n \"<string>\"\n ],\n \"maxConcurrentReservations\": 500000,\n \"maxCallsPerPeriod\": 500000,\n \"maxCallsPerLoop\": 500000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy")
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 \"budgetCredits\": \"<string>\",\n \"maxChargeCredits\": \"<string>\",\n \"allowProviders\": [\n \"<string>\"\n ],\n \"denyProviders\": [\n \"<string>\"\n ],\n \"allowEndpoints\": [\n \"<string>\"\n ],\n \"denyEndpoints\": [\n \"<string>\"\n ],\n \"allowModels\": [\n \"<string>\"\n ],\n \"denyModels\": [\n \"<string>\"\n ],\n \"maxConcurrentReservations\": 500000,\n \"maxCallsPerPeriod\": 500000,\n \"maxCallsPerLoop\": 500000\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"externalUserId": "<string>",
"policy": {
"mode": "ask",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"activeReservations": 1,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"budgetPeriod": "hour",
"budgetCredits": "<string>",
"maxChargeCredits": "<string>",
"allowProviders": [
"<string>"
],
"denyProviders": [
"<string>"
],
"allowEndpoints": [
"<string>"
],
"denyEndpoints": [
"<string>"
],
"allowModels": [
"<string>"
],
"denyModels": [
"<string>"
],
"maxConcurrentReservations": 500000,
"maxCallsPerPeriod": 500000,
"maxCallsPerLoop": 500000
}
}End users
Create or replace an end user's execution policy
Workspace owner/admin session or a secret key with tokens:manage. Admission, counters, the credit hold, and the reservation commit atomically. Amounts use the tenant’s exact credit denomination.
PUT
/
credits
/
end-users
/
{externalUserId}
/
policy
Create or replace an end user's execution policy
curl --request PUT \
--url https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"budgetCredits": "<string>",
"maxChargeCredits": "<string>",
"allowProviders": [
"<string>"
],
"denyProviders": [
"<string>"
],
"allowEndpoints": [
"<string>"
],
"denyEndpoints": [
"<string>"
],
"allowModels": [
"<string>"
],
"denyModels": [
"<string>"
],
"maxConcurrentReservations": 500000,
"maxCallsPerPeriod": 500000,
"maxCallsPerLoop": 500000
}
'import requests
url = "https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy"
payload = {
"budgetCredits": "<string>",
"maxChargeCredits": "<string>",
"allowProviders": ["<string>"],
"denyProviders": ["<string>"],
"allowEndpoints": ["<string>"],
"denyEndpoints": ["<string>"],
"allowModels": ["<string>"],
"denyModels": ["<string>"],
"maxConcurrentReservations": 500000,
"maxCallsPerPeriod": 500000,
"maxCallsPerLoop": 500000
}
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({
budgetCredits: '<string>',
maxChargeCredits: '<string>',
allowProviders: ['<string>'],
denyProviders: ['<string>'],
allowEndpoints: ['<string>'],
denyEndpoints: ['<string>'],
allowModels: ['<string>'],
denyModels: ['<string>'],
maxConcurrentReservations: 500000,
maxCallsPerPeriod: 500000,
maxCallsPerLoop: 500000
})
};
fetch('https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy', 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.paywithlocus.com/api/credits/end-users/{externalUserId}/policy",
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([
'budgetCredits' => '<string>',
'maxChargeCredits' => '<string>',
'allowProviders' => [
'<string>'
],
'denyProviders' => [
'<string>'
],
'allowEndpoints' => [
'<string>'
],
'denyEndpoints' => [
'<string>'
],
'allowModels' => [
'<string>'
],
'denyModels' => [
'<string>'
],
'maxConcurrentReservations' => 500000,
'maxCallsPerPeriod' => 500000,
'maxCallsPerLoop' => 500000
]),
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.paywithlocus.com/api/credits/end-users/{externalUserId}/policy"
payload := strings.NewReader("{\n \"budgetCredits\": \"<string>\",\n \"maxChargeCredits\": \"<string>\",\n \"allowProviders\": [\n \"<string>\"\n ],\n \"denyProviders\": [\n \"<string>\"\n ],\n \"allowEndpoints\": [\n \"<string>\"\n ],\n \"denyEndpoints\": [\n \"<string>\"\n ],\n \"allowModels\": [\n \"<string>\"\n ],\n \"denyModels\": [\n \"<string>\"\n ],\n \"maxConcurrentReservations\": 500000,\n \"maxCallsPerPeriod\": 500000,\n \"maxCallsPerLoop\": 500000\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://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"budgetCredits\": \"<string>\",\n \"maxChargeCredits\": \"<string>\",\n \"allowProviders\": [\n \"<string>\"\n ],\n \"denyProviders\": [\n \"<string>\"\n ],\n \"allowEndpoints\": [\n \"<string>\"\n ],\n \"denyEndpoints\": [\n \"<string>\"\n ],\n \"allowModels\": [\n \"<string>\"\n ],\n \"denyModels\": [\n \"<string>\"\n ],\n \"maxConcurrentReservations\": 500000,\n \"maxCallsPerPeriod\": 500000,\n \"maxCallsPerLoop\": 500000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/policy")
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 \"budgetCredits\": \"<string>\",\n \"maxChargeCredits\": \"<string>\",\n \"allowProviders\": [\n \"<string>\"\n ],\n \"denyProviders\": [\n \"<string>\"\n ],\n \"allowEndpoints\": [\n \"<string>\"\n ],\n \"denyEndpoints\": [\n \"<string>\"\n ],\n \"allowModels\": [\n \"<string>\"\n ],\n \"denyModels\": [\n \"<string>\"\n ],\n \"maxConcurrentReservations\": 500000,\n \"maxCallsPerPeriod\": 500000,\n \"maxCallsPerLoop\": 500000\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"externalUserId": "<string>",
"policy": {
"mode": "ask",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"activeReservations": 1,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"budgetPeriod": "hour",
"budgetCredits": "<string>",
"maxChargeCredits": "<string>",
"allowProviders": [
"<string>"
],
"denyProviders": [
"<string>"
],
"allowEndpoints": [
"<string>"
],
"denyEndpoints": [
"<string>"
],
"allowModels": [
"<string>"
],
"denyModels": [
"<string>"
],
"maxConcurrentReservations": 500000,
"maxCallsPerPeriod": 500000,
"maxCallsPerLoop": 500000
}
}Authorizations
dashboardSessionsecretKey
Locus Pro dashboard session (Cognito).
Path Parameters
Case-sensitive immutable ID in the tenant namespace. Prefer an identity-provider subject, not an email address.
Required string length:
1 - 200Pattern:
^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,199}$Body
application/json
Available options:
ask, bounded, unlimited Available options:
hour, day, week, month, null Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
Pattern:
^\d+(?:\.\d{1,6})?$Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
Pattern:
^\d+(?:\.\d{1,6})?$Maximum array length:
200Maximum array length:
200Maximum array length:
200provider/endpoint
Maximum array length:
200provider/endpoint
Maximum array length:
200Maximum array length:
200Required range:
1 <= x <= 1000000Required range:
1 <= x <= 1000000Required range:
1 <= x <= 1000000Response
Policy applied