---
title: "Creates a Loops sampler"
method: POST
path: "/v1/loops/samplers"
---

# Creates a Loops sampler

`POST /v1/loops/samplers`

Creates a standalone Loops sampler not linked to a run.

## Request body

- CreateLoopsSamplerRequestV1
  - `session_id` string, required — ID of the Loops session this sampler belongs to.
  - `base_model` string, nullable — Base model ID for a standalone sampler (for example, a baseline).
  - `run_id` string, nullable — ID of an existing run to attach this sampler to. When set, the sampler is paired to the run and weight-syncs from its trainer, and base_model is inherited from the run. Omit to create a standalone sampler.
  - `max_seq_length` integer, nullable — Maximum prompt length (in tokens) the sampler must handle. Set this to the longest prompt you plan to send.
  - `model_path` string, nullable — bt:// URI of an existing sampler checkpoint to serve. Form: bt://loops:<run_id>/sampler_weights/<checkpoint_name>.
  - `reuse_from_session_id` string, nullable — Optional Loops session ID to reuse infrastructure from. Best-effort.

## Response `200`

- CreateLoopsSamplerResponseV1
  - `sampler` LoopsSamplerV1, required
    - `id` string, required
    - `base_url` string, required
    - `base_model` string, required — The HuggingFace base model the sampler is serving.
    - `created_at` string, date-time, required — Time the sampler was created in ISO 8601 format
    - `model_id` string, required — Hashid of the underlying Baseten model.
    - `deployment_id` string, required — Hashid of the specific model deployment (version).
    - `status` LoopsSamplerStatusV1, required — The current status of a Loops sampler.
      - `name` '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)
