使用設定を構成する
curl --request POST \
--url https://server.codeium.com/api/v1/UsageConfig \
--header 'Content-Type: application/json' \
--data '
{
"service_key": "<string>",
"既存のアドオンのクレジット上限を消去するには `true` を設定します": true,
"新しいアドオンのクレジット上限を設定します(整数値)": 123,
"team_level": true,
"group_id": "<string>",
"user_email": "<string>"
}
'import requests
url = "https://server.codeium.com/api/v1/UsageConfig"
payload = {
"service_key": "<string>",
"既存のアドオンのクレジット上限を消去するには `true` を設定します": True,
"新しいアドオンのクレジット上限を設定します(整数値)": 123,
"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>',
'既存のアドオンのクレジット上限を消去するには `true` を設定します': true,
'新しいアドオンのクレジット上限を設定します(整数値)': 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>',
'既存のアドオンのクレジット上限を消去するには `true` を設定します' => true,
'新しいアドオンのクレジット上限を設定します(整数値)' => 123,
'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/UsageConfig"
payload := strings.NewReader("{\n \"service_key\": \"<string>\",\n \"既存のアドオンのクレジット上限を消去するには `true` を設定します\": true,\n \"新しいアドオンのクレジット上限を設定します(整数値)\": 123,\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/UsageConfig")
.header("Content-Type", "application/json")
.body("{\n \"service_key\": \"<string>\",\n \"既存のアドオンのクレジット上限を消去するには `true` を設定します\": true,\n \"新しいアドオンのクレジット上限を設定します(整数値)\": 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["Content-Type"] = 'application/json'
request.body = "{\n \"service_key\": \"<string>\",\n \"既存のアドオンのクレジット上限を消去するには `true` を設定します\": true,\n \"新しいアドオンのクレジット上限を設定します(整数値)\": 123,\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body利用状況 API
使用設定を構成する
Enterprise の請求管理のために、ユーザーごとのアドオンのクレジット利用上限を設定または解除し、それらをチーム、グループ、または個々のユーザーに適用できるようにする。
POST
/
api
/
v1
/
UsageConfig
使用設定を構成する
curl --request POST \
--url https://server.codeium.com/api/v1/UsageConfig \
--header 'Content-Type: application/json' \
--data '
{
"service_key": "<string>",
"既存のアドオンのクレジット上限を消去するには `true` を設定します": true,
"新しいアドオンのクレジット上限を設定します(整数値)": 123,
"team_level": true,
"group_id": "<string>",
"user_email": "<string>"
}
'import requests
url = "https://server.codeium.com/api/v1/UsageConfig"
payload = {
"service_key": "<string>",
"既存のアドオンのクレジット上限を消去するには `true` を設定します": True,
"新しいアドオンのクレジット上限を設定します(整数値)": 123,
"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>',
'既存のアドオンのクレジット上限を消去するには `true` を設定します': true,
'新しいアドオンのクレジット上限を設定します(整数値)': 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>',
'既存のアドオンのクレジット上限を消去するには `true` を設定します' => true,
'新しいアドオンのクレジット上限を設定します(整数値)' => 123,
'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/UsageConfig"
payload := strings.NewReader("{\n \"service_key\": \"<string>\",\n \"既存のアドオンのクレジット上限を消去するには `true` を設定します\": true,\n \"新しいアドオンのクレジット上限を設定します(整数値)\": 123,\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/UsageConfig")
.header("Content-Type", "application/json")
.body("{\n \"service_key\": \"<string>\",\n \"既存のアドオンのクレジット上限を消去するには `true` を設定します\": true,\n \"新しいアドオンのクレジット上限を設定します(整数値)\": 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["Content-Type"] = 'application/json'
request.body = "{\n \"service_key\": \"<string>\",\n \"既存のアドオンのクレジット上限を消去するには `true` を設定します\": true,\n \"新しいアドオンのクレジット上限を設定します(整数値)\": 123,\n \"team_level\": true,\n \"group_id\": \"<string>\",\n \"user_email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body概要
リクエスト
string
必須
“Billing Write” 権限を付与したサービスキー
クレジット上限の設定(いずれか一つを選択)
boolean
既存のアドオンのクレジット上限を消去するには
true を設定しますinteger
新しいアドオンのクレジット上限を設定します(整数値)
clear_add_on_credit_cap または set_add_on_credit_cap のいずれか一方のみを指定してください。両方を同時に指定することはできません。スコープ設定(いずれかを選択)
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",
"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_capとset_add_on_credit_capの両方が指定されているclear_add_on_credit_capもset_add_on_credit_capも指定されていない- scope パラメーターが複数指定されている
- scope パラメーターが指定されていない
- 無効なグループ ID またはユーザーのメールアドレス
- レート制限を超過
⌘I