v1

latestOpenAPI 3.1.0MIT2026-07-13174391.2 KB
Reflex

Train a Reflex

Start a training job. OpenAI fine-tuning-compatible, with two differences: training data is inline (training_data, no Files API) and there are no hyperparameters. model selects the base to train from — omit it for a from-scratch cold start, or pass any custom or default reflex to warm-start from its weights. A small Reflex trains in about 30 seconds. Provide exactly one input mode — training_data, generate, or label_data.

post/v1/fine_tuning/jobs

Request body

modelstring

What to train from (OpenAI-style). Omit for a from-scratch cold start, or pass a custom or default reflex to warm-start from its weights: a model you trained (its suffix or job id) or a built-in reflex name like guardrail.

suffixstring

Names the served model. Becomes fine_tuned_model on success.

labelsstring[]

The classes. 2+ required for generate and label_data; inferred from training_data if omitted.

webhook_urlstring

An https URL that receives a signed webhook when the job reaches succeeded, failed, or cancelled.

auto_trainboolean

Train as soon as data prep finishes. Set false to pause at prepared for review, then call POST /v1/fine_tuning/jobs/{job_id}/train.

Example request

{
  "model": "guardrail",
  "suffix": "support-classifier",
  "labels": [
    "billing",
    "bug"
  ],
  "webhook_url": "https://example.com/webhooks/morph",
  "auto_train": true,
  "training_data": [
    {
      "text": "I need a refund for my order",
      "label": "billing"
    }
  ],
  "generate": {
    "description": "classify support tickets by topic",
    "examples_per_label": 25
  },
  "label_data": {
    "description": "support tickets"
  }
}

Response

The created job.

idstring

Job id, prefixed ftjob-.

objectstring
modelstring

What the job trained from: the reflex you warm-started from, or the from-scratch base for a cold start.

created_atinteger

Unix timestamp (seconds) at creation.

finished_atinteger nullable

Unix timestamp at a terminal state, else null.

fine_tuned_modelstring nullable

Served model name once succeeded (the suffix, or the job id if none).

status'queued' | 'validating_files' | 'running' | 'succeeded' | 'failed' | 'cancelled'

validating_files is the data-prep phase for generate/label_data jobs.

labelsstring[]
trained_examplesinteger

Number of training examples.

suffixstring nullable

Example response

{
  "id": "ftjob-a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "object": "fine_tuning.job",
  "model": "guardrail",
  "created_at": 1780107000,
  "finished_at": 1780107148,
  "fine_tuned_model": "support-classifier",
  "status": "succeeded",
  "labels": [
    "billing",
    "bug"
  ],
  "trained_examples": 10,
  "hyperparameters": {
    "n_epochs": 3,
    "batch_size": "auto",
    "learning_rate_multiplier": "auto"
  },
  "result": {
    "accuracy": 0.95,
    "f1_score": 0.94
  },
  "suffix": "support-classifier"
}