使用量設定を取得
curl --request POST \
--url https://server.codeium.com/api/v1/GetUsageConfig \
--header 'Authorization: Bearer <token>' \
--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 = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', '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 => [
"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://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("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.post("https://server.codeium.com/api/v1/GetUsageConfig")
.header("Authorization", "Bearer <token>")
.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["Authorization"] = 'Bearer <token>'
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
使用量設定を取得
Enterprise の請求管理向けに、チーム、グループ、または個別ユーザーのスコープで照会できる、ユーザーごとの追加クレジット上限設定を取得します。
POST
/
api
/
v1
/
GetUsageConfig
使用量設定を取得
curl --request POST \
--url https://server.codeium.com/api/v1/GetUsageConfig \
--header 'Authorization: Bearer <token>' \
--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 = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', '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 => [
"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://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("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.post("https://server.codeium.com/api/v1/GetUsageConfig")
.header("Authorization", "Bearer <token>")
.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["Authorization"] = 'Bearer <token>'
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
}概要
リクエスト
「Billing Read」権限を持つサービスキー
スコープ設定 (いずれか1つを選択)
チーム内のすべてのユーザーに適用されるユーザー単位の上限を取得するには、
true に設定します特定のグループ内のすべてのユーザーに適用されるユーザー単位の上限を取得するには、グループ ID を指定します
特定のユーザーの設定を取得するには、そのメールアドレスを指定します
スコープを定義するには、
team_level、group_id、user_email のいずれか1つを指定する必要があります。リクエスト例 - Team 内のすべてのユーザーのユーザーごとの上限を取得
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
レスポンス
設定済みのアドオンクレジット上限値です。レスポンスにこのフィールドが含まれていない場合、リクエストされたスコープレベルでは上限は設定されていません。
レスポンス例 - 上限が設定されている場合
{
"addOnCreditCap": 10000
}
レスポンス例 - 上限未設定
{}
エラーレスポンス
- 無効なサービスキー、または権限不足
- 複数の スコープ パラメータが指定されている
- スコープ パラメータが指定されていない
- 無効なグループ ID、またはユーザーのメールアドレス
- レート制限を超過している
⌘I

