# Create a fine-tuning job

`POST /openai/v1/fine_tuning/jobs`

Creates a fine-tuning job from the provided dataset and returns the enqueued job details.

## Request Body

Content-Type: `application/json` *(required)*

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `model` | `enum` | Yes | The name of the model to fine-tune. You can select one of the [supported models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). _Enum:_ `babbage-002`, `davinci-002`, `gpt-3.5-turbo`, `gpt-4o-mini` |
| `training_file` | `string` | Yes | The ID of an uploaded file that contains training data. See [upload file](/docs/api-reference/files/create) 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](/docs/api-reference/fine-tuning/chat-input), [completions](/docs/api-reference/fine-tuning/completions-input) format, or if the fine-tuning method uses the [preference](/docs/api-reference/fine-tuning/preference-input) format. See the [fine-tuning guide](/docs/guides/model-optimization) for more details. |
| `hyperparameters` | `OpenAI.CreateFineTuningJobRequestHyperparameters` | No | The hyperparameters used for the fine-tuning job. This value is now deprecated in favor of `method`, and should be passed in under the `method` parameter. |
| `suffix` | `string \| null` | No | 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`. |
| `validation_file` | `string \| null` | No | 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](/docs/guides/model-optimization) for more details. |
| `integrations` | `OpenAI.CreateFineTuningJobRequestIntegrations[] \| null` | No | A list of integrations to enable for your fine-tuning job. |
| `seed` | `OpenAI.integer \| null` | No | 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. |
| `method` | `OpenAI.FineTuneMethod` | No | The method used for fine-tuning. |
| `metadata` | `OpenAI.Metadata \| null` | No |  |

### `hyperparameters` — `OpenAI.CreateFineTuningJobRequestHyperparameters`

The hyperparameters used for the fine-tuning job. This value is now deprecated in favor of `method`, and should be passed in under the `method` parameter.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `batch_size` | `enum` | No | _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | _Default:_ `"auto"` _Constant:_ `auto` |

### `integrations` — `OpenAI.CreateFineTuningJobRequestIntegrations[] | null`

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

**One of the following:**

#### `OpenAI.CreateFineTuningJobRequestIntegrations[]` — `OpenAI.CreateFineTuningJobRequestIntegrations[]`

**Array of** `OpenAI.CreateFineTuningJobRequestIntegrations`**:**

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Constant:_ `wandb` |
| `wandb` | `OpenAI.CreateFineTuningJobRequestIntegrationsWandb` | Yes |  |

##### `wandb` — `OpenAI.CreateFineTuningJobRequestIntegrationsWandb`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `project` | `string` | Yes |  |
| `name` | `string \| null` | No |  |
| `entity` | `string \| null` | No |  |
| `tags` | `string[]` | No |  |

#### `null` — `null`

| Type | Description |
|------|-------------|
| `null` | — |

### `method` — `OpenAI.FineTuneMethod`

The method used for fine-tuning.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The type of method. Is either `supervised`, `dpo`, or `reinforcement`. _Enum:_ `supervised`, `dpo`, `reinforcement` |
| `supervised` | `OpenAI.FineTuneSupervisedMethod` | No | Configuration for the supervised fine-tuning method. |
| `dpo` | `OpenAI.FineTuneDPOMethod` | No | Configuration for the DPO fine-tuning method. |
| `reinforcement` | `OpenAI.FineTuneReinforcementMethod` | No | Configuration for the reinforcement fine-tuning method. |

#### `supervised` — `OpenAI.FineTuneSupervisedMethod`

Configuration for the supervised fine-tuning method.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `hyperparameters` | `OpenAI.FineTuneSupervisedHyperparameters` | No | The hyperparameters used for the fine-tuning job. |

##### `hyperparameters` — `OpenAI.FineTuneSupervisedHyperparameters`

The hyperparameters used for the fine-tuning job.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `batch_size` | `enum` | No | Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. _Default:_ `"auto"` _Constant:_ `auto` |

#### `dpo` — `OpenAI.FineTuneDPOMethod`

Configuration for the DPO fine-tuning method.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `hyperparameters` | `OpenAI.FineTuneDPOHyperparameters` | No | The hyperparameters used for the DPO fine-tuning job. |

##### `hyperparameters` — `OpenAI.FineTuneDPOHyperparameters`

The hyperparameters used for the DPO fine-tuning job.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `beta` | `enum` | No | The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model. _Default:_ `"auto"` _Constant:_ `auto` |
| `batch_size` | `enum` | No | Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. _Default:_ `"auto"` _Constant:_ `auto` |

#### `reinforcement` — `OpenAI.FineTuneReinforcementMethod`

Configuration for the reinforcement fine-tuning method.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `grader` | `OpenAI.GraderStringCheck \| OpenAI.GraderTextSimilarity \| OpenAI.GraderPython \| OpenAI.GraderScoreModel \| OpenAI.GraderMulti` | Yes | The grader used for the fine-tuning job. |
| `hyperparameters` | `OpenAI.FineTuneReinforcementHyperparameters` | No | The hyperparameters used for the reinforcement fine-tuning job. |

##### `grader` — `OpenAI.GraderStringCheck | OpenAI.GraderTextSimilarity | OpenAI.GraderPython | OpenAI.GraderScoreModel | OpenAI.GraderMulti`

The grader used for the fine-tuning job.

**One of the following:**

###### `OpenAI.GraderStringCheck` — `OpenAI.GraderStringCheck`

A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `string_check`. _Constant:_ `string_check` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The input text. This may include template strings. |
| `reference` | `string` | Yes | The reference text. This may include template strings. |
| `operation` | `enum` | Yes | The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. _Enum:_ `eq`, `ne`, `like`, `ilike` |

###### `OpenAI.GraderTextSimilarity` — `OpenAI.GraderTextSimilarity`

A TextSimilarityGrader object which grades text based on similarity metrics.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The type of grader. _Default:_ `"text_similarity"` _Constant:_ `text_similarity` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The text being graded. |
| `reference` | `string` | Yes | The text being graded against. |
| `evaluation_metric` | `enum` | Yes | The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. _Enum:_ `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, `rouge_l` |

