Skip to main content
PATCH
/
v1
/
models
/
{model_id}
/
deployments
/
production
/
autoscaling_settings
cURL
curl --request PATCH \
--url https://api.baseten.co/v1/models/{model_id}/deployments/production/autoscaling_settings \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
  "min_replica": 0,
  "max_replica": 7,
  "autoscaling_window": 600,
  "scale_down_delay": 120,
  "concurrency_target": 2,
  "target_utilization_percentage": 70,
  "target_in_flight_tokens": 40000,
  "max_scale_down_rate": 20
}'
import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/models/{model_id}/deployments/production/autoscaling_settings"

headers = {"Authorization": f"Bearer {API_KEY}"}

response = requests.request(
"PATCH",
url,
headers=headers,
json={'min_replica': 0, 'max_replica': 7, 'autoscaling_window': 600, 'scale_down_delay': 120, 'concurrency_target': 2, 'target_utilization_percentage': 70, 'target_in_flight_tokens': 40000, 'max_scale_down_rate': 20}
)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
min_replica: 0,
max_replica: 7,
autoscaling_window: 600,
scale_down_delay: 120,
concurrency_target: 2,
target_utilization_percentage: 70,
target_in_flight_tokens: 40000,
max_scale_down_rate: 20
})
};

fetch('https://api.baseten.co/v1/models/{model_id}/deployments/production/autoscaling_settings', 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/models/{model_id}/deployments/production/autoscaling_settings",
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([
'min_replica' => 0,
'max_replica' => 7,
'autoscaling_window' => 600,
'scale_down_delay' => 120,
'concurrency_target' => 2,
'target_utilization_percentage' => 70,
'target_in_flight_tokens' => 40000,
'max_scale_down_rate' => 20
]),
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/models/{model_id}/deployments/production/autoscaling_settings"

payload := strings.NewReader("{\n \"min_replica\": 0,\n \"max_replica\": 7,\n \"autoscaling_window\": 600,\n \"scale_down_delay\": 120,\n \"concurrency_target\": 2,\n \"target_utilization_percentage\": 70,\n \"target_in_flight_tokens\": 40000,\n \"max_scale_down_rate\": 20\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/models/{model_id}/deployments/production/autoscaling_settings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"min_replica\": 0,\n \"max_replica\": 7,\n \"autoscaling_window\": 600,\n \"scale_down_delay\": 120,\n \"concurrency_target\": 2,\n \"target_utilization_percentage\": 70,\n \"target_in_flight_tokens\": 40000,\n \"max_scale_down_rate\": 20\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.baseten.co/v1/models/{model_id}/deployments/production/autoscaling_settings")

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 \"min_replica\": 0,\n \"max_replica\": 7,\n \"autoscaling_window\": 600,\n \"scale_down_delay\": 120,\n \"concurrency_target\": 2,\n \"target_utilization_percentage\": 70,\n \"target_in_flight_tokens\": 40000,\n \"max_scale_down_rate\": 20\n}"

response = http.request(request)
puts response.read_body
{
  "message": "<string>"
}

Authorizations

Authorization
string
header
required

Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.

Path Parameters

model_id
string
required

Body

application/json

A request to update autoscaling settings for a deployment. All fields are optional, and we only update ones passed in.

min_replica
integer | null

Minimum number of replicas

Example:

0

max_replica
integer | null

Maximum number of replicas

Example:

7

autoscaling_window
integer | null

Timeframe of traffic considered for autoscaling decisions

Example:

600

scale_down_delay
integer | null

Waiting period before scaling down any active replica

Example:

120

concurrency_target
integer | null

Number of requests per replica before scaling up

Example:

2

target_utilization_percentage
integer | null

Target utilization percentage for scaling up/down.

Example:

70

target_in_flight_tokens
integer | null

Target number of in-flight tokens for autoscaling decisions. Early access only.

Example:

40000

max_scale_down_rate
integer | null

Maximum percentage of replicas that can be removed per autoscaling window (1–50). E.g. 20 means at most 20% of replicas are removed per window.

Required range: 1 <= x <= 50
Example:

20

Response

200 - application/json

The response to a request to update autoscaling settings.

status
enum<string>
required

Status of the request to update autoscaling settings

Available options:
ACCEPTED,
QUEUED,
UNCHANGED
message
string
required

A message describing the status of the request to update autoscaling settings