获取用量配置
curl --request POST \
--url https://server.codeium.com/api/v1/GetUsageConfig \
--header 'Content-Type: application/json' \
--data '
{
"service_key": "<string>",
"team_level": true,
"group_id": "<string>",
"user_email": "<string>"
}
'import requests
url = "https://server.codeium.com/api/v1/GetUsageConfig"
payload = {
"service_key": "<string>",
"team_level": True,
"group_id": "<string>",
"user_email": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
service_key: '<string>',
team_level: true,
group_id: '<string>',
user_email: '<string>'
})
};
fetch('https://server.codeium.com/api/v1/GetUsageConfig', 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://server.codeium.com/api/v1/GetUsageConfig",
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([
'service_key' => '<string>',
'team_level' => true,
'group_id' => '<string>',
'user_email' => '<string>'
]),
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://server.codeium.com/api/v1/GetUsageConfig"
payload := strings.NewReader("{\n \"service_key\": \"<string>\",\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://server.codeium.com/api/v1/GetUsageConfig")
.header("Content-Type", "application/json")
.body("{\n \"service_key\": \"<string>\",\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v1/GetUsageConfig")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_key\": \"<string>\",\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"addOnCreditCap": 123
}用量 API
获取用量配置
按用户检索附加额度用量上限配置,可按团队、组或单个用户范围查询,用于企业账单管理。
POST
/
api
/
v1
/
GetUsageConfig
获取用量配置
curl --request POST \
--url https://server.codeium.com/api/v1/GetUsageConfig \
--header 'Content-Type: application/json' \
--data '
{
"service_key": "<string>",
"team_level": true,
"group_id": "<string>",
"user_email": "<string>"
}
'import requests
url = "https://server.codeium.com/api/v1/GetUsageConfig"
payload = {
"service_key": "<string>",
"team_level": True,
"group_id": "<string>",
"user_email": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
service_key: '<string>',
team_level: true,
group_id: '<string>',
user_email: '<string>'
})
};
fetch('https://server.codeium.com/api/v1/GetUsageConfig', 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://server.codeium.com/api/v1/GetUsageConfig",
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([
'service_key' => '<string>',
'team_level' => true,
'group_id' => '<string>',
'user_email' => '<string>'
]),
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://server.codeium.com/api/v1/GetUsageConfig"
payload := strings.NewReader("{\n \"service_key\": \"<string>\",\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://server.codeium.com/api/v1/GetUsageConfig")
.header("Content-Type", "application/json")
.body("{\n \"service_key\": \"<string>\",\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v1/GetUsageConfig")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_key\": \"<string>\",\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"addOnCreditCap": 123
}概览
请求
string
必填
具有 “Billing Read” 权限的服务密钥
范围配置(任选其一)
boolean
将其设置为
true 以获取应用于该团队所有用户的每用户上限string
通过提供组 ID 获取应用于该组所有用户的每用户上限
string
通过提供用户的电子邮箱地址获取该用户的配置
必须在
team_level、group_id 或 user_email 中提供一个,以定义配置范围。示例请求 - 获取团队内所有用户的单用户额度上限
curl -X POST --header "Content-Type: application/json" \
--data '{
"service_key": "your_service_key_here",
"team_level": true
}' \
https://server.codeium.com/api/v1/GetUsageConfig
示例请求:获取某个组内所有用户的单用户配额上限
curl -X POST --header "Content-Type: application/json" \
--data '{
"service_key": "your_service_key_here",
"group_id": "engineering_team"
}' \
https://server.codeium.com/api/v1/GetUsageConfig
示例请求:获取用户配置
curl -X POST --header "Content-Type: application/json" \
--data '{
"service_key": "your_service_key_here",
"user_email": "user@example.com"
}' \
https://server.codeium.com/api/v1/GetUsageConfig
响应
integer
已配置的附加额度上限值。如果响应中不存在此字段,则表示在所请求的作用域级别未配置上限。
示例响应 - 已设置上限
{
"addOnCreditCap": 10000
}
示例响应 - 未设置上限
{}
错误响应
- 服务密钥无效或权限不足
- 提供了多个 scope 参数
- 未提供 scope 参数
- 群组 ID 或用户邮箱无效
- 超出速率限制
⌘I