メインコンテンツへスキップ
POST
/
api
/
v1
/
UsageConfig
使用量設定を指定
curl --request POST \
  --url https://server.codeium.com/api/v1/UsageConfig \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "service_key": "<string>",
  "clear_add_on_credit_cap": true,
  "set_add_on_credit_cap": 123,
  "team_level": true,
  "group_id": "<string>",
  "user_email": "<string>"
}
'
import requests

url = "https://server.codeium.com/api/v1/UsageConfig"

payload = {
"service_key": "<string>",
"clear_add_on_credit_cap": True,
"set_add_on_credit_cap": 123,
"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>',
clear_add_on_credit_cap: true,
set_add_on_credit_cap: 123,
team_level: true,
group_id: '<string>',
user_email: '<string>'
})
};

fetch('https://server.codeium.com/api/v1/UsageConfig', 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/UsageConfig",
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>',
'clear_add_on_credit_cap' => true,
'set_add_on_credit_cap' => 123,
'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/UsageConfig"

payload := strings.NewReader("{\n \"service_key\": \"<string>\",\n \"clear_add_on_credit_cap\": true,\n \"set_add_on_credit_cap\": 123,\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/UsageConfig")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"service_key\": \"<string>\",\n \"clear_add_on_credit_cap\": true,\n \"set_add_on_credit_cap\": 123,\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/UsageConfig")

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 \"clear_add_on_credit_cap\": true,\n \"set_add_on_credit_cap\": 123,\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body

概要

組織向けのアドオン クレジットについて、ユーザーごとの使用量上限を設定または解除します。上限は常にユーザー単位で適用されます。チームまたはグループをスコープとして指定した場合、上限はそのチームまたはグループ内の各ユーザーに個別に適用され、チームまたはグループ全体で共有される上限は設定されません。

リクエスト

service_key
string
必須
「Billing Write」権限を持つサービスキー

クレジット上限の設定 (いずれか 1 つを選択)

clear_add_on_credit_cap
boolean
既存の追加クレジット上限をクリアするには、true を設定します
set_add_on_credit_cap
integer
新しい追加クレジット上限を設定します (整数値)
clear_add_on_credit_cap または set_add_on_credit_cap のいずれか一方を指定する必要があります。両方を指定することはできません。

スコープの設定 (いずれか 1 つを選択)

team_level
boolean
チーム内のすべてのユーザーにユーザーごとの上限を適用するには、true に設定します
group_id
string
グループ ID を指定すると、特定のグループ内のすべてのユーザーにユーザーごとの上限が適用されます
user_email
string
メールアドレスを指定すると、特定のユーザーにこの設定が適用されます
スコープを定義するには、team_levelgroup_iduser_email のいずれか 1 つを指定する必要があります。

リクエスト例 - チーム 内のすべてのユーザーにユーザーごとのクレジット上限を設定する

curl -X POST --header "Content-Type: application/json" \
--data '{
  "service_key": "your_service_key_here",
  "set_add_on_credit_cap": 10000,
  "team_level": true
}' \
https://server.codeium.com/api/v1/UsageConfig

リクエスト例 - グループ内の全ユーザーに対してユーザーごとのクレジット上限を設定する

curl -X POST --header "Content-Type: application/json" \
--data '{
  "service_key": "your_service_key_here",
  "set_add_on_credit_cap": 5000,
  "group_id": "engineering_team"
}' \
https://server.codeium.com/api/v1/UsageConfig

リクエスト例 - ユーザーのクレジット上限を設定

curl -X POST --header "Content-Type: application/json" \
--data '{
  "service_key": "your_service_key_here",
  "set_add_on_credit_cap": 1000,
  "user_email": "user@example.com"
}' \
https://server.codeium.com/api/v1/UsageConfig

リクエスト例 - クレジット上限を解除

curl -X POST --header "Content-Type: application/json" \
--data '{
  "service_key": "your_service_key_here",
  "clear_add_on_credit_cap": true,
  "team_level": true
}' \
https://server.codeium.com/api/v1/UsageConfig

レスポンス

レスポンスボディは空です。200 ステータスコードは、操作が正常に完了したことを示します。

エラーレスポンス

一般的なエラーの例:
  • サービスキーが無効、または権限が不足している
  • clear_add_on_credit_capset_add_on_credit_cap の両方が指定されている
  • clear_add_on_credit_capset_add_on_credit_cap のどちらも指定されていない
  • 複数の スコープ パラメータが指定されている
  • スコープ パラメータが指定されていない
  • グループ ID またはユーザーのメールアドレスが無効
  • レート制限を超過している