Skip to main content
API Reference: POST /fine_tuning/jobs

Provider capabilities

The table below summarizes gateway support for this endpoint by provider.
Legend:
  • ✅ Supported by provider and TrueFoundry
  • Provided by provider, but not by TrueFoundry
  • Provider does not support this feature
For every gateway endpoint and provider, see Supported APIs. This guide explains how to fine-tune models using TrueFoundry’s AI Gateway with OpenAI or Vertex AI providers.

Client Setup

All providers use the OpenAI SDK with provider-specific headers. Choose your provider to get started:

Training File Format

Create a JSONL file with one JSON object per line. Each line represents a conversation pair for training:

Workflow Steps

The finetuning process follows these steps for all providers:
  1. Upload: Upload training file → Get file ID
  2. Create: Create finetune job → Get job ID
  3. Monitor: Check status until complete
  4. Use: Use the fine-tuned model for inference

Step-by-Step Examples

Once the job status is succeeded, read the fine-tuned model identifier from the job:
To call the fine-tuned model through the AI Gateway, it must be available in your provider account. Open AI Gateway > Models and check the account’s model list — if the fine-tuned model does not appear there after the job succeeds, click Add Model > To Existing Provider Account and add it manually with the exact fine-tuned model ID from the job (for OpenAI, the ft:... identifier). Then call it like any other gateway model:
Fine-tuned models usually have no public pricing, so cost is not tracked for them automatically. Set a private cost on the model if you want spend recorded — see Set model pricing.

Status Reference

  • queued: Job is queued and waiting to start
  • running: Fine-tuning is in progress
  • succeeded: Fine-tuning completed successfully
  • failed: Fine-tuning failed

Hyperparameters

You can configure the following hyperparameters in the hyperparameters object:
  • n_epochs: Number of training epochs
  • batch_size: Batch size
  • learning_rate_multiplier: Learning rate multiplier