Skip to main content
The Fine-tuning API proxies fine-tuning job management to the configured provider. All endpoints follow the OpenAI fine-tuning API contract. The correct operation is determined automatically by the HTTP method and the presence of a :jobId path parameter.
Fine-tuning requires uploading a training file first. Use POST /v1/files with purpose=fine-tune to prepare your data.

Endpoint routing

All fine-tuning requests are handled at /v1/fine_tuning/jobs/:jobId?/:cancel?. The gateway dispatches to the correct operation based on the method and path:

List fine-tuning jobs

GET /v1/fine_tuning/jobs Returns a list of fine-tuning jobs for the configured provider.

Request

string
required
The provider to route the request to.
string
required
Your Portkey API key or provider API key.
number
default:"20"
Maximum number of jobs to return.
string
Cursor for pagination. Pass the id of the last job from the previous page.

Response

string
Always list.
array
Array of fine-tuning job objects.
boolean
Whether additional jobs are available.

Create a fine-tuning job

POST /v1/fine_tuning/jobs Creates a new fine-tuning job. The request body is forwarded directly to the provider.

Request

string
required
The provider to route the request to.
string
required
Your Portkey API key or provider API key.
string
required
The ID of the uploaded training file (must have purpose=fine-tune).
string
required
The base model to fine-tune. For example, gpt-4o-mini-2024-07-18.
string
The ID of an optional validation file.
object
string
A string of up to 18 characters appended to the fine-tuned model name.
object
Optional key-value metadata to attach to the job.

Response

string
Unique identifier for the fine-tuning job.
string
Always fine_tuning.job.
string
The base model being fine-tuned.
string
The name of the fine-tuned model once training completes. null while in progress.
string
Current job status. Values: validating_files, queued, running, succeeded, failed, cancelled.
number
Unix timestamp when the job was created.
number
Number of tokens used in training, or null if not yet available.

Retrieve a fine-tuning job

GET /v1/fine_tuning/jobs/:id Retrieves details for a specific fine-tuning job. Use this to poll the status of an in-progress job.

Request

string
required
The ID of the fine-tuning job to retrieve.
string
required
The provider to route the request to.
string
required
Your Portkey API key or provider API key.

Response

Returns a single fine-tuning job object. See Create a fine-tuning job for the full field list.

Cancel a fine-tuning job

POST /v1/fine_tuning/jobs/:id/cancel Cancels a fine-tuning job that is queued or running.
Once a job is cancelled it cannot be resumed. Any compute costs incurred up to the cancellation point may still apply.

Request

string
required
The ID of the fine-tuning job to cancel.
string
required
The provider to route the request to.
string
required
Your Portkey API key or provider API key.

Response

Returns the updated fine-tuning job object with status: cancelled.