Imposta la configurazione dell'utilizzo
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_bodyAPI di utilizzo
Imposta la configurazione dell'utilizzo
Imposta o rimuovi i limiti dei crediti aggiuntivi per utente, con la possibilità di applicarli a un team, un gruppo o un singolo utente per la gestione della fatturazione Enterprise.
POST
/
api
/
v1
/
UsageConfig
Imposta la configurazione dell'utilizzo
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_bodyPanoramica
Imposta o rimuovi i limiti di utilizzo per utente sui crediti aggiuntivi della tua organizzazione. I limiti vengono sempre applicati per singolo utente. Quando specifichi un ambito relativo a un team o gruppo, il limite viene applicato singolarmente a ciascun utente all’interno di quel team o gruppo; non imposta un limite condiviso per l’intero team o gruppo.Richiesta
Configurazione del limite di credito (scegline una)
Devi specificare
clear_add_on_credit_cap oppure set_add_on_credit_cap, ma non entrambi.Configurazione dell’ambito (Scegline una)
Applica il limite per utente a tutti gli utenti di un gruppo specifico fornendo l’ID del gruppo
Devi fornire uno tra
team_level, group_id o user_email per definire l’ambito.Esempio di richiesta - Imposta un limite di credito per utente per tutti gli utenti del team
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
Esempio di richiesta - Imposta il limite di credito per ciascun utente per tutti gli utenti di un gruppo
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
Esempio di richiesta - Impostare il limite di credito per un utente
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
Esempio di richiesta - Rimozione del limite di credito
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
Risposta
Il corpo della risposta è vuoto. Un codice di stato200 indica che l’operazione è andata a buon fine.
Risposte di errore
Scenari di errore comuni:- Chiave di servizio non valida o autorizzazioni insufficienti
- Sono stati forniti sia
clear_add_on_credit_capsiaset_add_on_credit_cap - Non è stato fornito né
clear_add_on_credit_capnéset_add_on_credit_cap - Sono stati forniti più parametri di ambito
- Non è stato fornito alcun parametro di ambito
- ID del gruppo o email dell’utente non validi
- Limite di richieste superato