###### `OpenAI.GraderPython` — `OpenAI.GraderPython`

A PythonGrader object that runs a python script on the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `python`. _Constant:_ `python` |
| `name` | `string` | Yes | The name of the grader. |
| `source` | `string` | Yes | The source code of the python script. |
| `image_tag` | `string` | No | The image tag to use for the python script. |

###### `OpenAI.GraderScoreModel` — `OpenAI.GraderScoreModel`

A ScoreModelGrader object that uses a model to assign a score to the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `score_model`. _Constant:_ `score_model` |
| `name` | `string` | Yes | The name of the grader. |
| `model` | `string` | Yes | The model to use for the evaluation. |
| `sampling_params` | `OpenAI.EvalGraderScoreModelSamplingParams` | No | The sampling parameters for the model. |
| `input` | `OpenAI.EvalItem[]` | Yes | The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings. |
| `range` | `OpenAI.numeric[]` | No | The range of the score. Defaults to `[0, 1]`. |

- **`sampling_params`** — `OpenAI.EvalGraderScoreModelSamplingParams`

The sampling parameters for the model.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `seed` | `OpenAI.integer \| null` | No |  |
| `top_p` | `OpenAI.numeric \| null` | No | _Default:_ `1` |
| `temperature` | `OpenAI.numeric \| null` | No |  |
| `max_completions_tokens` | `OpenAI.integer \| null` | No |  |
| `reasoning_effort` | `enum` | No | Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. - `xhigh` is supported for all models after `gpt-5.1-codex-max`. _Enum:_ `none`, `minimal`, `low`, `medium`, `high`, `xhigh` |

- **`input`** — `OpenAI.EvalItem[]`

The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.

**Array of** `OpenAI.EvalItem`**:**

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `role` | `enum` | Yes | The role of the message input. One of `user`, `assistant`, `system`, or `developer`. _Enum:_ `user`, `assistant`, `system`, `developer` |
| `content` | `OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject \| (OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject)[]` | Yes | Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. |
| `type` | `enum` | No | The type of the message input. Always `message`. _Constant:_ `message` |

