> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a team sampler

> Creates a standalone Loops sampler not linked to a run; the sampler belongs to the given team.



## OpenAPI

````yaml post /v1/teams/{team_id}/loops/samplers
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/teams/{team_id}/loops/samplers:
    parameters:
      - $ref: '#/components/parameters/team_id'
    post:
      summary: Creates a Loops sampler in a team
      description: >-
        Creates a standalone Loops sampler not linked to a run; the sampler
        belongs to the given team.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLoopsSamplerRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateLoopsSamplerResponseV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request POST \
            --url https://api.baseten.co/v1/teams/{team_id}/loops/samplers \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "session_id": null,
              "base_model": null,
              "run_id": null,
              "max_seq_length": null,
              "model_path": "bt://loops:k4q95w5/sampler_weights/step-100",
              "reuse_from_session_id": null
            }'
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/teams/{team_id}/loops/samplers"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "POST",
                url,
                headers=headers,
                json={'session_id': None, 'base_model': None, 'run_id': None, 'max_seq_length': None, 'model_path': 'bt://loops:k4q95w5/sampler_weights/step-100', 'reuse_from_session_id': None}
            )

            print(response.text)
components:
  parameters:
    team_id:
      schema:
        type: string
      name: team_id
      in: path
      required: true
  schemas:
    CreateLoopsSamplerRequestV1:
      properties:
        session_id:
          description: ID of the Loops session this sampler belongs to.
          title: Session Id
          type: string
        base_model:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Base model ID for a standalone sampler (for example, a baseline).
          title: Base Model
        run_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            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.
          title: Run Id
        max_seq_length:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          description: >-
            Maximum prompt length (in tokens) the sampler must handle. Set this
            to the longest prompt you plan to send.
          title: Max Seq Length
        model_path:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            bt:// URI of an existing sampler checkpoint to serve. Form:
            bt://loops:<run_id>/sampler_weights/<checkpoint_name>.
          examples:
            - bt://loops:k4q95w5/sampler_weights/step-100
          title: Model Path
        reuse_from_session_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Optional ID of a prior Loops session to reuse a trainer and/or
            sampler from. Deprecated.
          title: Reuse From Session Id
      required:
        - session_id
      title: CreateLoopsSamplerRequestV1
      type: object
    CreateLoopsSamplerResponseV1:
      properties:
        sampler:
          $ref: '#/components/schemas/LoopsSamplerV1'
      required:
        - sampler
      title: CreateLoopsSamplerResponseV1
      type: object
    LoopsSamplerV1:
      properties:
        id:
          title: Id
          type: string
        base_url:
          title: Base Url
          type: string
        base_model:
          description: The HuggingFace base model the sampler is serving.
          title: Base Model
          type: string
        created_at:
          description: Time the sampler was created in ISO 8601 format
          format: date-time
          title: Created At
          type: string
        model_id:
          description: Hashid of the underlying Baseten model.
          title: Model Id
          type: string
        deployment_id:
          description: Hashid of the specific model deployment (version).
          title: Deployment Id
          type: string
        status:
          $ref: '#/components/schemas/LoopsSamplerStatusV1'
          description: The sampler's current status.
        user:
          $ref: '#/components/schemas/UserV1'
          description: The user who owns the sampler.
        instance_type:
          anyOf:
            - $ref: '#/components/schemas/InstanceTypeV1'
            - type: 'null'
          default: null
          description: Instance type serving the sampler.
        node_count:
          default: 1
          description: Number of nodes serving the sampler.
          title: Node Count
          type: integer
      required:
        - id
        - base_url
        - base_model
        - created_at
        - model_id
        - deployment_id
        - status
        - user
      title: LoopsSamplerV1
      type: object
    LoopsSamplerStatusV1:
      description: The current status of a Loops sampler.
      properties:
        name:
          $ref: '#/components/schemas/DeploymentStatusV1'
          description: The current status of the Loops sampler.
      required:
        - name
      title: LoopsSamplerStatusV1
      type: object
    UserV1:
      description: A user.
      properties:
        email:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Email of the user.
          title: Email
      title: UserV1
      type: object
    InstanceTypeV1:
      description: An instance type.
      properties:
        id:
          description: Identifier string for the instance type
          title: Id
          type: string
        name:
          description: Display name of the instance type
          title: Name
          type: string
        memory_limit_mib:
          description: Memory limit of the instance type in Mebibytes
          title: Memory Limit Mib
          type: integer
        millicpu_limit:
          description: CPU limit of the instance type in millicpu
          title: Millicpu Limit
          type: integer
        gpu_count:
          description: Number of GPUs on the instance type
          title: Gpu Count
          type: integer
        gpu_type:
          anyOf:
            - type: string
            - type: 'null'
          description: Type of GPU on the instance type
          title: Gpu Type
        gpu_memory_limit_mib:
          anyOf:
            - type: integer
            - type: 'null'
          description: Memory limit of the GPU on the instance type in Mebibytes
          title: Gpu Memory Limit Mib
      required:
        - id
        - name
        - memory_limit_mib
        - millicpu_limit
        - gpu_count
        - gpu_type
        - gpu_memory_limit_mib
      title: InstanceTypeV1
      type: object
    DeploymentStatusV1:
      description: The status of a deployment.
      enum:
        - BUILDING
        - DEPLOYING
        - DEPLOY_FAILED
        - LOADING_MODEL
        - ACTIVE
        - UNHEALTHY
        - BUILD_FAILED
        - BUILD_STOPPED
        - DEACTIVATING
        - INACTIVE
        - FAILED
        - UPDATING
        - SCALED_TO_ZERO
        - WAKING_UP
      title: DeploymentStatusV1
      type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````