Skip to main content
Export your Prem API key as API_KEY before running any script.
1

Setup: Define your JSONL file

Define the path to your JSONL dataset file. Make sure the file exists and is properly formatted.
2

Create a project

Start by creating a project workspace. The project_id is required for all subsequent operations.
3

Upload JSONL dataset

Upload your pre-formatted JSONL file. Each line should contain a chat conversation in the expected format. For details on the required dataset structure, see Dataset Structure.
4

Wait for dataset processing

Poll the dataset status until processing completes. JSONL uploads are typically fast.
5

Create snapshot

Split the dataset into training and validation sets. The default 80/20 split works well for most cases.
6

Generate recommendations

Request model recommendations for your snapshot. Poll until recommendations are ready, then filter for recommended models.
7

Create fine-tuning job

Filter recommended experiments and use them directly to launch the fine-tuning job.
8

Monitor job progress

Poll the job status every 10 seconds. Each experiment shows its status and final model ID when complete.

Full Example