---
title: "Creates a chain environment"
method: POST
path: "/v1/chains/{chain_id}/environments"
---

# Creates a chain environment

`POST /v1/chains/{chain_id}/environments`

Creates a chain environment. Returns the resulting environment.

## Request body

- CreateChainEnvironmentRequestV1 — A request to create a custom environment for a chain.
  - `name` string, required — Name of the environment
  - `promotion_settings` UpdatePromotionSettingsV1 — Promotion settings for model promotion
    - `redeploy_on_promotion` boolean, nullable — 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.
    - `rolling_deploy` boolean, nullable — Whether the environment should rely on rolling deploy orchestration.
    - `promotion_cleanup_strategy` 'KEEP' | 'SCALE_TO_ZERO' | 'DEACTIVATE' — The promotion cleanup strategy.
    - `rolling_deploy_config` UpdateRollingDeployConfigV1 — Rolling deploy config for promoting chains and oracles
      - `rolling_deploy_strategy` 'REPLICA' — The rolling deploy strategy.
      - `max_surge_percent` integer, nullable — The maximum surge percentage for rolling deploys.
      - `max_unavailable_percent` integer, nullable — The maximum unavailable percentage for rolling deploys.
      - `stabilization_time_seconds` integer, nullable — The stabilization time in seconds for rolling deploys.
      - `replica_overhead_percent` integer, nullable — The replica overhead percentage for rolling deploys.
    - `ramp_up_while_promoting` boolean, nullable — Whether to ramp up traffic while promoting
    - `ramp_up_duration_seconds` integer, nullable — Duration of the ramp up in seconds
  - `chainlet_settings` ChainletEnvironmentSettingsRequestV1[], nullable — Mapping of chainlet name to the desired chainlet environment settings
    - `chainlet_name` string, required — Name of the chainlet
    - `autoscaling_settings` UpdateAutoscalingSettingsV1 — A request to update autoscaling settings for a deployment. All fields are optional, and we only update ones passed in.
      - `min_replica` integer, nullable — Minimum number of replicas
      - `max_replica` integer, nullable — Maximum number of replicas
      - `autoscaling_window` integer, nullable — Timeframe of traffic considered for autoscaling decisions
      - `scale_down_delay` integer, nullable — Waiting period before scaling down any active replica
      - `concurrency_target` integer, nullable — Number of requests per replica before scaling up
      - `target_utilization_percentage` integer, nullable — Target utilization percentage for scaling up/down.
      - `target_in_flight_tokens` integer, nullable — Target number of in-flight tokens for autoscaling decisions. Early access only.
      - `max_scale_down_rate` integer, nullable — 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.
    - `instance_type_id` string — ID of the instance type to use for the chainlet

## Response `200`