- **`content`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject | (OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[]`

Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

**One of the following:**

- **`OpenAI.EvalItemContentItem`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.EvalItemContentArray`** — `OpenAI.EvalItemContentArray ((OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[])`

A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

###### `OpenAI.GraderMulti` — `OpenAI.GraderMulti`

A MultiGrader object combines the output of multiple graders to produce a single score.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `multi`. _Default:_ `"multi"` _Constant:_ `multi` |
| `name` | `string` | Yes | The name of the grader. |
| `graders` | `OpenAI.GraderStringCheck \| OpenAI.GraderTextSimilarity \| OpenAI.GraderPython \| OpenAI.GraderScoreModel \| OpenAI.GraderLabelModel` | Yes |  |
| `calculate_output` | `string` | Yes | A formula to calculate the output based on grader results. |

- **`graders`** — `OpenAI.GraderStringCheck | OpenAI.GraderTextSimilarity | OpenAI.GraderPython | OpenAI.GraderScoreModel | OpenAI.GraderLabelModel`

**One of the following:**

- **`OpenAI.GraderStringCheck`** — `OpenAI.GraderStringCheck`

A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `string_check`. _Constant:_ `string_check` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The input text. This may include template strings. |
| `reference` | `string` | Yes | The reference text. This may include template strings. |
| `operation` | `enum` | Yes | The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. _Enum:_ `eq`, `ne`, `like`, `ilike` |

- **`OpenAI.GraderTextSimilarity`** — `OpenAI.GraderTextSimilarity`

A TextSimilarityGrader object which grades text based on similarity metrics.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The type of grader. _Default:_ `"text_similarity"` _Constant:_ `text_similarity` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The text being graded. |
| `reference` | `string` | Yes | The text being graded against. |
| `evaluation_metric` | `enum` | Yes | The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. _Enum:_ `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, `rouge_l` |

- **`OpenAI.GraderPython`** — `OpenAI.GraderPython`

A PythonGrader object that runs a python script on the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `python`. _Constant:_ `python` |
| `name` | `string` | Yes | The name of the grader. |
| `source` | `string` | Yes | The source code of the python script. |
| `image_tag` | `string` | No | The image tag to use for the python script. |

- **`OpenAI.GraderScoreModel`** — `OpenAI.GraderScoreModel`

A ScoreModelGrader object that uses a model to assign a score to the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `score_model`. _Constant:_ `score_model` |
| `name` | `string` | Yes | The name of the grader. |
| `model` | `string` | Yes | The model to use for the evaluation. |
| `sampling_params` | `OpenAI.EvalGraderScoreModelSamplingParams` | No | The sampling parameters for the model. |
| `input` | `OpenAI.EvalItem[]` | Yes | The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings. |
| `range` | `OpenAI.numeric[]` | No | The range of the score. Defaults to `[0, 1]`. |

- **`sampling_params`** — `OpenAI.EvalGraderScoreModelSamplingParams`

The sampling parameters for the model.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `seed` | `OpenAI.integer \| null` | No |  |
| `top_p` | `OpenAI.numeric \| null` | No | _Default:_ `1` |
| `temperature` | `OpenAI.numeric \| null` | No |  |
| `max_completions_tokens` | `OpenAI.integer \| null` | No |  |
| `reasoning_effort` | `enum` | No | Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. - `xhigh` is supported for all models after `gpt-5.1-codex-max`. _Enum:_ `none`, `minimal`, `low`, `medium`, `high`, `xhigh` |

- **`input`** — `OpenAI.EvalItem[]`

The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.

**Array of** `OpenAI.EvalItem`**:**

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `role` | `enum` | Yes | The role of the message input. One of `user`, `assistant`, `system`, or `developer`. _Enum:_ `user`, `assistant`, `system`, `developer` |
| `content` | `OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject \| (OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject)[]` | Yes | Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. |
| `type` | `enum` | No | The type of the message input. Always `message`. _Constant:_ `message` |

- **`content`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject | (OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[]`

Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

**One of the following:**

- **`OpenAI.EvalItemContentItem`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.EvalItemContentArray`** — `OpenAI.EvalItemContentArray ((OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[])`

A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.GraderLabelModel`** — `OpenAI.GraderLabelModel`

A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `label_model`. _Constant:_ `label_model` |
| `name` | `string` | Yes | The name of the grader. |
| `model` | `string` | Yes | The model to use for the evaluation. Must support structured outputs. |
| `input` | `OpenAI.EvalItem[]` | Yes |  |
| `labels` | `string[]` | Yes | The labels to assign to each item in the evaluation. |
| `passing_labels` | `string[]` | Yes | The labels that indicate a passing result. Must be a subset of labels. |

- **`input`** — `OpenAI.EvalItem[]`

**Array of** `OpenAI.EvalItem`**:**

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `role` | `enum` | Yes | The role of the message input. One of `user`, `assistant`, `system`, or `developer`. _Enum:_ `user`, `assistant`, `system`, `developer` |
| `content` | `OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject \| (OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject)[]` | Yes | Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. |
| `type` | `enum` | No | The type of the message input. Always `message`. _Constant:_ `message` |

- **`content`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject | (OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[]`

Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

**One of the following:**

- **`OpenAI.EvalItemContentItem`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.EvalItemContentArray`** — `OpenAI.EvalItemContentArray ((OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[])`

A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

##### `hyperparameters` — `OpenAI.FineTuneReinforcementHyperparameters`

The hyperparameters used for the reinforcement fine-tuning job.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `batch_size` | `enum` | No | Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. _Default:_ `"auto"` _Constant:_ `auto` |
| `reasoning_effort` | `enum` | No | Level of reasoning effort. _Default:_ `"default"` _Enum:_ `default`, `low`, `medium`, `high` |
| `compute_multiplier` | `enum` | No | Multiplier on amount of compute used for exploring search space during training. _Default:_ `"auto"` _Constant:_ `auto` |
| `eval_interval` | `enum` | No | The number of training steps between evaluation runs. _Default:_ `"auto"` _Constant:_ `auto` |
| `eval_samples` | `enum` | No | Number of evaluation samples to generate per training step. _Default:_ `"auto"` _Constant:_ `auto` |

## Responses

### 200 — The request has succeeded.

Content-Type: `application/json`

The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `id` | `string` | Yes | The object identifier, which can be referenced in the API endpoints. |
| `created_at` | `integer` | Yes | The Unix timestamp (in seconds) for when the fine-tuning job was created. _Format:_ `unixtime` |
| `error` | `OpenAI.FineTuningJobError \| null` | Yes |  |
| `fine_tuned_model` | `string \| null` | Yes |  |
| `finished_at` | `string \| null` | Yes | _Format:_ `unixTimestamp` |
| `hyperparameters` | `OpenAI.FineTuningJobHyperparameters` | Yes | The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs. |
| `model` | `string` | Yes | The base model that is being fine-tuned. |
| `object` | `enum` | Yes | The object type, which is always "fine_tuning.job". _Constant:_ `fine_tuning.job` |
| `organization_id` | `string` | Yes | The organization that owns the fine-tuning job. |
| `result_files` | `string[]` | Yes | The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents). |
| `status` | `enum` | Yes | The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. _Enum:_ `validating_files`, `queued`, `running`, `succeeded`, `failed`, `cancelled` |
| `trained_tokens` | `OpenAI.integer \| null` | Yes |  |
| `training_file` | `string` | Yes | The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). |
| `validation_file` | `string \| null` | Yes |  |
| `integrations` | `OpenAI.FineTuningIntegration[] \| null` | No |  |
| `seed` | `OpenAI.integer` | Yes | The seed used for the fine-tuning job. _Format:_ `int64` |
| `estimated_finish` | `string \| null` | No | _Format:_ `unixTimestamp` |
| `method` | `OpenAI.FineTuneMethod` | No | The method used for fine-tuning. |
| `metadata` | `OpenAI.Metadata \| null` | No |  |

#### `error` — `OpenAI.FineTuningJobError | null`

**One of the following:**

##### `OpenAI.FineTuningJobError` — `OpenAI.FineTuningJobError`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `string` | Yes |  |
| `message` | `string` | Yes |  |
| `param` | `string \| null` | Yes |  |

##### `null` — `null`

| Type | Description |
|------|-------------|
| `null` | — |

#### `hyperparameters` — `OpenAI.FineTuningJobHyperparameters`

The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `batch_size` | `enum` | No | _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | _Default:_ `"auto"` _Constant:_ `auto` |

#### `integrations` — `OpenAI.FineTuningIntegration[] | null`

**One of the following:**

##### `OpenAI.FineTuningIntegration[]` — `OpenAI.FineTuningIntegration[]`

**Array of** `OpenAI.FineTuningIntegration`**:**

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The type of the integration being enabled for the fine-tuning job _Constant:_ `wandb` |
| `wandb` | `OpenAI.FineTuningIntegrationWandb` | Yes | The settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run. |

###### `wandb` — `OpenAI.FineTuningIntegrationWandb`

The settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `project` | `string` | Yes |  |
| `name` | `string \| null` | No |  |
| `entity` | `string \| null` | No |  |
| `tags` | `string[]` | No |  |

##### `null` — `null`

| Type | Description |
|------|-------------|
| `null` | — |

#### `method` — `OpenAI.FineTuneMethod`

The method used for fine-tuning.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The type of method. Is either `supervised`, `dpo`, or `reinforcement`. _Enum:_ `supervised`, `dpo`, `reinforcement` |
| `supervised` | `OpenAI.FineTuneSupervisedMethod` | No | Configuration for the supervised fine-tuning method. |
| `dpo` | `OpenAI.FineTuneDPOMethod` | No | Configuration for the DPO fine-tuning method. |
| `reinforcement` | `OpenAI.FineTuneReinforcementMethod` | No | Configuration for the reinforcement fine-tuning method. |

##### `supervised` — `OpenAI.FineTuneSupervisedMethod`

Configuration for the supervised fine-tuning method.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `hyperparameters` | `OpenAI.FineTuneSupervisedHyperparameters` | No | The hyperparameters used for the fine-tuning job. |

###### `hyperparameters` — `OpenAI.FineTuneSupervisedHyperparameters`

The hyperparameters used for the fine-tuning job.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `batch_size` | `enum` | No | Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. _Default:_ `"auto"` _Constant:_ `auto` |

##### `dpo` — `OpenAI.FineTuneDPOMethod`

Configuration for the DPO fine-tuning method.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `hyperparameters` | `OpenAI.FineTuneDPOHyperparameters` | No | The hyperparameters used for the DPO fine-tuning job. |

###### `hyperparameters` — `OpenAI.FineTuneDPOHyperparameters`

The hyperparameters used for the DPO fine-tuning job.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `beta` | `enum` | No | The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model. _Default:_ `"auto"` _Constant:_ `auto` |
| `batch_size` | `enum` | No | Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. _Default:_ `"auto"` _Constant:_ `auto` |

##### `reinforcement` — `OpenAI.FineTuneReinforcementMethod`

Configuration for the reinforcement fine-tuning method.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `grader` | `OpenAI.GraderStringCheck \| OpenAI.GraderTextSimilarity \| OpenAI.GraderPython \| OpenAI.GraderScoreModel \| OpenAI.GraderMulti` | Yes | The grader used for the fine-tuning job. |
| `hyperparameters` | `OpenAI.FineTuneReinforcementHyperparameters` | No | The hyperparameters used for the reinforcement fine-tuning job. |

###### `grader` — `OpenAI.GraderStringCheck | OpenAI.GraderTextSimilarity | OpenAI.GraderPython | OpenAI.GraderScoreModel | OpenAI.GraderMulti`

The grader used for the fine-tuning job.

**One of the following:**

- **`OpenAI.GraderStringCheck`** — `OpenAI.GraderStringCheck`

A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `string_check`. _Constant:_ `string_check` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The input text. This may include template strings. |
| `reference` | `string` | Yes | The reference text. This may include template strings. |
| `operation` | `enum` | Yes | The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. _Enum:_ `eq`, `ne`, `like`, `ilike` |

- **`OpenAI.GraderTextSimilarity`** — `OpenAI.GraderTextSimilarity`

A TextSimilarityGrader object which grades text based on similarity metrics.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The type of grader. _Default:_ `"text_similarity"` _Constant:_ `text_similarity` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The text being graded. |
| `reference` | `string` | Yes | The text being graded against. |
| `evaluation_metric` | `enum` | Yes | The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. _Enum:_ `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, `rouge_l` |

- **`OpenAI.GraderPython`** — `OpenAI.GraderPython`

A PythonGrader object that runs a python script on the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `python`. _Constant:_ `python` |
| `name` | `string` | Yes | The name of the grader. |
| `source` | `string` | Yes | The source code of the python script. |
| `image_tag` | `string` | No | The image tag to use for the python script. |

- **`OpenAI.GraderScoreModel`** — `OpenAI.GraderScoreModel`

A ScoreModelGrader object that uses a model to assign a score to the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `score_model`. _Constant:_ `score_model` |
| `name` | `string` | Yes | The name of the grader. |
| `model` | `string` | Yes | The model to use for the evaluation. |
| `sampling_params` | `OpenAI.EvalGraderScoreModelSamplingParams` | No | The sampling parameters for the model. |
| `input` | `OpenAI.EvalItem[]` | Yes | The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings. |
| `range` | `OpenAI.numeric[]` | No | The range of the score. Defaults to `[0, 1]`. |

- **`sampling_params`** — `OpenAI.EvalGraderScoreModelSamplingParams`

The sampling parameters for the model.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `seed` | `OpenAI.integer \| null` | No |  |
| `top_p` | `OpenAI.numeric \| null` | No | _Default:_ `1` |
| `temperature` | `OpenAI.numeric \| null` | No |  |
| `max_completions_tokens` | `OpenAI.integer \| null` | No |  |
| `reasoning_effort` | `enum` | No | Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. - `xhigh` is supported for all models after `gpt-5.1-codex-max`. _Enum:_ `none`, `minimal`, `low`, `medium`, `high`, `xhigh` |

- **`input`** — `OpenAI.EvalItem[]`

The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.

**Array of** `OpenAI.EvalItem`**:**

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `role` | `enum` | Yes | The role of the message input. One of `user`, `assistant`, `system`, or `developer`. _Enum:_ `user`, `assistant`, `system`, `developer` |
| `content` | `OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject \| (OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject)[]` | Yes | Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. |
| `type` | `enum` | No | The type of the message input. Always `message`. _Constant:_ `message` |

- **`content`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject | (OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[]`

Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

**One of the following:**

- **`OpenAI.EvalItemContentItem`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.EvalItemContentArray`** — `OpenAI.EvalItemContentArray ((OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[])`

A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.GraderMulti`** — `OpenAI.GraderMulti`

A MultiGrader object combines the output of multiple graders to produce a single score.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `multi`. _Default:_ `"multi"` _Constant:_ `multi` |
| `name` | `string` | Yes | The name of the grader. |
| `graders` | `OpenAI.GraderStringCheck \| OpenAI.GraderTextSimilarity \| OpenAI.GraderPython \| OpenAI.GraderScoreModel \| OpenAI.GraderLabelModel` | Yes |  |
| `calculate_output` | `string` | Yes | A formula to calculate the output based on grader results. |

- **`graders`** — `OpenAI.GraderStringCheck | OpenAI.GraderTextSimilarity | OpenAI.GraderPython | OpenAI.GraderScoreModel | OpenAI.GraderLabelModel`

**One of the following:**

- **`OpenAI.GraderStringCheck`** — `OpenAI.GraderStringCheck`

A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `string_check`. _Constant:_ `string_check` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The input text. This may include template strings. |
| `reference` | `string` | Yes | The reference text. This may include template strings. |
| `operation` | `enum` | Yes | The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. _Enum:_ `eq`, `ne`, `like`, `ilike` |

- **`OpenAI.GraderTextSimilarity`** — `OpenAI.GraderTextSimilarity`

A TextSimilarityGrader object which grades text based on similarity metrics.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The type of grader. _Default:_ `"text_similarity"` _Constant:_ `text_similarity` |
| `name` | `string` | Yes | The name of the grader. |
| `input` | `string` | Yes | The text being graded. |
| `reference` | `string` | Yes | The text being graded against. |
| `evaluation_metric` | `enum` | Yes | The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. _Enum:_ `cosine`, `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, `rouge_l` |

- **`OpenAI.GraderPython`** — `OpenAI.GraderPython`

A PythonGrader object that runs a python script on the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `python`. _Constant:_ `python` |
| `name` | `string` | Yes | The name of the grader. |
| `source` | `string` | Yes | The source code of the python script. |
| `image_tag` | `string` | No | The image tag to use for the python script. |

- **`OpenAI.GraderScoreModel`** — `OpenAI.GraderScoreModel`

A ScoreModelGrader object that uses a model to assign a score to the input.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `score_model`. _Constant:_ `score_model` |
| `name` | `string` | Yes | The name of the grader. |
| `model` | `string` | Yes | The model to use for the evaluation. |
| `sampling_params` | `OpenAI.EvalGraderScoreModelSamplingParams` | No | The sampling parameters for the model. |
| `input` | `OpenAI.EvalItem[]` | Yes | The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings. |
| `range` | `OpenAI.numeric[]` | No | The range of the score. Defaults to `[0, 1]`. |

- **`sampling_params`** — `OpenAI.EvalGraderScoreModelSamplingParams`

The sampling parameters for the model.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `seed` | `OpenAI.integer \| null` | No |  |
| `top_p` | `OpenAI.numeric \| null` | No | _Default:_ `1` |
| `temperature` | `OpenAI.numeric \| null` | No |  |
| `max_completions_tokens` | `OpenAI.integer \| null` | No |  |
| `reasoning_effort` | `enum` | No | Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. - `xhigh` is supported for all models after `gpt-5.1-codex-max`. _Enum:_ `none`, `minimal`, `low`, `medium`, `high`, `xhigh` |

- **`input`** — `OpenAI.EvalItem[]`

The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.

**Array of** `OpenAI.EvalItem`**:**

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `role` | `enum` | Yes | The role of the message input. One of `user`, `assistant`, `system`, or `developer`. _Enum:_ `user`, `assistant`, `system`, `developer` |
| `content` | `OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject \| (OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject)[]` | Yes | Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. |
| `type` | `enum` | No | The type of the message input. Always `message`. _Constant:_ `message` |

- **`content`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject | (OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[]`

Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

**One of the following:**

- **`OpenAI.EvalItemContentItem`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.EvalItemContentArray`** — `OpenAI.EvalItemContentArray ((OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[])`

A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.GraderLabelModel`** — `OpenAI.GraderLabelModel`

A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | The object type, which is always `label_model`. _Constant:_ `label_model` |
| `name` | `string` | Yes | The name of the grader. |
| `model` | `string` | Yes | The model to use for the evaluation. Must support structured outputs. |
| `input` | `OpenAI.EvalItem[]` | Yes |  |
| `labels` | `string[]` | Yes | The labels to assign to each item in the evaluation. |
| `passing_labels` | `string[]` | Yes | The labels that indicate a passing result. Must be a subset of labels. |

- **`input`** — `OpenAI.EvalItem[]`

**Array of** `OpenAI.EvalItem`**:**

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `role` | `enum` | Yes | The role of the message input. One of `user`, `assistant`, `system`, or `developer`. _Enum:_ `user`, `assistant`, `system`, `developer` |
| `content` | `OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject \| (OpenAI.EvalItemContentText \| OpenAI.EvalItemContentItemObject)[]` | Yes | Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. |
| `type` | `enum` | No | The type of the message input. Always `message`. _Constant:_ `message` |

- **`content`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject | (OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[]`

Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.

**One of the following:**

- **`OpenAI.EvalItemContentItem`** — `OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

- **`OpenAI.EvalItemContentArray`** — `OpenAI.EvalItemContentArray ((OpenAI.EvalItemContentText | OpenAI.EvalItemContentItemObject)[])`

A list of inputs, each of which may be either an input text, output text, input image, or input audio object.

**One of the following:**

- **`OpenAI.EvalItemContentText`** — `OpenAI.EvalItemContentText`

A text input to the model.

| Type | Description |
|------|-------------|
| `OpenAI.EvalItemContentText` | A text input to the model. |

- **`OpenAI.EvalItemContentItemObject`** — `OpenAI.EvalItemContentItemObject`

A single content item: input text, output text, input image, or input audio.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `enum` | Yes | _Enum:_ `input_text`, `output_text`, `input_image`, `input_audio` |

###### `hyperparameters` — `OpenAI.FineTuneReinforcementHyperparameters`

The hyperparameters used for the reinforcement fine-tuning job.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `batch_size` | `enum` | No | Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. _Default:_ `"auto"` _Constant:_ `auto` |
| `learning_rate_multiplier` | `enum` | No | Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. _Default:_ `"auto"` _Constant:_ `auto` |
| `n_epochs` | `enum` | No | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. _Default:_ `"auto"` _Constant:_ `auto` |
| `reasoning_effort` | `enum` | No | Level of reasoning effort. _Default:_ `"default"` _Enum:_ `default`, `low`, `medium`, `high` |
| `compute_multiplier` | `enum` | No | Multiplier on amount of compute used for exploring search space during training. _Default:_ `"auto"` _Constant:_ `auto` |
| `eval_interval` | `enum` | No | The number of training steps between evaluation runs. _Default:_ `"auto"` _Constant:_ `auto` |
| `eval_samples` | `enum` | No | Number of evaluation samples to generate per training step. _Default:_ `"auto"` _Constant:_ `auto` |

### 4XX — Client error

Content-Type: `application/json`

Error response for API failures.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `error` | `OpenAI.Error` | Yes |  |

#### `error` — `OpenAI.Error`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `string \| null` | Yes |  |
| `message` | `string` | Yes |  |
| `param` | `string \| null` | No |  |
| `type` | `string` | No |  |
| `details` | `OpenAI.Error[]` | No |  |
| `additionalInfo` | `object` | No |  |
| `debugInfo` | `object` | No |  |

### 5XX — Server error

Content-Type: `application/json`

Error response for API failures.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `error` | `OpenAI.Error` | Yes |  |

#### `error` — `OpenAI.Error`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `string \| null` | Yes |  |
| `message` | `string` | Yes |  |
| `param` | `string \| null` | No |  |
| `type` | `string` | No |  |
| `details` | `OpenAI.Error[]` | No |  |
| `additionalInfo` | `object` | No |  |
| `debugInfo` | `object` | No |  |

## Code Examples

### Default

#### cURL

```bash
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"
  }'

```

#### Python

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
fine_tuning_job = client.fine_tuning.jobs.create(
    model="gpt-4o-mini",
    training_file="file-abc123",
)
print(fine_tuning_job.id)
```

#### JavaScript

```javascript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const fineTune = await openai.fineTuning.jobs.create({
    training_file: "file-abc123"
  });

  console.log(fineTune);
}

main();

```

#### Node.js

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fineTuningJob = await client.fineTuning.jobs.create({
  model: 'gpt-4o-mini',
  training_file: 'file-abc123',
});

console.log(fineTuningJob.id);
```

#### Go

```go
package main

import (
	"context"
	"fmt"

	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
)

func main() {
	client := openai.NewClient(
		option.WithAPIKey("My API Key"),
	)
	fineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
		Model:        openai.FineTuningJobNewParamsModelGPT4oMini,
		TrainingFile: "file-abc123",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v
", fineTuningJob.ID)
}

```

#### Java

```java
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.jobs.FineTuningJob;
import com.openai.models.finetuning.jobs.JobCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        JobCreateParams params = JobCreateParams.builder()
            .model(JobCreateParams.Model.GPT_4O_MINI)
            .trainingFile("file-abc123")
            .build();
        FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params);
    }
}
```

#### Ruby

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123")

puts(fine_tuning_job)
```

#### Response

```json
{
  "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",
  "method": {
    "type": "supervised",
    "supervised": {
      "hyperparameters": {
        "batch_size": "auto",
        "learning_rate_multiplier": "auto",
        "n_epochs": "auto",
      }
    }
  },
  "metadata": null
}

```

### Epochs

#### cURL

```bash
curl https://api.openai.com/v1/fine_tuning/jobs \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "training_file": "file-abc123",
    "model": "gpt-4o-mini",
    "method": {
      "type": "supervised",
      "supervised": {
        "hyperparameters": {
          "n_epochs": 2
        }
      }
    }
  }'

```

#### Python

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
fine_tuning_job = client.fine_tuning.jobs.create(
    model="gpt-4o-mini",
    training_file="file-abc123",
)
print(fine_tuning_job.id)
```

#### JavaScript

```javascript
import OpenAI from "openai";
import { SupervisedMethod, SupervisedHyperparameters } from "openai/resources/fine-tuning/methods";

const openai = new OpenAI();

async function main() {
  const fineTune = await openai.fineTuning.jobs.create({
    training_file: "file-abc123",
    model: "gpt-4o-mini",
    method: {
      type: "supervised",
      supervised: {
        hyperparameters: {
          n_epochs: 2
        }
      }
    }
  });

  console.log(fineTune);
}

main();

```

#### Node.js

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fineTuningJob = await client.fineTuning.jobs.create({
  model: 'gpt-4o-mini',
  training_file: 'file-abc123',
});

console.log(fineTuningJob.id);
```

#### Go

```go
package main

import (
	"context"
	"fmt"

	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
)

func main() {
	client := openai.NewClient(
		option.WithAPIKey("My API Key"),
	)
	fineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
		Model:        openai.FineTuningJobNewParamsModelGPT4oMini,
		TrainingFile: "file-abc123",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v
", fineTuningJob.ID)
}

```

#### Java

```java
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.jobs.FineTuningJob;
import com.openai.models.finetuning.jobs.JobCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        JobCreateParams params = JobCreateParams.builder()
            .model(JobCreateParams.Model.GPT_4O_MINI)
            .trainingFile("file-abc123")
            .build();
        FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params);
    }
}
```

#### Ruby

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123")

puts(fine_tuning_job)
```

