Skip to main content
Use fine-tuning when you want to adapt a base model to your own training examples and operational style. The fine-tuning endpoints create an asynchronous job from uploaded JSONL files and return a model ID when training succeeds. Fine-tuning endpoints are marked ADMIN ONLY in the generated API reference. Use an API key with the required permissions.

Before you start

Prepare: Fine-tuning jobs can return these statuses:

Step 1 - Upload your training files

Upload each JSONL file with the Files API and purpose: "fine-tune".
Store the returned file IDs. You pass them to the Fine-Tuning API in the next step.

Step 2 - Create a fine-tuning job

Call mka1.llm.fineTuning.create with the base model and your uploaded training file ID. Add a validation file, suffix, metadata, and method settings when you need them.

Step 3 - Poll job status

Retrieve the job until it reaches succeeded, failed, or cancelled.
You can also page through all jobs with mka1.llm.fineTuning.list({ limit, after }).

Step 4 - Inspect training events and checkpoints

Use events for training logs and metrics updates. Use checkpoints to inspect intermediate model checkpoints and their metrics.
Checkpoint metrics can include train_loss, train_mean_token_accuracy, valid_loss, valid_mean_token_accuracy, full_valid_loss, and full_valid_mean_token_accuracy.

Step 5 - Pause, resume, or cancel a job

Use pause when you need to temporarily stop a running job. Use resume to continue it. Use cancel to stop it permanently.

Step 6 - Use the fine-tuned model

When the job reaches succeeded, job.fineTunedModel contains the new model ID. Pass that model ID to a Responses request.

API reference

For the full request and response schema, open the Fine-Tuning group in the API Reference.