Create fine-tuning job

post https://api.openai.com/v1/fine_tuning/jobs

Creates a fine-tuning job which begins the process of creating a new model from a given dataset.source

Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.source

Learn more about fine-tuningsource

Request body

The name of the model to fine-tune. You can select one of the supported models.source

The ID of an uploaded file that contains training data.source

See upload file for how to upload a file.source

Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose fine-tune.source

The contents of the file should differ depending on if the model uses the chat or completions format.source

See the fine-tuning guide for more details.source

The hyperparameters used for the fine-tuning job.source

A string of up to 64 characters that will be added to your fine-tuned model name.source

For example, a suffix of "custom-model-name" would produce a model name like ft:gpt-4o-mini:openai:custom-model-name:7p4lURel.source

The ID of an uploaded file that contains validation data.source

If you provide this file, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in the fine-tuning results file. The same data should not be present in both train and validation files.source

Your dataset must be formatted as a JSONL file. You must upload your file with the purpose fine-tune.source

See the fine-tuning guide for more details.source

A list of integrations to enable for your fine-tuning job.source

The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. If a seed is not specified, one will be generated for you.source

Returns

Example request
1
2
3
4
5
6
7
curl https://api.openai.com/v1/fine_tuning/jobs \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "training_file": "file-BK7bzQj3FfZFXr7DbL6xJwfo",
    "model": "gpt-4o-mini"
  }'
Response
1
2
3
4
5
6
7
8
9
10
11
12
{
  "object": "fine_tuning.job",
  "id": "ftjob-abc123",
  "model": "gpt-4o-mini-2024-07-18",
  "created_at": 1721764800,
  "fine_tuned_model": null,
  "organization_id": "org-123",
  "result_files": [],
  "status": "queued",
  "validation_file": null,
  "training_file": "file-abc123",
}