Create Fine-tuning Job
Train a custom Reflex at /v1/fine_tuning/jobs
Overview
Creates a fine-tuning job that trains a custom Reflex from labeled examples. The resultingfine_tuned_model id is usable in POST /v1/reflex/predict when the job succeeds. Track progress with job events.Authorizations
Morph API key, passed as Authorization: Bearer sk-.... Create keys at https://www.morphllm.com/dashboard/api-keys.
Body
The training set (or the instructions to build one) plus the name to serve it under.
Provide exactly one input: training_data, generate, or label_data. The training set must end up with 2+ labels and 5+ examples per label.
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.
"guardrail"
Names the served model. Becomes fine_tuned_model on success.
"support-classifier"
The classes. 2+ required for generate and label_data; inferred from training_data if omitted.
One class name.
An https URL that receives a signed webhook when the job reaches succeeded, failed, or cancelled.
"https://example.com/webhooks/morph"
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.
true
Labeled rows you supply (input mode 1).
Input mode 2: synthesize training data from a description.
Input mode 3: sort your unlabeled text into your classes.
Response
The created job.
An OpenAI-compatible fine_tuning.job, with additive Reflex fields (labels, trained_examples, result, suffix).
Job id, prefixed ftjob-.
"ftjob-a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
Always fine_tuning.job.
"fine_tuning.job"
What the job trained from: the reflex you warm-started from, or the from-scratch base for a cold start.
"guardrail"
Unix timestamp (seconds) at creation.
1780107000
Unix timestamp at a terminal state, else null.
1780107148
Served model name once succeeded (the suffix, or the job id if none).
"support-classifier"
validating_files is the data-prep phase for generate/label_data jobs.
queued, validating_files, running, succeeded, failed, cancelled "succeeded"
The classes this job trained on.
One class the model predicts.
Number of training examples.
10
Fully managed.
{accuracy, f1_score} when succeeded, else null. Each value may be null.
{code, message, param} when failed, else null.
The suffix supplied at creation, else null.
"support-classifier"