Create a chain environment. Returns the resulting environment.
curl --request POST \
--url https://api.baseten.co/v1/chains/{chain_id}/environments \
--header "Authorization: Api-Key $BASETEN_API_KEY" \
--data '{
"name": "staging",
"promotion_settings": {
"ramp_up_duration_seconds": 600,
"ramp_up_while_promoting": true,
"redeploy_on_promotion": true,
"rolling_deploy": null,
"rolling_deploy_config": null
},
"chainlet_settings": [
{
"autoscaling_settings": {
"autoscaling_window": 800,
"concurrency_target": 4,
"max_replica": 3,
"min_replica": 2,
"scale_down_delay": 63,
"target_utilization_percentage": null
},
"chainlet_name": "HelloWorld",
"instance_type_id": "2x8"
},
{
"autoscaling_settings": {
"autoscaling_window": null,
"concurrency_target": null,
"max_replica": 3,
"min_replica": 3,
"scale_down_delay": null,
"target_utilization_percentage": null
},
"chainlet_name": "RandInt",
"instance_type_id": "A10Gx8x32"
}
]
}'{
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"promotion_settings": {
"redeploy_on_promotion": true,
"rolling_deploy": true,
"rolling_deploy_config": {
"rolling_deploy_strategy": "REPLICA",
"max_surge_percent": 20,
"max_unavailable_percent": 0,
"stabilization_time_seconds": 0,
"promotion_cleanup_strategy": "SCALE_TO_ZERO"
},
"ramp_up_while_promoting": true,
"ramp_up_duration_seconds": 600
},
"chainlet_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
},
"instance_type": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
}
}
],
"current_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
},
"instance_type_name": "<string>",
"active_replica_count": 123,
"status": "BUILDING"
}
],
"status": "BUILDING"
}
}You must specify the scheme 'Api-Key' in the Authorization header. For example, Authorization: Api-Key <Your_Api_Key>
A request to create a custom environment for a chain.
Name of the environment
Promotion settings for the environment
Show child attributes
Whether to deploy on all promotions. Enabling this flag allows model code to safely handle environment-specific logic. When a deployment is promoted, a new deployment will be created with a copy of the image.
true
Whether the environment should rely on rolling deploy orchestration.
true
Rolling deploy configuration for promotions
Show child attributes
The rolling deploy strategy to use for promotions.
REPLICA "REPLICA"
The maximum surge percentage for rolling deploys.
20
The maximum unavailable percentage for rolling deploys.
20
The stabilization time in seconds for rolling deploys.
300
The promotion cleanup strategy to use for rolling deploys.
KEEP, SCALE_TO_ZERO "SCALE_TO_ZERO"
Whether to ramp up traffic while promoting
true
Duration of the ramp up in seconds
600
{
"ramp_up_duration_seconds": 600,
"ramp_up_while_promoting": true,
"redeploy_on_promotion": true,
"rolling_deploy": null,
"rolling_deploy_config": null
}Mapping of chainlet name to the desired chainlet environment settings
Show child attributes
Name of the chainlet
Autoscaling settings for the chainlet
Show child attributes
Minimum number of replicas
0
Maximum number of replicas
7
Timeframe of traffic considered for autoscaling decisions
600
Waiting period before scaling down any active replica
120
Number of requests per replica before scaling up
2
Target utilization percentage for scaling up/down.
70
{
"autoscaling_window": 60,
"concurrency_target": 1,
"max_replica": 1,
"min_replica": 0,
"scale_down_delay": 900,
"target_utilization_percentage": 70
}ID of the instance type to use for the chainlet
[
{
"autoscaling_settings": {
"autoscaling_window": 800,
"concurrency_target": 4,
"max_replica": 3,
"min_replica": 2,
"scale_down_delay": 63,
"target_utilization_percentage": null
},
"chainlet_name": "HelloWorld",
"instance_type_id": "2x8"
},
{
"autoscaling_settings": {
"autoscaling_window": null,
"concurrency_target": null,
"max_replica": 3,
"min_replica": 3,
"scale_down_delay": null,
"target_utilization_percentage": null
},
"chainlet_name": "RandInt",
"instance_type_id": "A10Gx8x32"
}
]Environment for oracles.
Environment for oracles.
Name of the environment
Time the environment was created in ISO 8601 format
Unique identifier of the chain
Promotion settings for the environment
Show child attributes
Whether to deploy on all promotions. Enabling this flag allows model code to safely handle environment-specific logic. When a deployment is promoted, a new deployment will be created with a copy of the image.
true
Whether the environment should rely on rolling deploy orchestration.
true
Rolling deploy configuration for promotions
Show child attributes
The rolling deploy strategy to use for promotions.
REPLICA The maximum surge percentage for rolling deploys.
The maximum unavailable percentage for rolling deploys.
The stabilization time in seconds for rolling deploys.
The promotion cleanup strategy to use for rolling deploys.
KEEP, SCALE_TO_ZERO Whether to ramp up traffic while promoting
true
Duration of the ramp up in seconds
600
Environment settings for the chainlets
Show child attributes
Name of the chainlet
Autoscaling settings for the chainlet. If null, it has not finished deploying
Show child attributes
Minimum number of replicas
Maximum number of replicas
Timeframe of traffic considered for autoscaling decisions
Waiting period before scaling down any active replica
Number of requests per replica before scaling up
Target utilization percentage for scaling up/down.
Instance type for the chainlet
Show child attributes
Identifier string for the instance type
Display name of the instance type
Memory limit of the instance type in Mebibytes
CPU limit of the instance type in millicpu
Number of GPUs on the instance type
Type of GPU on the instance type
Memory limit of the GPU on the instance type in Mebibytes
Current chain deployment of the environment
Show child attributes
Unique identifier of the chain deployment
Time the chain deployment was created in ISO 8601 format
Unique identifier of the chain
Environment the chain deployment is deployed in
Chainlets in the chain deployment
Show child attributes
Unique identifier of the chainlet
Name of the chainlet
Autoscaling settings for the chainlet. If null, it has not finished deploying
Show child attributes
Minimum number of replicas
Maximum number of replicas
Timeframe of traffic considered for autoscaling decisions
Waiting period before scaling down any active replica
Number of requests per replica before scaling up
Target utilization percentage for scaling up/down.
Name of the instance type the chainlet is deployed on
Number of active replicas
Status of the chainlet
BUILDING, DEPLOYING, DEPLOY_FAILED, LOADING_MODEL, ACTIVE, UNHEALTHY, BUILD_FAILED, BUILD_STOPPED, DEACTIVATING, INACTIVE, FAILED, UPDATING, SCALED_TO_ZERO, WAKING_UP Status of the chain deployment
BUILDING, DEPLOYING, DEPLOY_FAILED, LOADING_MODEL, ACTIVE, UNHEALTHY, BUILD_FAILED, BUILD_STOPPED, DEACTIVATING, INACTIVE, FAILED, UPDATING, SCALED_TO_ZERO, WAKING_UP Was this page helpful?
curl --request POST \
--url https://api.baseten.co/v1/chains/{chain_id}/environments \
--header "Authorization: Api-Key $BASETEN_API_KEY" \
--data '{
"name": "staging",
"promotion_settings": {
"ramp_up_duration_seconds": 600,
"ramp_up_while_promoting": true,
"redeploy_on_promotion": true,
"rolling_deploy": null,
"rolling_deploy_config": null
},
"chainlet_settings": [
{
"autoscaling_settings": {
"autoscaling_window": 800,
"concurrency_target": 4,
"max_replica": 3,
"min_replica": 2,
"scale_down_delay": 63,
"target_utilization_percentage": null
},
"chainlet_name": "HelloWorld",
"instance_type_id": "2x8"
},
{
"autoscaling_settings": {
"autoscaling_window": null,
"concurrency_target": null,
"max_replica": 3,
"min_replica": 3,
"scale_down_delay": null,
"target_utilization_percentage": null
},
"chainlet_name": "RandInt",
"instance_type_id": "A10Gx8x32"
}
]
}'{
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"promotion_settings": {
"redeploy_on_promotion": true,
"rolling_deploy": true,
"rolling_deploy_config": {
"rolling_deploy_strategy": "REPLICA",
"max_surge_percent": 20,
"max_unavailable_percent": 0,
"stabilization_time_seconds": 0,
"promotion_cleanup_strategy": "SCALE_TO_ZERO"
},
"ramp_up_while_promoting": true,
"ramp_up_duration_seconds": 600
},
"chainlet_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
},
"instance_type": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
}
}
],
"current_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
},
"instance_type_name": "<string>",
"active_replica_count": 123,
"status": "BUILDING"
}
],
"status": "BUILDING"
}
}