POST /admin/api/quotas
curl --request POST \
--url https://api.example.com/admin/api/quotas \
--header 'Content-Type: application/json' \
--cookie gproxy_session= \
--data '
{
"limitValue": "<string>",
"metric": "<string>",
"ownerId": "<string>",
"ownerKind": "<string>",
"period": "<string>",
"unit": "<string>",
"anchorAtMs": null,
"enabled": null,
"id": null,
"modelPattern": null,
"periodSeconds": null,
"windowKey": null
}
'import requests
url = "https://api.example.com/admin/api/quotas"
payload = {
"limitValue": "<string>",
"metric": "<string>",
"ownerId": "<string>",
"ownerKind": "<string>",
"period": "<string>",
"unit": "<string>",
"anchorAtMs": None,
"enabled": None,
"id": None,
"modelPattern": None,
"periodSeconds": None,
"windowKey": None
}
headers = {
"cookie": "gproxy_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'gproxy_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
limitValue: '<string>',
metric: '<string>',
ownerId: '<string>',
ownerKind: '<string>',
period: '<string>',
unit: '<string>',
anchorAtMs: null,
enabled: null,
id: null,
modelPattern: null,
periodSeconds: null,
windowKey: null
})
};
fetch('https://api.example.com/admin/api/quotas', 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.example.com/admin/api/quotas",
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([
'limitValue' => '<string>',
'metric' => '<string>',
'ownerId' => '<string>',
'ownerKind' => '<string>',
'period' => '<string>',
'unit' => '<string>',
'anchorAtMs' => null,
'enabled' => null,
'id' => null,
'modelPattern' => null,
'periodSeconds' => null,
'windowKey' => null
]),
CURLOPT_COOKIE => "gproxy_session=",
CURLOPT_HTTPHEADER => [
"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.example.com/admin/api/quotas"
payload := strings.NewReader("{\n \"limitValue\": \"<string>\",\n \"metric\": \"<string>\",\n \"ownerId\": \"<string>\",\n \"ownerKind\": \"<string>\",\n \"period\": \"<string>\",\n \"unit\": \"<string>\",\n \"anchorAtMs\": null,\n \"enabled\": null,\n \"id\": null,\n \"modelPattern\": null,\n \"periodSeconds\": null,\n \"windowKey\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "gproxy_session=")
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://api.example.com/admin/api/quotas")
.header("cookie", "gproxy_session=")
.header("Content-Type", "application/json")
.body("{\n \"limitValue\": \"<string>\",\n \"metric\": \"<string>\",\n \"ownerId\": \"<string>\",\n \"ownerKind\": \"<string>\",\n \"period\": \"<string>\",\n \"unit\": \"<string>\",\n \"anchorAtMs\": null,\n \"enabled\": null,\n \"id\": null,\n \"modelPattern\": null,\n \"periodSeconds\": null,\n \"windowKey\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/admin/api/quotas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'gproxy_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"limitValue\": \"<string>\",\n \"metric\": \"<string>\",\n \"ownerId\": \"<string>\",\n \"ownerKind\": \"<string>\",\n \"period\": \"<string>\",\n \"unit\": \"<string>\",\n \"anchorAtMs\": null,\n \"enabled\": null,\n \"id\": null,\n \"modelPattern\": null,\n \"periodSeconds\": null,\n \"windowKey\": null\n}"
response = http.request(request)
puts response.read_body{
"anchorAtMs": 123,
"enabled": true,
"id": "<string>",
"limitValue": "<string>",
"metric": "<string>",
"modelPattern": "<string>",
"ownerId": "<string>",
"ownerKind": "<string>",
"period": "<string>",
"periodSeconds": 123,
"unit": "<string>",
"windowKey": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Management
POST /admin/api/quotas
POST
/
admin
/
api
/
quotas
POST /admin/api/quotas
curl --request POST \
--url https://api.example.com/admin/api/quotas \
--header 'Content-Type: application/json' \
--cookie gproxy_session= \
--data '
{
"limitValue": "<string>",
"metric": "<string>",
"ownerId": "<string>",
"ownerKind": "<string>",
"period": "<string>",
"unit": "<string>",
"anchorAtMs": null,
"enabled": null,
"id": null,
"modelPattern": null,
"periodSeconds": null,
"windowKey": null
}
'import requests
url = "https://api.example.com/admin/api/quotas"
payload = {
"limitValue": "<string>",
"metric": "<string>",
"ownerId": "<string>",
"ownerKind": "<string>",
"period": "<string>",
"unit": "<string>",
"anchorAtMs": None,
"enabled": None,
"id": None,
"modelPattern": None,
"periodSeconds": None,
"windowKey": None
}
headers = {
"cookie": "gproxy_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'gproxy_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
limitValue: '<string>',
metric: '<string>',
ownerId: '<string>',
ownerKind: '<string>',
period: '<string>',
unit: '<string>',
anchorAtMs: null,
enabled: null,
id: null,
modelPattern: null,
periodSeconds: null,
windowKey: null
})
};
fetch('https://api.example.com/admin/api/quotas', 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.example.com/admin/api/quotas",
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([
'limitValue' => '<string>',
'metric' => '<string>',
'ownerId' => '<string>',
'ownerKind' => '<string>',
'period' => '<string>',
'unit' => '<string>',
'anchorAtMs' => null,
'enabled' => null,
'id' => null,
'modelPattern' => null,
'periodSeconds' => null,
'windowKey' => null
]),
CURLOPT_COOKIE => "gproxy_session=",
CURLOPT_HTTPHEADER => [
"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.example.com/admin/api/quotas"
payload := strings.NewReader("{\n \"limitValue\": \"<string>\",\n \"metric\": \"<string>\",\n \"ownerId\": \"<string>\",\n \"ownerKind\": \"<string>\",\n \"period\": \"<string>\",\n \"unit\": \"<string>\",\n \"anchorAtMs\": null,\n \"enabled\": null,\n \"id\": null,\n \"modelPattern\": null,\n \"periodSeconds\": null,\n \"windowKey\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "gproxy_session=")
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://api.example.com/admin/api/quotas")
.header("cookie", "gproxy_session=")
.header("Content-Type", "application/json")
.body("{\n \"limitValue\": \"<string>\",\n \"metric\": \"<string>\",\n \"ownerId\": \"<string>\",\n \"ownerKind\": \"<string>\",\n \"period\": \"<string>\",\n \"unit\": \"<string>\",\n \"anchorAtMs\": null,\n \"enabled\": null,\n \"id\": null,\n \"modelPattern\": null,\n \"periodSeconds\": null,\n \"windowKey\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/admin/api/quotas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'gproxy_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"limitValue\": \"<string>\",\n \"metric\": \"<string>\",\n \"ownerId\": \"<string>\",\n \"ownerKind\": \"<string>\",\n \"period\": \"<string>\",\n \"unit\": \"<string>\",\n \"anchorAtMs\": null,\n \"enabled\": null,\n \"id\": null,\n \"modelPattern\": null,\n \"periodSeconds\": null,\n \"windowKey\": null\n}"
response = http.request(request)
puts response.read_body{
"anchorAtMs": 123,
"enabled": true,
"id": "<string>",
"limitValue": "<string>",
"metric": "<string>",
"modelPattern": "<string>",
"ownerId": "<string>",
"ownerKind": "<string>",
"period": "<string>",
"periodSeconds": 123,
"unit": "<string>",
"windowKey": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}授权
consoleSessionbeareranthropicKeygoogleKey
请求头
Administrative scope selected by the caller.
请求体
application/json
响应
Success
One configured budget or operator limit. owner_kind is a free string:
user, api_key, team, org and pool are caller budgets the host
names per request, while credential and provider are operator limits on
upstream accounts. Both live in one table because both are windows over a
metric.
cost for a budget; requests or cost for a limit.
A */? glob over the upstream model name; absent covers everything.
5h, 1d, 7d, 1m, total, or anything with period_seconds.
USD for cost, count for requests.
Stable key within the owner, e.g. primary.