---
title: "Preview tokenized data"
method: POST
path: "/v1/fine-tunes/preview"
tags: ["Fine-tuning"]
---

# Preview tokenized data

`POST /v1/fine-tunes/preview`

## Request

- Base URL: `https://api.together.ai`
- URL: `https://api.together.ai/v1/fine-tunes/preview`
- Auth: HTTP bearer

Preview how sampled rows from a fine-tuning training file will be tokenized before packing.

## Request body

- FineTunePreviewRequest: Request body for previewing tokenized fine-tuning data.
  - `model` string, required: Name of the base model whose tokenizer and chat template will be used.
  - `training_file` string, required: File-ID of the uploaded JSONL training file to sample for preview.
  - `training_method` 'sft': Fine-tuning method to preview. Only supervised fine-tuning is currently supported.
  - `train_on_inputs` boolean: Whether prompt or user-message tokens should contribute to training loss in the preview.
  - `top_k` integer: Maximum number of rows from the start of the training file to tokenize.

## Response `200`

Tokenized data preview generated successfully

- FineTunePreviewResponse: Tokenized preview for sampled rows from a fine-tuning training file.
  - `model` string, required: Name of the base model used to tokenize the sampled rows.
  - `dataset_format` 'general' | 'conversation' | 'instruction', required: Detected SFT dataset format for the sampled rows.
  - `max_seq_length` integer, required: Maximum sequence length configured for the requested model.
  - `train_on_inputs` boolean, required: Whether prompt or user-message tokens contribute to training loss.
  - `rows` FineTunePreviewRow[], required: Tokenized preview rows, in the same order as the sampled training file rows.
    - `input_ids` integer[], required: Token IDs produced for the sampled row.
    - `tokens` string[], required: Raw token strings produced for the sampled row.
    - `labels` integer[], required: Training labels for each token; masked tokens use -100.
    - `trained_spans` array[], required: Half-open token index ranges that contribute to training loss.
      - integer[]: Start and end token indexes for one trained span.
    - `num_tokens` integer, required: Total number of tokens in the preview row after truncation.
    - `num_trained_tokens` integer, required: Number of tokens in the row that contribute to training loss.
    - `truncated` boolean, required: Whether the row was truncated to the model maximum sequence length.

## Other responses

- `400`: Invalid request or unsupported dataset for preview.
- `401`: Unauthorized
- `404`: Training file not found.
- `500`: Internal Server Error
- `502`: Preview service unavailable.
- `503`: Preview service is at capacity.

## Changes

- **2026-10-22** `bb5257b3173a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/together/apis/together-apis/changes/v1/fine-tunes/preview/post.md)

---

[API](https://skmtc.dev/together/apis/together-apis.md) - [All operations](https://skmtc.dev/together/apis/together-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/together/apis/together-apis/revisions/93438ddac711?raw)
