---
title: "Creates a training job"
method: POST
path: "/v1/training_projects/{training_project_id}/jobs"
---

# Creates a training job

`POST /v1/training_projects/{training_project_id}/jobs`

Creates a training job with the specified configuration.

## Request body

- CreateTrainingJobRequestV1 — A request to create a training job.
  - `training_job` CreateTrainingJobV1, required — Configuration for a training job.
    - `image` CreateTrainingJobImageV1, required — Configuration to create a training job image.
      - `base_image` string, required — Base image for the training job.
      - `docker_auth` DockerAuthV1 — Docker authentication credentials.
        - `registry` string, required — Registry to authenticate with
        - `auth_method` 'GCP_SERVICE_ACCOUNT_JSON' | 'AWS_IAM' | 'AWS_OIDC' | 'GCP_OIDC' | 'REGISTRY_SECRET', required
        - `gcp_service_account_json_docker_auth` GcpServiceAccountJsonDockerAuthV1 — GCP details for the registry.
          - `service_account_json_secret_ref` SecretReferenceV1, required
            - `name` string, required — Name of the secret to reference.
        - `aws_iam_docker_auth` AwsIamDockerAuthV1 — AWS details for the registry.
          - `access_key_secret_ref` SecretReferenceV1, required
            - `name` string, required — Name of the secret to reference.
          - `secret_access_key_secret_ref` SecretReferenceV1, required
            - `name` string, required — Name of the secret to reference.
        - `aws_oidc_docker_auth` AwsOidcDockerAuthV1 — AWS OIDC details for the registry.
          - `role_arn` string, required — AWS IAM role ARN for OIDC authentication
          - `region` string, required — AWS region for OIDC authentication
        - `gcp_oidc_docker_auth` GcpOidcDockerAuthV1 — GCP OIDC details for the registry.
          - `service_account` string, required — GCP service account name for OIDC authentication
          - `workload_identity_provider` string, required — GCP workload identity provider for OIDC authentication
        - `registry_secret_docker_auth` RegistrySecretDockerAuthV1 — Authentication via a Baseten secret for any Docker registry (Docker Hub, GHCR, NGC, etc.). The referenced secret must contain credentials in the format 'username:password'. For Docker Hub, set registry to 'https://index.docker.io/v1/'. For GHCR, use 'ghcr.io'.
          - `secret_ref` SecretReferenceV1, required
            - `name` string, required — Name of the secret to reference.
    - `compute` CreateTrainingJobComputeV1 — Configuration to specify the compute for a training job.
      - `node_count` integer — Number of nodes for the training job.
      - `cpu_count` integer — Number of cpus for the training job.
      - `memory` string — Memory for the training job.
      - `accelerator` CreateTrainingJobAcceleratorV1
        - `accelerator` string, required — GPU type for the training job.
        - `count` integer, required — GPUs needed for the training job.
      - `availability_model` 'dedicated' | 'spot' — Capacity guarantee under which a training job is scheduled. ``DEDICATED`` is on-demand capacity that is not preempted (the default). ``SPOT`` is interruptible capacity that may be preempted; the user is responsible for checkpointing their own progress. A managed/resumable model where the platform handles checkpoint/resume on its own is intentionally not defined yet; it is planned for a future milestone.
    - `runtime` CreateTrainingJobRuntimeV1 — Configuration to specify the runtime environment for a training job.
      - `start_commands` string[] — Commands to execute when starting the runtime.
      - `environment_variables` object — Environment variables to set in the runtime.
      - `artifacts` CreateTrainingJobS3Artifact[] — Runtime artifacts for the training job.
        - `s3_bucket` string, required — S3 bucket for the uploaded runtime artifact.
        - `s3_key` string, required — S3 key for the uploaded runtime artifact.
      - `enable_cache` boolean, nullable — Deprecated. Use cache_config instead.
      - `cache_config` CreateTrainingJobCacheConfig
        - `enable_legacy_hf_mount` boolean — Whether to enable the legacy Hugging Face cache.
        - `enabled` boolean — Whether to enable the read-write cache.
        - `require_cache_affinity` boolean — Whether to require region affinity for the read-write cache. If False, the resulting job is not guaranteed to be deployed alongside the previous cache.
        - `mount_base_path` string — Mount base path for the cache directory. The project cache and team cache will be mounted under this path.
      - `checkpointing_config` CreateTrainingJobCheckpointingConfig
        - `enabled` boolean — Whether checkpointing is enabled.
        - `checkpoint_path` string, nullable — path where checkpoints will be saved.
        - `volume_size_gib` integer, nullable — Size of the volume in gibibytes. If not provided, the default size will be used
      - `load_checkpoint_config` LoadCheckpointConfig
        - `enabled` boolean — Whether checkpoint loading is enabled
        - `download_folder` string — Folder where checkpoints will be downloaded
        - `checkpoints` union[] — List of checkpoint configurations
          - union
            - BasetenLatestCheckpointConfig
              - …
            - BasetenNamedCheckpointConfig
              - …
            - LoopsCheckpointConfig
              - …
    - `name` string, nullable — Name of the training job.
    - `truss_user_env` TrussUserEnv — This data models is used to flexibly store info alongside oracle versions. There is a corresponding data model in the truss client. In contrast, here all fields are optional for backwards compatibility with old clients.
      - `truss_client_version` string, nullable
      - `python_version` string, nullable
      - `pydantic_version` string, nullable
      - `mypy_version` string, nullable
      - `is_library_deployment` boolean
      - `is_frontend_deployment` boolean
      - `git_info` GitInfo
        - `latest_commit_sha` string, required
        - `latest_tag` string, nullable, required
        - `commits_since_tag` integer, nullable, required
        - `has_uncommitted_changes` boolean, required
    - `interactive_session` InteractiveSessionConfigV1 — Configuration for interactive debugging sessions on training jobs.
      - `trigger` 'on_startup' | 'on_failure' | 'on_demand'
      - `timeout_minutes` integer — Number of minutes before the interactive session times out.
      - `session_provider` 'vs_code' | 'cursor' | 'ssh'
      - `auth_provider` 'github' | 'microsoft'
    - `weights` CreateJobWeightConfigV1[] — MDN weight sources to mount in the training container. Weights are mirrored and cached for fast startup.
      - `source` string, required — Weight source URI. Supported formats: hf://, s3://, gs://, r2://, cw://
      - `mount_location` string, required — Path where weights will be mounted in the container
      - `allow_patterns` string[], nullable — File patterns to include (Unix-style shell patterns)
      - `ignore_patterns` string[], nullable — File patterns to exclude (Unix-style shell patterns)
      - `auth_secret_name` string, nullable — Name of the workspace secret for authentication (e.g., HuggingFace token)
      - `auth` object, nullable — Authentication configuration for the weight source.
    - `enable_baseten_workdir` boolean — When enabled, uses /b10/workspace as the working directory instead of the image WORKDIR.
    - `priority` integer, nullable — Queue priority. Higher values are dequeued first. Defaults to 0.

