Environments
Get environment
Gets an environment’s details and returns the environment.
GET
/
v1
/
models
/
{model_id}
/
environments
/
{env_name}
cURL
curl --request GET \
--url https://api.baseten.co/v1/models/{model_id}/environments/{env_name} \
--header "Authorization: Bearer $BASETEN_API_KEY"import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/models/{model_id}/environments/{env_name}"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"GET",
url,
headers=headers,
json={}
)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.baseten.co/v1/models/{model_id}/environments/{env_name}', 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}/environments/{env_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.baseten.co/v1/models/{model_id}/environments/{env_name}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.baseten.co/v1/models/{model_id}/environments/{env_name}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/models/{model_id}/environments/{env_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"model_id": "<string>",
"current_deployment": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"model_id": "<string>",
"is_production": true,
"is_development": true,
"active_replica_count": 123,
"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>",
"environment": "<string>",
"labels": {}
},
"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
},
"promotion_settings": {
"redeploy_on_promotion": true,
"rolling_deploy": true,
"promotion_cleanup_strategy": "SCALE_TO_ZERO",
"rolling_deploy_config": {
"rolling_deploy_strategy": "REPLICA",
"max_surge_percent": 25,
"max_unavailable_percent": 0,
"stabilization_time_seconds": 0,
"replica_overhead_percent": 0
},
"ramp_up_while_promoting": true,
"ramp_up_duration_seconds": 600
},
"instance_type": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
},
"candidate_deployment": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"model_id": "<string>",
"is_production": true,
"is_development": true,
"active_replica_count": 123,
"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>",
"environment": "<string>",
"labels": {}
},
"in_progress_promotion": {
"percent_traffic_to_new_version": 123,
"error_message": "<string>",
"rolling_deploy": true
}
}Authorizations
Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.
Response
200 - application/json
Environment for oracles.
Name of the environment
Time the environment was created in ISO 8601 format
Unique identifier of the model
Current deployment of the environment
Show child attributes
Show child attributes
Autoscaling settings for the environment
Show child attributes
Show child attributes
Promotion settings for the environment
Show child attributes
Show child attributes
Instance type for the environment
Show child attributes
Show child attributes
Candidate deployment being promoted to the environment, if a promotion is in progress
Show child attributes
Show child attributes
Details of the in-progress promotion, if any
Show child attributes
Show child attributes
Was this page helpful?
⌘I
cURL
curl --request GET \
--url https://api.baseten.co/v1/models/{model_id}/environments/{env_name} \
--header "Authorization: Bearer $BASETEN_API_KEY"import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/models/{model_id}/environments/{env_name}"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"GET",
url,
headers=headers,
json={}
)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.baseten.co/v1/models/{model_id}/environments/{env_name}', 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}/environments/{env_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.baseten.co/v1/models/{model_id}/environments/{env_name}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.baseten.co/v1/models/{model_id}/environments/{env_name}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/models/{model_id}/environments/{env_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"model_id": "<string>",
"current_deployment": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"model_id": "<string>",
"is_production": true,
"is_development": true,
"active_replica_count": 123,
"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>",
"environment": "<string>",
"labels": {}
},
"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
},
"promotion_settings": {
"redeploy_on_promotion": true,
"rolling_deploy": true,
"promotion_cleanup_strategy": "SCALE_TO_ZERO",
"rolling_deploy_config": {
"rolling_deploy_strategy": "REPLICA",
"max_surge_percent": 25,
"max_unavailable_percent": 0,
"stabilization_time_seconds": 0,
"replica_overhead_percent": 0
},
"ramp_up_while_promoting": true,
"ramp_up_duration_seconds": 600
},
"instance_type": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
},
"candidate_deployment": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"model_id": "<string>",
"is_production": true,
"is_development": true,
"active_replica_count": 123,
"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>",
"environment": "<string>",
"labels": {}
},
"in_progress_promotion": {
"percent_traffic_to_new_version": 123,
"error_message": "<string>",
"rolling_deploy": true
}
}