Create fine-tuning job
Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
Request body
The name of the model to fine-tune. You can select one of the supported models.
The ID of an uploaded file that contains training data.
See upload file for how to upload a file.
Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose fine-tune
.
The contents of the file should differ depending on if the model uses the chat or completions format.
See the fine-tuning guide for more details.
A string of up to 64 characters that will be added to your fine-tuned model name.
For example, a suffix
of "custom-model-name" would produce a model name like ft:gpt-4o-mini:openai:custom-model-name:7p4lURel
.
The ID of an uploaded file that contains validation data.
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.
Your dataset must be formatted as a JSONL file. You must upload your file with the purpose fine-tune
.
See the fine-tuning guide for more details.
Returns
A fine-tuning.job object.
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"
}'
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",
}