## Response `200`

- CreateTrainingJobResponseV1 — A response to creating a training job.
  - `training_job` TrainingJobV1, required
    - `id` string, required — Unique identifier of the training job.
    - `created_at` string, date-time, required — Time the job was created in ISO 8601 format.
    - `current_status` string, required — Current status of the training job.
    - `error_message` string, nullable — Error message if the training job failed.
    - `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
    - `updated_at` string, date-time, required — Time the job was updated in ISO 8601 format.
    - `training_project_id` string, required — ID of the training project.
    - `training_project` TrainingProjectSummaryV1, required — A summary of a training project.
      - `id` string, required — Unique identifier of the training project.
      - `name` string, required — Name of the training project.
    - `name` string, nullable — Name of the training job.
    - `checkpoint_sync_status` 'SYNCING' | 'COMPLETED' — Lifecycle state for the checkpoint uploader.
    - `priority` integer — Queue priority. Higher values are dequeued first. NULL is treated as 0.
    - `availability_model` 'dedicated' | 'spot' — Capacity guarantee under which a training job is scheduled. ``DEDICATED`` is on-demand capacity that is not preempted (the default). ``SPOT`` is interruptible capacity that may be preempted; the user is responsible for checkpointing their own progress. A managed/resumable model where the platform handles checkpoint/resume on its own is intentionally not defined yet; it is planned for a future milestone.
    - `user` UserV1 — A user.
      - `email` string, nullable — Email of the user.

---

[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/revisions/a55a2f64c3c5/schema)