#### Response

```json
{
  "object": "fine_tuning.job",
  "id": "ftjob-abc123",
  "model": "gpt-4o-mini",
  "created_at": 1721764800,
  "fine_tuned_model": null,
  "organization_id": "org-123",
  "result_files": [],
  "status": "queued",
  "validation_file": null,
  "training_file": "file-abc123",
  "hyperparameters": {
    "batch_size": "auto",
    "learning_rate_multiplier": "auto",
    "n_epochs": 2
  },
  "method": {
    "type": "supervised",
    "supervised": {
      "hyperparameters": {
        "batch_size": "auto",
        "learning_rate_multiplier": "auto",
        "n_epochs": 2
      }
    }
  },
  "metadata": null,
  "error": {
    "code": null,
    "message": null,
    "param": null
  },
  "finished_at": null,
  "seed": 683058546,
  "trained_tokens": null,
  "estimated_finish": null,
  "integrations": [],
  "user_provided_suffix": null,
  "usage_metrics": null,
  "shared_with_openai": false
}

```

### DPO

#### cURL

```bash
curl https://api.openai.com/v1/fine_tuning/jobs \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "training_file": "file-abc123",
    "validation_file": "file-abc123",
    "model": "gpt-4o-mini",
    "method": {
      "type": "dpo",
      "dpo": {
        "hyperparameters": {
          "beta": 0.1
        }
      }
    }
  }'

```

