Update chainlet environment's instance type
Updates a chainlet environment’s instance type settings. The chainlet environment setting must exist. When updated, a new chain deployment is created and deployed. It is promoted to the chain environment according to promotion settings on the environment.
curl --request POST \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"updates": [
{
"chainlet_name": "HelloWorld",
"instance_type_id": "1x4"
},
{
"chainlet_name": "RandInt",
"instance_type_id": "A10G:2x24x96"
}
]
}'import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"POST",
url,
headers=headers,
json={'updates': [{'chainlet_name': 'HelloWorld', 'instance_type_id': '1x4'}, {'chainlet_name': 'RandInt', 'instance_type_id': 'A10G:2x24x96'}]}
)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({updates: [{chainlet_name: '<string>', instance_type_id: '<string>'}]})
};
fetch('https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update', 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/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update",
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([
'updates' => [
[
'chainlet_name' => '<string>',
'instance_type_id' => '<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://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update"
payload := strings.NewReader("{\n \"updates\": [\n {\n \"chainlet_name\": \"<string>\",\n \"instance_type_id\": \"<string>\"\n }\n ]\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://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"updates\": [\n {\n \"chainlet_name\": \"<string>\",\n \"instance_type_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update")
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 \"updates\": [\n {\n \"chainlet_name\": \"<string>\",\n \"instance_type_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"requires_redeployment": true,
"chain_deployment": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"environment": "<string>",
"chainlets": [
{
"id": "<string>",
"name": "<string>",
"autoscaling_settings": {
"min_replica": 123,
"max_replica": 123,
"autoscaling_window": 123,
"scale_down_delay": 123,
"concurrency_target": 123,
"target_utilization_percentage": 123,
"target_in_flight_tokens": 123,
"max_scale_down_rate": 123
},
"instance_type_name": "<string>",
"active_replica_count": 123
}
]
},
"chainlet_environment_settings": [
{
"chainlet_name": "<string>",
"autoscaling_settings": {
"min_replica": 123,
"max_replica": 123,
"autoscaling_window": 123,
"scale_down_delay": 123,
"concurrency_target": 123,
"target_utilization_percentage": 123,
"target_in_flight_tokens": 123,
"max_scale_down_rate": 123
},
"instance_type": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
}
}
]
}Authorizations
Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.
Body
A request to update the instance types for chainlets in an environment. Multiples updates can be made in one request. The updates will be processed in batch and a new deployment will be created, deployed and promoted into the environment.
Mapping of chainlet name to the desired chainlet instance type. If the chainlet name doesn't exist, an error is returned.
Show child attributes
Show child attributes
[
{
"chainlet_name": "HelloWorld",
"instance_type_id": "1x4"
},
{
"chainlet_name": "RandInt",
"instance_type_id": "A10G:2x24x96"
}
]
Response
A response to update the environment settings for a chainlet. If updating the instance type
resulted in a re-deployment, requires_redeployment will be True and the resulting deployment
will be returned in the chain_deployment field.
Whether the resource update requires a re-deployment to update the instance type.
The chain deployment resulting from the resource update, if any.
Show child attributes
Show child attributes
The updated chainlet environment settings
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"updates": [
{
"chainlet_name": "HelloWorld",
"instance_type_id": "1x4"
},
{
"chainlet_name": "RandInt",
"instance_type_id": "A10G:2x24x96"
}
]
}'import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"POST",
url,
headers=headers,
json={'updates': [{'chainlet_name': 'HelloWorld', 'instance_type_id': '1x4'}, {'chainlet_name': 'RandInt', 'instance_type_id': 'A10G:2x24x96'}]}
)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({updates: [{chainlet_name: '<string>', instance_type_id: '<string>'}]})
};
fetch('https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update', 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/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update",
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([
'updates' => [
[
'chainlet_name' => '<string>',
'instance_type_id' => '<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://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update"
payload := strings.NewReader("{\n \"updates\": [\n {\n \"chainlet_name\": \"<string>\",\n \"instance_type_id\": \"<string>\"\n }\n ]\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://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"updates\": [\n {\n \"chainlet_name\": \"<string>\",\n \"instance_type_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/chainlet_settings/instance_types/update")
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 \"updates\": [\n {\n \"chainlet_name\": \"<string>\",\n \"instance_type_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"requires_redeployment": true,
"chain_deployment": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"environment": "<string>",
"chainlets": [
{
"id": "<string>",
"name": "<string>",
"autoscaling_settings": {
"min_replica": 123,
"max_replica": 123,
"autoscaling_window": 123,
"scale_down_delay": 123,
"concurrency_target": 123,
"target_utilization_percentage": 123,
"target_in_flight_tokens": 123,
"max_scale_down_rate": 123
},
"instance_type_name": "<string>",
"active_replica_count": 123
}
]
},
"chainlet_environment_settings": [
{
"chainlet_name": "<string>",
"autoscaling_settings": {
"min_replica": 123,
"max_replica": 123,
"autoscaling_window": 123,
"scale_down_delay": 123,
"concurrency_target": 123,
"target_utilization_percentage": 123,
"target_in_flight_tokens": 123,
"max_scale_down_rate": 123
},
"instance_type": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
}
}
]
}