Training capacity
Set a team's training GPU capacity
Sets the max concurrent GPUs of a given type a team may use.
PATCH
/
v1
/
training
/
capacity
cURL
curl --request PATCH \
--url https://api.baseten.co/v1/training/capacity \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"team_id": null,
"gpu_type": null,
"max_gpus": 8
}'import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/training/capacity"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"PATCH",
url,
headers=headers,
json={'team_id': None, 'gpu_type': None, 'max_gpus': 8}
)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({team_id: '<string>', gpu_type: '<string>', max_gpus: 8})
};
fetch('https://api.baseten.co/v1/training/capacity', 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://api.baseten.co/v1/training/capacity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'team_id' => '<string>',
'gpu_type' => '<string>',
'max_gpus' => 8
]),
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://api.baseten.co/v1/training/capacity"
payload := strings.NewReader("{\n \"team_id\": \"<string>\",\n \"gpu_type\": \"<string>\",\n \"max_gpus\": 8\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.baseten.co/v1/training/capacity")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"team_id\": \"<string>\",\n \"gpu_type\": \"<string>\",\n \"max_gpus\": 8\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/training/capacity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"team_id\": \"<string>\",\n \"gpu_type\": \"<string>\",\n \"max_gpus\": 8\n}"
response = http.request(request)
puts response.read_body{
"team_gpu_capacity": {
"team_id": "<string>",
"team_name": "<string>",
"gpu_type": "<string>",
"baseline": 123,
"limit": 123,
"usage_count": 123,
"dedicated_usage_count": 0,
"spot_usage_count": 0
}
}Authorizations
Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.
Body
application/json
A request to set the GPU capacity ceiling for a (team, gpu_type) pair.
Creates the limit if one doesn't already exist for this team and GPU type, otherwise updates it in place.
Response
200 - application/json
Response for setting a team's GPU capacity ceiling.
The updated per-team GPU capacity limit
Show child attributes
Show child attributes
Was this page helpful?
⌘I
cURL
curl --request PATCH \
--url https://api.baseten.co/v1/training/capacity \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"team_id": null,
"gpu_type": null,
"max_gpus": 8
}'import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/training/capacity"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"PATCH",
url,
headers=headers,
json={'team_id': None, 'gpu_type': None, 'max_gpus': 8}
)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({team_id: '<string>', gpu_type: '<string>', max_gpus: 8})
};
fetch('https://api.baseten.co/v1/training/capacity', 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://api.baseten.co/v1/training/capacity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'team_id' => '<string>',
'gpu_type' => '<string>',
'max_gpus' => 8
]),
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://api.baseten.co/v1/training/capacity"
payload := strings.NewReader("{\n \"team_id\": \"<string>\",\n \"gpu_type\": \"<string>\",\n \"max_gpus\": 8\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.baseten.co/v1/training/capacity")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"team_id\": \"<string>\",\n \"gpu_type\": \"<string>\",\n \"max_gpus\": 8\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/training/capacity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"team_id\": \"<string>\",\n \"gpu_type\": \"<string>\",\n \"max_gpus\": 8\n}"
response = http.request(request)
puts response.read_body{
"team_gpu_capacity": {
"team_id": "<string>",
"team_name": "<string>",
"gpu_type": "<string>",
"baseline": 123,
"limit": 123,
"usage_count": 123,
"dedicated_usage_count": 0,
"spot_usage_count": 0
}
}