#### Python

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
fine_tuning_job = client.fine_tuning.jobs.create(
    model="gpt-4o-mini",
    training_file="file-abc123",
)
print(fine_tuning_job.id)
```

#### Node.js

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fineTuningJob = await client.fineTuning.jobs.create({
  model: 'gpt-4o-mini',
  training_file: 'file-abc123',
});

console.log(fineTuningJob.id);
```

#### Go

```go
package main

import (
	"context"
	"fmt"

	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
)

func main() {
	client := openai.NewClient(
		option.WithAPIKey("My API Key"),
	)
	fineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
		Model:        openai.FineTuningJobNewParamsModelGPT4oMini,
		TrainingFile: "file-abc123",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v
", fineTuningJob.ID)
}

```

#### Java

```java
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.jobs.FineTuningJob;
import com.openai.models.finetuning.jobs.JobCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        JobCreateParams params = JobCreateParams.builder()
            .model(JobCreateParams.Model.GPT_4O_MINI)
            .trainingFile("file-abc123")
            .build();
        FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params);
    }
}
```

#### Ruby

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123")

puts(fine_tuning_job)
```

#### Response

```json
{
  "object": "fine_tuning.job",
  "id": "ftjob-abc",
  "model": "gpt-4o-mini",
  "created_at": 1746130590,
  "fine_tuned_model": null,
  "organization_id": "org-abc",
  "result_files": [],
  "status": "queued",
  "validation_file": "file-123",
  "training_file": "file-abc",
  "method": {
    "type": "dpo",
    "dpo": {
      "hyperparameters": {
        "beta": 0.1,
        "batch_size": "auto",
        "learning_rate_multiplier": "auto",
        "n_epochs": "auto"
      }
    }
  },
  "metadata": null,
  "error": {
    "code": null,
    "message": null,
    "param": null
  },
  "finished_at": null,
  "hyperparameters": null,
  "seed": 1036326793,
  "estimated_finish": null,
  "integrations": [],
  "user_provided_suffix": null,
  "usage_metrics": null,
  "shared_with_openai": false
}

