Récupérer la configuration d’utilisation
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 d’utilisation
Récupérer la configuration d’utilisation
Récupérer la configuration du plafond de crédits additionnels par utilisateur, selon le périmètre du Team, du groupe ou de l’utilisateur individuel, pour la gestion de la facturation Enterprise.
POST
/
api
/
v1
/
GetUsageConfig
Récupérer la configuration d’utilisation
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
}Vue d’ensemble
Requête
string
requis
Votre clé de service avec l’autorisation « Billing Read »
Configuration du périmètre (choisissez une option)
boolean
Définissez cette valeur sur
true pour récupérer le plafond par utilisateur appliqué à tous les utilisateurs de la Teamstring
Récupérez le plafond par utilisateur appliqué à tous les utilisateurs d’un groupe spécifique en fournissant l’ID du groupe
string
Récupérez la configuration d’un utilisateur spécifique en fournissant son adresse e-mail
Vous devez fournir l’un de
team_level, group_id ou user_email pour définir le périmètre.Exemple de requête - Récupérer le plafond par utilisateur pour tous les utilisateurs de la 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
Exemple de requête - Récupérer le plafond par utilisateur pour l’ensemble des utilisateurs d’un groupe
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
Exemple de requête - Récupérer la configuration utilisateur
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
Réponse
integer
La valeur configurée du plafond de crédits additionnel. Si ce champ n’est pas présent dans la réponse, aucun plafond n’est configuré pour le niveau de périmètre demandé.
Exemple de réponse - Avec un plafond configuré
{
"addOnCreditCap": 10000
}
Exemple de réponse - Aucun plafond n’est configuré
{}
Réponses d’erreur
- Clé de service invalide ou autorisations insuffisantes
- Plusieurs paramètres de périmètre fournis
- Aucun paramètre de périmètre fourni
- ID de groupe ou adresse e-mail d’utilisateur invalide
- Limite de débit dépassée

