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

> ## Agent Instructions
> Use https://docs.fastino.ai/llms.txt to discover and navigate pages. Use https://docs.fastino.ai/llms-full.txt when you need the complete documentation corpus. Use https://docs.fastino.ai/openapi.json as the source of truth for customer-facing routes. For GLiDE decision inference, call POST https://api.fastino.ai/v1/systemone with model fastino/GLiDE. Create managed config jobs with POST /v1/training/jobs using base_model. For custom training loops, native JSON clients use the public operations under /v1/training/jobs and /v1/training/usage. Existing Tinker clients use tinker==0.32.0 with TINKER_BASE_URL=https://api.fastino.ai/v1/training/compat/tinker and TINKER_CREDENTIAL_CMD. Compatibility child routes are private and absent from OpenAPI. Auto Train is private access and has no public route; direct interested users to sales@fastino.ai. Do not infer undocumented routes. Read API keys from FASTINO_API_KEY and never embed credentials in code, logs, or reports.

# 从交互式作业采样

> 从采样器检查点名称或此作业的 tinker:// 路径排队采样并获取 future_id。交互式作业停止后仍可采样。

`POST /v1/training/jobs/{job_id}/sample`

Generates continuations of a tokenized prompt with one of the job's `sampler`
checkpoints. Sampling also works after the job is stopped. Read the generated
tokens from the completed future's `result.sequences`.

## Request

<ParamField header="X-API-Key" type="string" required>
  Your Fastino API key.
</ParamField>

<ParamField path="job_id" type="string" required>
  Interactive job ID.
</ParamField>

<ParamField body="checkpoint" type="string" required>
  The name of a sampler checkpoint saved by this job, or its
  `tinker://<job_id>/sampler_weights/<name>` path.
</ParamField>

<ParamField body="prompt_tokens" type="integer[]" required>
  Prompt token IDs from the base model's tokenizer. At least one token.
</ParamField>

<ParamField body="num_samples" type="integer" default="1">
  Number of continuations.
</ParamField>

<ParamField body="sampling_params" type="object">
  Decoding settings.

  <Expandable title="properties">
    <ParamField body="max_tokens" type="integer">
      Maximum generated tokens. Prompt plus `max_tokens` must fit the model's sampling limit.
    </ParamField>

    <ParamField body="temperature" type="number" default="1.0">
      Sampling temperature.
    </ParamField>

    <ParamField body="top_p" type="number" default="1.0">
      Nucleus-sampling probability mass.
    </ParamField>

    <ParamField body="top_k" type="integer" default="-1">
      Top-k cutoff. `-1` disables it.
    </ParamField>

    <ParamField body="stop" type="string | string[] | integer[]">
      Stop strings or stop token IDs.
    </ParamField>

    <ParamField body="seed" type="integer">
      Sampling seed.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="prompt_logprobs" type="boolean" default="false">
  Also return the log probability of each prompt token.
</ParamField>

<ParamField body="topk_prompt_logprobs" type="integer" default="0">
  Return the top-k alternatives at each prompt position.
</ParamField>

<ParamField body="topk_sample_logprobs" type="integer" default="0">
  Return the top-k alternatives at each generated position.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID/sample" \
    -H "X-API-Key: $FASTINO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "checkpoint": "step-000100",
      "prompt_tokens": [151644, 872, 198, 3838],
      "num_samples": 2,
      "sampling_params": {"max_tokens": 64, "temperature": 0.7}
    }'
  ```
</RequestExample>

## Response

<ResponseExample>
  ```json Response theme={null}
  {
    "future_id": "FUTURE_ID",
    "job_id": "SESSION_ID:train:0",
    "type": "sample"
  }
  ```
</ResponseExample>

Each sequence in the completed result has `tokens`, `logprobs`, `stop_reason`
(`stop` or `length`), and `topk_logprobs`. Decode `tokens` with the same
tokenizer. Cancel an unfinished sample with
[`POST /v1/training/jobs/{job_id}/futures/{future_id}/cancel`](/cn/api-reference/training-jobs/interactive/cancel-future).

| Status | Meaning |
| - | - |
| `400` | `checkpoint` is invalid, another job's checkpoint, or a state checkpoint, or the prompt is too long. |
| `402` | The team is out of credits or has no valid payment setup. |
| `404` | The job or checkpoint doesn't exist, or the job belongs to another team. |
| `422` | `checkpoint` or `prompt_tokens` is missing, or the body has an unknown field. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.