```

### Reinforcement

#### cURL

```bash
curl https://api.openai.com/v1/fine_tuning/jobs \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "training_file": "file-abc",
    "validation_file": "file-123",
    "model": "o4-mini",
    "method": {
      "type": "reinforcement",
      "reinforcement": {
        "grader": {
          "type": "string_check",
          "name": "Example string check grader",
          "input": "{{sample.output_text}}",
          "reference": "{{item.label}}",
          "operation": "eq"
        },
        "hyperparameters": {
          "reasoning_effort": "medium"
        }
      }
    }
  }'

```

#### Python

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
fine_tuning_job = client.fine_tuning.jobs.create(
    model="gpt-4o-mini",
    training_file="file-abc123",
)
print(fine_tuning_job.id)
```

#### Node.js

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fineTuningJob = await client.fineTuning.jobs.create({
  model: 'gpt-4o-mini',
  training_file: 'file-abc123',
});

console.log(fineTuningJob.id);
```

#### Go

```go
package main

import (
	"context"
	"fmt"

	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
)

func main() {
	client := openai.NewClient(
		option.WithAPIKey("My API Key"),
	)
	fineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
		Model:        openai.FineTuningJobNewParamsModelGPT4oMini,
		TrainingFile: "file-abc123",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v
", fineTuningJob.ID)
}

