Skip to content
  • There are no suggestions because the search field is empty.

Fine-Tuning API Reference

Create a Fine-Tuning Job

POST /jobs

Create a new fine-tuning job to train a model on your dataset.

Request Parameters

Parameter  Type Required  Description 
model string Yes Base model to fine-tune (e.g., gpt-4.1).
training_file string Yes File ID for the training data.
validation_file string No Optional file ID for validation data
hyperparameters object Deprecated in the OpenAI API, use method instead Custom hyperparameters for training
suffix string No Custom suffix for the resulting model name
method object No Fine-tuning method configuration
seed integer No Random seed for reproducibility
integrations array No List of integrations for tracking
metadata object No Additional metadata for the job

Example Request

 curl /v1/fine_tuning/jobs \
  -H "api-key: $API_KEY" \
  -d '{
    "training_file": "file-BK7bzQj3FfZFXr7DbL6xJwfo",
    "model": "gpt-4o"
  }'

Example Response

{
  "object": "fine_tuning.job",
  "id": "ftjob-abc123",
  "model": "gpt-4o-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",
  "method": {
    "type": "supervised",
    "supervised": {
      "hyperparameters": {
        "batch_size": "auto",
        "learning_rate_multiplier": "auto",
        "n_epochs": "auto",
      }
    }
  },
  "metadata": null
}

Retrieve Fine-Tuning Job

GET /jobs/{job_id}

Get information about a specific fine-tuning job.

Path Parameters

Parameter Type Required Description
job_id string Yes The ID of the fine-tuning job.

Example Request

curl /v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \
  -H "api-key: "

Example Response

{
  "object": "fine_tuning.job",
  "id": "ftjob-abc123",
  "model": "davinci-002",
  "created_at": 1692661014,
  "finished_at": 1692661190,
  "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy",
  "organization_id": "org-123",
  "result_files": [
      "file-abc123"
  ],
  "status": "succeeded",
  "validation_file": null,
  "training_file": "file-abc123",
  "hyperparameters": {
      "n_epochs": 4,
      "batch_size": 1,
      "learning_rate_multiplier": 1.0
  },
  "trained_tokens": 5768,
  "integrations": [],
  "seed": 0,
  "estimated_finish": 0,
  "method": {
    "type": "supervised",
    "supervised": {
      "hyperparameters": {
        "n_epochs": 4,
        "batch_size": 1,
        "learning_rate_multiplier": 1.0
      }
    }
  }
}

List Fine-Tuning Jobs

GET /jobs

Gets a list of fine-tuning jobs for the current user.

Request Parameters

Parameter Type Default Description
limit integer 20 Number of jobs to return.
after string null Pagination cursor.

Example Request

curl /v1/fine_tuning/jobs?limit=2&metadata[key]=value \
  -H "api-key: "

Example Response

{
  "object": "list",
  "data": [
    {
      "object": "fine_tuning.job",
      "id": "ftjob-abc123",
      "model": "gpt-4o-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",
      "metadata": {
        "key": "value"
      }
    },
    { ... },
    { ... }
  ], "has_more": true
}

List Fine-Tuning Events

GET /jobs/{job_id}/events

Get a list of events for a fine-tuning job.

Path Parameters

Parameter Type Default Default
job_id string Yes The ID of the fine-tuning job.

Request Parameters

Parameter Type Default Default
limit integer 20 Number of events to return.
after string null Pagination cursor.

Example Request

curl /v1/fine_tuning/jobs/ftjob-abc123/events \
  -H "api-key: "

Example Response

{
  "object": "list",
  "data": [
    {
      "object": "fine_tuning.job.event",
      "id": "ft-event-ddTJfwuMVpfLXseO0Am0Gqjm",
      "created_at": 1721764800,
      "level": "info",
      "message": "Fine tuning job successfully completed",
      "data": null,
      "type": "message"
    },
    {
      "object": "fine_tuning.job.event",
      "id": "ft-event-tyiGuB72evQncpH87xe505Sv",
      "created_at": 1721764800,
      "level": "info",
      "message": "New fine-tuned model created: ft:gpt-4o:openai::7p4lURel",
      "data": null,
      "type": "message"
    }
  ],
  "has_more": true
}

List Job Checkpoints

GET /jobs/{job_id}/checkpoints

Retrieves all checkpoints for a fine‑tuning job.

Path Parameters

Path Parameters

Parameter Type Default Default
job_id string Yes The ID of the fine-tuning job.
 

Request Parameters

Parameter Type Default Default
limit integer 20 Number of events to return.
after string null Pagination cursor.
 

Example Request

 curl /v1/fine_tuning/jobs/ftjob-abc123/checkpoints \
  -H "api-key: $API_KEY"

Example Response

{
  "object": "list",
  "data": [
    {
      "object": "fine_tuning.job.checkpoint",
      "id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB",
      "created_at": 1721764867,
      "fine_tuned_model_checkpoint": "ft:gpt-4o-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000",
      "metrics": {
        "full_valid_loss": 0.134,
        "full_valid_mean_token_accuracy": 0.874
      },
      "fine_tuning_job_id": "ftjob-abc123",
      "step_number": 2000
    },
    {
      "object": "fine_tuning.job.checkpoint",
      "id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy",
      "created_at": 1721764800,
      "fine_tuned_model_checkpoint": "ft:gpt-4o-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000",
      "metrics": {
        "full_valid_loss": 0.167,
        "full_valid_mean_token_accuracy": 0.781
      },
      "fine_tuning_job_id": "ftjob-abc123",
      "step_number": 1000
    }
  ],
  "first_id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB",
  "last_id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy",
  "has_more": true
}

Cancel a Fine-Tuning Job

POST /jobs/{job_id}/cancel

Cancels a fine-tuning job that is in progress.

Path Parameters

Parameter Type Default Default
job_id string Yes The ID of the fine-tuning job.

Example Request

 curl -X POST /v1/fine_tuning/jobs/ftjob-abc123/cancel \
  -H "api-key: $API_KEY"

Example Response

 {
  "object": "fine_tuning.job",
  "id": "ftjob-abc123",
  "model": "gpt-4o-2024-07-18",
  "created_at": 1721764800,
  "fine_tuned_model": null,
  "organization_id": "org-123",
  "result_files": [],
  "status": "cancelled",
  "validation_file": "file-abc123",
  "training_file": "file-abc123"
}

Delete a fine-tuning job

DELETE /jobs/{job_id}

Deletes a fine-tuning job and its associated files.

Path Parameters

Parameter Type Default Default
job_id string Yes The ID of the fine-tuning job.

Example Request

 curl -X DELETE /v1/fine_tuning/jobs/ftjob-abc123 \
  -H "api-key: $API_KEY"

Response

Returns a 204 No Content response on success.