- ChainEnvironmentV1 — Environment for oracles.
  - `name` string, required — Name of the environment
  - `created_at` string, date-time, required — Time the environment was created in ISO 8601 format
  - `chain_id` string, required — Unique identifier of the chain
  - `promotion_settings` PromotionSettingsV1, required — Promotion settings for promoting chains and oracles
    - `redeploy_on_promotion` boolean, nullable — 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.
    - `rolling_deploy` boolean, nullable — Whether the environment should rely on rolling deploy orchestration.
    - `promotion_cleanup_strategy` 'KEEP' | 'SCALE_TO_ZERO' | 'DEACTIVATE' — The promotion cleanup strategy.
    - `rolling_deploy_config` RollingDeployConfigV1 — Rolling deploy config for promoting chains and oracles
      - `rolling_deploy_strategy` 'REPLICA' — The rolling deploy strategy.
      - `max_surge_percent` integer — The maximum surge percentage for rolling deploys.
      - `max_unavailable_percent` integer — The maximum unavailable percentage for rolling deploys.
      - `stabilization_time_seconds` integer — The stabilization time in seconds for rolling deploys.
      - `replica_overhead_percent` integer — The replica overhead percentage for rolling deploys.
    - `ramp_up_while_promoting` boolean, nullable — Whether to ramp up traffic while promoting
    - `ramp_up_duration_seconds` integer, nullable — Duration of the ramp up in seconds
  - `chainlet_settings` ChainletEnvironmentSettingsV1[], required — Environment settings for the chainlets
    - `chainlet_name` string, required — Name of the chainlet
    - `autoscaling_settings` AutoscalingSettingsV1, required — Autoscaling settings for a deployment.
      - `min_replica` integer, required — Minimum number of replicas
      - `max_replica` integer, required — Maximum number of replicas
      - `autoscaling_window` integer, nullable, required — Timeframe of traffic considered for autoscaling decisions
      - `scale_down_delay` integer, nullable, required — Waiting period before scaling down any active replica
      - `concurrency_target` integer, required — Number of requests per replica before scaling up
      - `target_utilization_percentage` integer, nullable, required — Target utilization percentage for scaling up/down.
      - `target_in_flight_tokens` integer, nullable — Target number of in-flight tokens for autoscaling decisions. Early access only.
      - `max_scale_down_rate` integer, nullable — 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.
    - `instance_type` InstanceTypeV1, required — An instance type.
      - `id` string, required — Identifier string for the instance type
      - `name` string, required — Display name of the instance type
      - `memory_limit_mib` integer, required — Memory limit of the instance type in Mebibytes
      - `millicpu_limit` integer, required — CPU limit of the instance type in millicpu
      - `gpu_count` integer, required — Number of GPUs on the instance type
      - `gpu_type` string, nullable, required — Type of GPU on the instance type
      - `gpu_memory_limit_mib` integer, nullable, required — Memory limit of the GPU on the instance type in Mebibytes
  - `current_deployment` ChainDeploymentV1, required — A deployment of a chain.
    - `id` string, required — Unique identifier of the chain deployment
    - `created_at` string, date-time, required — Time the chain deployment was created in ISO 8601 format
    - `chain_id` string, required — Unique identifier of the chain
    - `environment` string, nullable, required — Environment the chain deployment is deployed in
    - `chainlets` ChainletV1[], required — Chainlets in the chain deployment
      - `id` string, required — Unique identifier of the chainlet
      - `name` string, required — Name of the chainlet
      - `autoscaling_settings` AutoscalingSettingsV1, required — Autoscaling settings for a deployment.
        - `min_replica` integer, required — Minimum number of replicas
        - `max_replica` integer, required — Maximum number of replicas
        - `autoscaling_window` integer, nullable, required — Timeframe of traffic considered for autoscaling decisions
        - `scale_down_delay` integer, nullable, required — Waiting period before scaling down any active replica
        - `concurrency_target` integer, required — Number of requests per replica before scaling up
        - `target_utilization_percentage` integer, nullable, required — Target utilization percentage for scaling up/down.
        - `target_in_flight_tokens` integer, nullable — Target number of in-flight tokens for autoscaling decisions. Early access only.
        - `max_scale_down_rate` integer, nullable — 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.
      - `instance_type_name` string, required — Name of the instance type the chainlet is deployed on
      - `active_replica_count` integer, required — Number of active replicas
      - `status` 'BUILDING' | 'DEPLOYING' | 'DEPLOY_FAILED' | 'LOADING_MODEL' | 'ACTIVE' | 'UNHEALTHY' | 'BUILD_FAILED' | 'BUILD_STOPPED' | 'DEACTIVATING' | 'INACTIVE' | 'FAILED' | 'UPDATING' | 'SCALED_TO_ZERO' | 'WAKING_UP', required — The status of a deployment.
    - `status` 'BUILDING' | 'DEPLOYING' | 'DEPLOY_FAILED' | 'LOADING_MODEL' | 'ACTIVE' | 'UNHEALTHY' | 'BUILD_FAILED' | 'BUILD_STOPPED' | 'DEACTIVATING' | 'INACTIVE' | 'FAILED' | 'UPDATING' | 'SCALED_TO_ZERO' | 'WAKING_UP', required — The status of a deployment.
  - `candidate_deployment` ChainDeploymentV1 — A deployment of a chain.
    - `id` string, required — Unique identifier of the chain deployment
    - `created_at` string, date-time, required — Time the chain deployment was created in ISO 8601 format
    - `chain_id` string, required — Unique identifier of the chain
    - `environment` string, nullable, required — Environment the chain deployment is deployed in
    - `chainlets` ChainletV1[], required — Chainlets in the chain deployment
      - `id` string, required — Unique identifier of the chainlet
      - `name` string, required — Name of the chainlet
      - `autoscaling_settings` AutoscalingSettingsV1, required — Autoscaling settings for a deployment.
        - `min_replica` integer, required — Minimum number of replicas
        - `max_replica` integer, required — Maximum number of replicas
        - `autoscaling_window` integer, nullable, required — Timeframe of traffic considered for autoscaling decisions
        - `scale_down_delay` integer, nullable, required — Waiting period before scaling down any active replica
        - `concurrency_target` integer, required — Number of requests per replica before scaling up
        - `target_utilization_percentage` integer, nullable, required — Target utilization percentage for scaling up/down.
        - `target_in_flight_tokens` integer, nullable — Target number of in-flight tokens for autoscaling decisions. Early access only.
        - `max_scale_down_rate` integer, nullable — 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.
      - `instance_type_name` string, required — Name of the instance type the chainlet is deployed on
      - `active_replica_count` integer, required — Number of active replicas
      - `status` 'BUILDING' | 'DEPLOYING' | 'DEPLOY_FAILED' | 'LOADING_MODEL' | 'ACTIVE' | 'UNHEALTHY' | 'BUILD_FAILED' | 'BUILD_STOPPED' | 'DEACTIVATING' | 'INACTIVE' | 'FAILED' | 'UPDATING' | 'SCALED_TO_ZERO' | 'WAKING_UP', required — The status of a deployment.
    - `status` 'BUILDING' | 'DEPLOYING' | 'DEPLOY_FAILED' | 'LOADING_MODEL' | 'ACTIVE' | 'UNHEALTHY' | 'BUILD_FAILED' | 'BUILD_STOPPED' | 'DEACTIVATING' | 'INACTIVE' | 'FAILED' | 'UPDATING' | 'SCALED_TO_ZERO' | 'WAKING_UP', required — The status of a deployment.

---

[API](https://skmtc.net/baseten/apis/baseten-inference-api.md) · [All operations](https://skmtc.net/baseten/apis/baseten-inference-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/baseten/baseten-inference-api/versions/a55a2f64c3c5/schema)