```

#### Java

```java
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.jobs.FineTuningJob;
import com.openai.models.finetuning.jobs.JobCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        JobCreateParams params = JobCreateParams.builder()
            .model(JobCreateParams.Model.GPT_4O_MINI)
            .trainingFile("file-abc123")
            .build();
        FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params);
    }
}
```

#### Ruby

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123")

puts(fine_tuning_job)
```

#### Response

```json
{
  "object": "fine_tuning.job",
  "id": "ftjob-abc123",
  "model": "o4-mini",
  "created_at": 1721764800,
  "finished_at": null,
  "fine_tuned_model": null,
  "organization_id": "org-123",
  "result_files": [],
  "status": "validating_files",
  "validation_file": "file-123",
  "training_file": "file-abc",
  "trained_tokens": null,
  "error": {},
  "user_provided_suffix": null,
  "seed": 950189191,
  "estimated_finish": null,
  "integrations": [],
  "method": {
    "type": "reinforcement",
    "reinforcement": {
      "hyperparameters": {
        "batch_size": "auto",
        "learning_rate_multiplier": "auto",
        "n_epochs": "auto",
        "eval_interval": "auto",
        "eval_samples": "auto",
        "compute_multiplier": "auto",
        "reasoning_effort": "medium"
      },
      "grader": {
        "type": "string_check",
        "name": "Example string check grader",
        "input": "{{sample.output_text}}",
        "reference": "{{item.label}}",
        "operation": "eq"
      },
      "response_format": null
    }
  },
  "metadata": null,
  "usage_metrics": null,
  "shared_with_openai": false
}


```

