---
title: "Sample from a base model with your LoRA weights"
method: POST
path: "/api/v1/sample"
---

# Sample from a base model with your LoRA weights

`POST /api/v1/sample`

Generates samples from the model using the specified sampling parameters

## Request body

- SampleRequest
  - `type` 'sample'
  - `model_path` string — Optional tinker:// path to your model weights or LoRA weights. If not provided, samples against the base model.
  - `base_model` string — Optional base model name to sample from. Is inferred from model_path, if provided. If sampling against a base model, this is required.
  - `prompt` ModelInput, required
    - `chunks` ModelInputChunk[], required — Sequence of input chunks (formerly TokenSequence)
      - union
        - EncodedTextChunk
          - `type` 'encoded_text', required
          - `tokens` integer[], required — Array of token IDs
        - ImageAssetPointerChunk
          - `type` 'image_asset_pointer', required
          - `location` string, required — Path or URL to the image asset
          - `format` 'png' | 'jpeg', required — Image format
          - `width` integer, required — Image width in pixels
          - `height` integer, required — Image height in pixels
          - `tokens` integer, required — Number of tokens this image represents
          - `process_image_function_name` string, required — Name of the function to process this image
  - `sampling_params` SamplingParams, required
    - `max_tokens` integer, nullable — Maximum number of tokens to generate
    - `stop` union — Stop sequences for generation
      - string
      - string[]
      - integer[]
    - `seed` integer, nullable — Random seed for reproducible generation
    - `temperature` number, float — Sampling temperature
    - `top_p` number, float — Nucleus sampling probability
    - `top_k` integer — Top-k sampling parameter (-1 for no limit)
  - `num_samples` integer, required — Number of samples to generate
  - `prompt_logprobs` boolean — If set to `true`, computes and returns logprobs on the prompt tokens. Defaults to false.

## Response `200`

Response containing tokens sampled against the base model and lora

- SampleResponse
  - `type` 'sample', required
  - `sequences` SampledSequence[], required
    - `tokens` integer[], required — List of generated token IDs
    - `logprobs` number[], nullable — Log probabilities for each token (optional)
    - `stop_reason` 'length' | 'stop', required — Reason why sampling stopped
  - `prompt_logprobs` unknown[] — If prompt_logprobs was set to true in the request, logprobs are computed for every token in the prompt. The `prompt_logprobs` response contains a float32 value for every token in the prompt.
    - unknown

---

[API](https://skmtc.dev/thinking-machines-lab/apis/tinker-api.md) · [All operations](https://skmtc.dev/thinking-machines-lab/apis/tinker-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/thinking-machines-lab/tinker-api/revisions/51afac49fce6/schema)
