Set Usage Configuration
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_bodyUsage API
Set Usage Configuration
Set or clear per-user add-on credit caps, with the ability to apply them across a team, group, or individual user for enterprise billing management.
POST
/
api
/
v1
/
UsageConfig
Set Usage Configuration
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_bodyOverview
Set or clear per-user usage caps on add-on credits for your organization. Caps are always applied on a per-user basis. When you specify a team or group scope, the cap is applied individually to each user within that team or group—it does not set a shared cap for the entire team or group.Request
string
required
Your service key with “Billing Write” permissions
Credit Cap Configuration (Choose One)
boolean
Set to
true to clear the existing add-on credit capinteger
Set a new add-on credit cap (integer value)
You must provide either
clear_add_on_credit_cap or set_add_on_credit_cap, but not both.Scope Configuration (Choose One)
boolean
Set to
true to apply the per-user cap to every user on the teamstring
Apply the per-user cap to every user in a specific group by providing the group ID
string
Apply the configuration to a specific user by providing their email address
You must provide one of
team_level, group_id, or user_email to define the scope.Example Request - Set Per-User Credit Cap for All Users on 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
Example Request - Set Per-User Credit Cap for All Users in a Group
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
Example Request - Set Credit Cap for User
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
Example Request - Clear Credit Cap
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
Response
The response body is empty. A200 status code indicates the operation was successful.
Error Responses
Common error scenarios:- Invalid service key or insufficient permissions
- Both
clear_add_on_credit_capandset_add_on_credit_capprovided - Neither
clear_add_on_credit_capnorset_add_on_credit_capprovided - Multiple scope parameters provided
- No scope parameter provided
- Invalid group ID or user email
- Rate limit exceeded