### Validation file

#### cURL

```bash
curl https://api.openai.com/v1/fine_tuning/jobs \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "training_file": "file-abc123",
    "validation_file": "file-abc123",
    "model": "gpt-4o-mini"
  }'

```

#### Python

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
fine_tuning_job = client.fine_tuning.jobs.create(
    model="gpt-4o-mini",
    training_file="file-abc123",
)
print(fine_tuning_job.id)
```

#### JavaScript

```javascript
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const fineTune = await openai.fineTuning.jobs.create({
    training_file: "file-abc123",
    validation_file: "file-abc123"
  });

  console.log(fineTune);
}

main();

```

#### Node.js

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fineTuningJob = await client.fineTuning.jobs.create({
  model: 'gpt-4o-mini',
  training_file: 'file-abc123',
});

console.log(fineTuningJob.id);
```

#### Go

```go
package main

import (
	"context"
	"fmt"

	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
)

func main() {
	client := openai.NewClient(
		option.WithAPIKey("My API Key"),
	)
	fineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
		Model:        openai.FineTuningJobNewParamsModelGPT4oMini,
		TrainingFile: "file-abc123",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v
", fineTuningJob.ID)
}

```

#### Java

```java
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.jobs.FineTuningJob;
import com.openai.models.finetuning.jobs.JobCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        JobCreateParams params = JobCreateParams.builder()
            .model(JobCreateParams.Model.GPT_4O_MINI)
            .trainingFile("file-abc123")
            .build();
        FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params);
    }
}
```

#### Ruby

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123")

puts(fine_tuning_job)
```

#### Response

```json
{
  "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": "file-abc123",
  "training_file": "file-abc123",
  "method": {
    "type": "supervised",
    "supervised": {
      "hyperparameters": {
        "batch_size": "auto",
        "learning_rate_multiplier": "auto",
        "n_epochs": "auto",
      }
    }
  },
  "metadata": null
}

```

### W&B Integration

#### cURL

```bash
curl https://api.openai.com/v1/fine_tuning/jobs \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "training_file": "file-abc123",
    "validation_file": "file-abc123",
    "model": "gpt-4o-mini",
    "integrations": [
      {
        "type": "wandb",
        "wandb": {
          "project": "my-wandb-project",
          "name": "ft-run-display-name"
          "tags": [
            "first-experiment", "v2"
          ]
        }
      }
    ]
  }'

```

#### Node.js

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fineTuningJob = await client.fineTuning.jobs.create({
  model: 'gpt-4o-mini',
  training_file: 'file-abc123',
});

console.log(fineTuningJob.id);
```

#### Python

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
fine_tuning_job = client.fine_tuning.jobs.create(
    model="gpt-4o-mini",
    training_file="file-abc123",
)
print(fine_tuning_job.id)
```

#### Go

```go
package main

import (
	"context"
	"fmt"

	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
)

func main() {
	client := openai.NewClient(
		option.WithAPIKey("My API Key"),
	)
	fineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
		Model:        openai.FineTuningJobNewParamsModelGPT4oMini,
		TrainingFile: "file-abc123",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v
", fineTuningJob.ID)
}

```

#### Java

```java
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.jobs.FineTuningJob;
import com.openai.models.finetuning.jobs.JobCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        JobCreateParams params = JobCreateParams.builder()
            .model(JobCreateParams.Model.GPT_4O_MINI)
            .trainingFile("file-abc123")
            .build();
        FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params);
    }
}
```

#### Ruby

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123")

puts(fine_tuning_job)
```

#### Response

```json
{
  "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": "file-abc123",
  "training_file": "file-abc123",
  "integrations": [
    {
      "type": "wandb",
      "wandb": {
        "project": "my-wandb-project",
        "entity": None,
        "run_id": "ftjob-abc123"
      }
    }
  ],
  "method": {
    "type": "supervised",
    "supervised": {
      "hyperparameters": {
        "batch_size": "auto",
        "learning_rate_multiplier": "auto",
        "n_epochs": "auto",
      }
    }
  },
  "metadata": null
}

```
