{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-sagemaker/json-schema/amazon-sagemaker-create-optimization-job-request-schema.json",
  "title": "CreateOptimizationJobRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-sagemaker-optimization-job-api-openapi.yml#/components/schemas/CreateOptimizationJobRequest",
  "type": "object",
  "properties": {
    "OptimizationJobName": {
      "type": "string",
      "description": "A custom name for the new optimization job."
    },
    "RoleArn": {
      "type": "string",
      "description": "The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker AI to perform tasks on your behalf. During model optimization, Amazon SageMaker AI needs your permission to: Read input data from an S3 bucket Write model artifacts to an S3 bucket Write logs to Amazon CloudWatch Logs Publish metrics to Amazon CloudWatch You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker AI, the caller of this API must have the iam:PassRole permission. For more information, see Amazon SageMaker AI Roles."
    },
    "ModelSource": {
      "$ref": "#/$defs/OptimizationJobModelSource"
    },
    "DeploymentInstanceType": {
      "type": "string",
      "enum": [
        "ml.p4d.24xlarge",
        "ml.p4de.24xlarge",
        "ml.p5.48xlarge",
        "ml.p5e.48xlarge",
        "ml.p5en.48xlarge",
        "ml.g4dn.xlarge",
        "ml.g4dn.2xlarge",
        "ml.g4dn.4xlarge",
        "ml.g4dn.8xlarge",
        "ml.g4dn.12xlarge",
        "ml.g4dn.16xlarge",
        "ml.g5.xlarge",
        "ml.g5.2xlarge",
        "ml.g5.4xlarge",
        "ml.g5.8xlarge",
        "ml.g5.12xlarge",
        "ml.g5.16xlarge",
        "ml.g5.24xlarge",
        "ml.g5.48xlarge",
        "ml.g6.xlarge",
        "ml.g6.2xlarge",
        "ml.g6.4xlarge",
        "ml.g6.8xlarge",
        "ml.g6.12xlarge",
        "ml.g6.16xlarge",
        "ml.g6.24xlarge",
        "ml.g6.48xlarge",
        "ml.g6e.xlarge",
        "ml.g6e.2xlarge",
        "ml.g6e.4xlarge",
        "ml.g6e.8xlarge",
        "ml.g6e.12xlarge",
        "ml.g6e.16xlarge",
        "ml.g6e.24xlarge",
        "ml.g6e.48xlarge",
        "ml.inf2.xlarge",
        "ml.inf2.8xlarge",
        "ml.inf2.24xlarge",
        "ml.inf2.48xlarge",
        "ml.trn1.2xlarge",
        "ml.trn1.32xlarge",
        "ml.trn1n.32xlarge",
        "ml.p6-b200.48xlarge",
        "ml.g7e.2xlarge",
        "ml.g7e.4xlarge",
        "ml.g7e.8xlarge",
        "ml.g7e.12xlarge",
        "ml.g7e.24xlarge",
        "ml.g7e.48xlarge",
        "ml.g7.2xlarge",
        "ml.g7.4xlarge",
        "ml.g7.8xlarge",
        "ml.g7.12xlarge",
        "ml.g7.24xlarge",
        "ml.g7.48xlarge"
      ],
      "description": "The type of instance that hosts the optimized model that you create with the optimization job."
    },
    "MaxInstanceCount": {
      "type": "integer",
      "description": "The maximum number of instances to use for the optimization job."
    },
    "OptimizationEnvironment": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "The environment variables to set in the model container."
    },
    "OptimizationConfigs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OptimizationConfig"
      },
      "description": "Settings for each of the optimization techniques that the job applies."
    },
    "OutputConfig": {
      "$ref": "#/$defs/OptimizationJobOutputConfig"
    },
    "StoppingCondition": {
      "$ref": "#/$defs/StoppingCondition"
    },
    "Tags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Tag"
      },
      "description": "A list of key-value pairs associated with the optimization job. For more information, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference Guide."
    },
    "VpcConfig": {
      "$ref": "#/$defs/OptimizationVpcConfig"
    },
    "TrainingPlanArns": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The Amazon Resource Name (ARN) of the training plan to use for this optimization job. When you use reserved capacity from a training plan, the optimization job runs on that reserved capacity instead of on-demand capacity. If you omit this field, the job uses on-demand capacity. You can specify at most one training plan. For more information about how to reserve GPU capacity for your optimization jobs using Amazon SageMaker Training Plans, see Reserve capacity with training plans."
    }
  },
  "required": [
    "OptimizationJobName",
    "RoleArn",
    "ModelSource",
    "DeploymentInstanceType",
    "OptimizationConfigs",
    "OutputConfig",
    "StoppingCondition"
  ],
  "$defs": {
    "ModelCompilationConfig": {
      "type": "object",
      "properties": {
        "Image": {
          "type": "string",
          "description": "The URI of an LMI DLC in Amazon ECR. SageMaker uses this image to run the optimization."
        },
        "OverrideEnvironment": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Environment variables that override the default ones in the model container."
        }
      }
    },
    "ModelQuantizationConfig": {
      "type": "object",
      "properties": {
        "Image": {
          "type": "string",
          "description": "The URI of an LMI DLC in Amazon ECR. SageMaker uses this image to run the optimization."
        },
        "OverrideEnvironment": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Environment variables that override the default ones in the model container."
        }
      }
    },
    "ModelShardingConfig": {
      "type": "object",
      "properties": {
        "Image": {
          "type": "string",
          "description": "The URI of an LMI DLC in Amazon ECR. SageMaker uses this image to run the optimization."
        },
        "OverrideEnvironment": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Environment variables that override the default ones in the model container."
        }
      }
    },
    "ModelSpeculativeDecodingConfig": {
      "type": "object",
      "properties": {
        "Technique": {
          "type": "string",
          "enum": [
            "EAGLE"
          ],
          "description": "The speculative decoding technique to apply during model optimization."
        },
        "TrainingDataSource": {
          "$ref": "#/$defs/ModelSpeculativeDecodingTrainingDataSource"
        }
      },
      "required": [
        "Technique"
      ]
    },
    "ModelSpeculativeDecodingTrainingDataSource": {
      "type": "object",
      "properties": {
        "S3Uri": {
          "type": "string",
          "description": "The Amazon S3 URI that points to the training data for speculative decoding."
        },
        "S3DataType": {
          "type": "string",
          "enum": [
            "S3Prefix",
            "ManifestFile"
          ],
          "description": "The type of data stored in the Amazon S3 location. Valid values are S3Prefix or ManifestFile."
        }
      },
      "required": [
        "S3Uri",
        "S3DataType"
      ]
    },
    "OptimizationConfig": {
      "type": "object",
      "properties": {
        "ModelQuantizationConfig": {
          "$ref": "#/$defs/ModelQuantizationConfig"
        },
        "ModelCompilationConfig": {
          "$ref": "#/$defs/ModelCompilationConfig"
        },
        "ModelShardingConfig": {
          "$ref": "#/$defs/ModelShardingConfig"
        },
        "ModelSpeculativeDecodingConfig": {
          "$ref": "#/$defs/ModelSpeculativeDecodingConfig"
        }
      },
      "description": "Exactly one member is set."
    },
    "OptimizationJobModelSource": {
      "type": "object",
      "properties": {
        "S3": {
          "$ref": "#/$defs/OptimizationJobModelSourceS3"
        },
        "SageMakerModel": {
          "$ref": "#/$defs/OptimizationSageMakerModel"
        }
      }
    },
    "OptimizationJobModelSourceS3": {
      "type": "object",
      "properties": {
        "S3Uri": {
          "type": "string",
          "description": "An Amazon S3 URI that locates a source model to optimize with an optimization job."
        },
        "ModelAccessConfig": {
          "$ref": "#/$defs/OptimizationModelAccessConfig"
        }
      }
    },
    "OptimizationJobOutputConfig": {
      "type": "object",
      "properties": {
        "KmsKeyId": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of a key in Amazon Web Services KMS. SageMaker uses they key to encrypt the artifacts of the optimized model when SageMaker uploads the model to Amazon S3."
        },
        "S3OutputLocation": {
          "type": "string",
          "description": "The Amazon S3 URI for where to store the optimized model that you create with an optimization job."
        },
        "SageMakerModel": {
          "$ref": "#/$defs/OptimizationSageMakerModel"
        }
      },
      "required": [
        "S3OutputLocation"
      ]
    },
    "OptimizationModelAccessConfig": {
      "type": "object",
      "properties": {
        "AcceptEula": {
          "type": "boolean",
          "description": "Specifies agreement to the model end-user license agreement (EULA). The AcceptEula value must be explicitly defined as True in order to accept the EULA that this model requires. You are responsible for reviewing and complying with any applicable license terms and making sure they are acceptable for your use case before downloading or using a model."
        }
      },
      "required": [
        "AcceptEula"
      ]
    },
    "OptimizationSageMakerModel": {
      "type": "object",
      "properties": {
        "ModelName": {
          "type": "string",
          "description": "The name of a SageMaker model."
        }
      }
    },
    "OptimizationVpcConfig": {
      "type": "object",
      "properties": {
        "SecurityGroupIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The VPC security group IDs, in the form sg-xxxxxxxx. Specify the security groups for the VPC that is specified in the Subnets field."
        },
        "Subnets": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The ID of the subnets in the VPC to which you want to connect your optimized model."
        }
      },
      "required": [
        "SecurityGroupIds",
        "Subnets"
      ]
    },
    "StoppingCondition": {
      "type": "object",
      "properties": {
        "MaxRuntimeInSeconds": {
          "type": "integer",
          "description": "The maximum length of time, in seconds, that a training or compilation job can run before it is stopped. For compilation jobs, if the job does not complete during this time, a TimeOut error is generated. We recommend starting with 900 seconds and increasing as necessary based on your model. For all other jobs, if the job does not complete during this time, SageMaker ends the job. When RetryStrategy is specified in the job request, MaxRuntimeInSeconds specifies the maximum time for all of the attempts in total, not each individual attempt. The default value is 1 day. The maximum value is 28 day"
        },
        "MaxWaitTimeInSeconds": {
          "type": "integer",
          "description": "The maximum length of time, in seconds, that a managed Spot training job has to complete. It is the amount of time spent waiting for Spot capacity plus the amount of time the job can run. It must be equal to or greater than MaxRuntimeInSeconds. If the job does not complete during this time, SageMaker ends the job. When RetryStrategy is specified in the job request, MaxWaitTimeInSeconds specifies the maximum time for all of the attempts in total, not each individual attempt."
        },
        "MaxPendingTimeInSeconds": {
          "type": "integer",
          "description": "The maximum length of time, in seconds, that a training or compilation job can be pending before it is stopped. When working with training jobs that use capacity from training plans, not all Pending job states count against the MaxPendingTimeInSeconds limit. The following scenarios do not increment the MaxPendingTimeInSeconds counter: The plan is in a Scheduled state: Jobs queued (in Pending status) before a plan's start date (waiting for scheduled start time) Between capacity reservations: Jobs temporarily back to Pending status between two capacity reservation periods MaxPendingTimeInSeconds"
        }
      }
    },
    "Tag": {
      "type": "object",
      "properties": {
        "Key": {
          "type": "string",
          "description": "The tag key. Tag keys must be unique per resource."
        },
        "Value": {
          "type": "string",
          "description": "The tag value."
        }
      },
      "required": [
        "Key",
        "Value"
      ]
    }
  }
}