Documentation
Fine-tuning
View .mdOpenAPI

Create a batch or training job

POSThttps://weights.fyi/run/v1/jobsscope: submit
text
POST https://weights.fyi/run/v1/jobs
Authorization: Bearer <token>                    scope: submit
Content-Type: application/json
[Idempotency-Key: <your key>]
[traceparent: <W3C trace context>]

{"kind": "finetune", "dataset": "<dataset_id>", ["model": "<base model>",] ["recipe": "<recipe>",]
 ["objective": "sft" | "dpo" | "specialist_heads",] ["replay_weights": {"<cohort>": w},]
 ["manifest_uri": "<uri>", "manifest_sha256": "<64 hex>",] ["schedule": {...},]
 ["options": {"epochs": n, "patience": n, "seed": n, "checkpoint_seconds": s}]}
Available since
2026-10-08, when fine-tuning went live on weights.fyi/run. Fine-tuning is switched on for this service. Training further from a model you trained: not available yet.
Answer time
synchronous for the admission only: the answer comes as soon as the job is checked against your credit and queued. The training itself runs afterwards, at about 72 pages a second (measured on a training run of this model on 2026-10-08).

Starts a training job on a ready dataset of yours and leaves a model of your own, ft_ and the job's 24 hexadecimal characters. The dataset's format decides what is trained: the page classifier, a Laya specialist, a multi-head specialist, or a generative student by supervised fine-tuning (SFT) or preference optimisation (DPO); the table below pairs formats, base models and recipes. Only a JSON body with "kind": "finetune" comes here; other bodies are page batches. The job waits for the model and for any other training job, then prepares, trains, and resumes from its last checkpoint after a move (Fine-tune a model).

Admission checks an estimate: epochs x training pages x the tokens a page usually holds, at the price per 1M training tokens the job keeps; it is charged per token trained. Your available credit must cover it (402 training_not_covered), and it is then set aside while the job is open. Starting the model and a move cost nothing. A token's daily cap counts what is left of open estimates every UTC day, and a job at the cap stops cleanly with waiting_for: "token_daily_cap" until a later day or a higher cap; if credit runs out, it waits for credit. Dataset rules the upload does not check fail the job in its preparing step: check them first (PUT /v1/datasets/{dataset_id}/content).

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and your token. The token needs the submit scope, and the call counts against the token's request rate.
Content-Typeheaderyesapplication/json.
Idempotency-KeyheadernoAny string you choose, one per training job. The same request sent again with the same key returns the first answer and starts no second job.
traceparent, tracestateheadernoA W3C trace context; when it is valid, the job's spans join your trace.
kindbodyyesfinetune. Without it the body is read as a page batch.
datasetbodyyesThe dataset to train on, ds_ followed by 24 hexadecimal characters; it must be yours and ready. dataset_id is accepted as the same field.
modelbodynoThe base to train; base_model is accepted as the same field. Left out, it is the dataset's own base model for a specialist or student dataset, else laya-page-role-base. A base the dataset cannot train answers 400 model_not_available, whose trainable lists those it can.
recipebodynoA recipe from the table below. Left out, the dataset's format decides. For page roles: laya-page-role/v2 (default: AdamW at 2e-5 after 200 warm-up steps, then a linear decay to zero, 8 pages a step) or laya-page-role/v1 (a constant rate after the warm-up).
objectivebodynosft, dpo or specialist_heads. Without a recipe, dpo and specialist_heads select their recipes. It must agree with the recipe, and the recipe with the dataset's format.
replay_weightsbodynoA nonempty object from cohort name to a positive finite weight, such as {"new_delta": 3.0, "historical_replay": 1.0}: a row naming that cohort trains at it unless the row carries its own weight.
manifest_uri, manifest_sha256bodynoThe dataset release the job trains from: a storage or HTTPS URI, and 64 lower-case hexadecimal digits. For a dataset registered from an external source they must equal the registered values.
base_checkpoint_uribodynoAccepted only empty or absent. A job starts from its base model; any other value answers 400 checkpoint_reference_unsupported.
schedulebodynoWhen the job may ask for the model to be started, with the fields of a page batch's schedule.
optionsbodynoAny of epochs (1 to 10, default 10), patience (epochs without a better validation macro-F1 before stopping; default 3 in v2, 10 in v1; at most epochs, so {"epochs": 2} alone is refused for patience, bounds 1 to 2), seed (default 1729) and checkpoint_seconds (default 300; down to 16.8, one checkpoint's measured write and store on 2026-10-08, never above the default). Other keys are refused.
Dataset formatBase modelRecipeTrained objective
laya-page-role/jsonllaya-page-role-baselaya-page-role/v2, laya-page-role/v1sft
laya-specialist/jsonlThe dataset's own Laya specialistlaya-specialist/v1sft
laya-specialist-heads/jsonllaya-specialist-heads-baselaya-specialist-heads/v1specialist_heads
laya-sft-chat/jsonlThe dataset's own generative student baselaya-student-lora-sft/v1sft
laya-dpo-preference/jsonlThe dataset's own generative student baselaya-student-lora-dpo/v1dpo

Return value

201 Created when the job is admitted and queued.

FieldMeaning
job_idThe job's identifier, job_ followed by 24 hexadecimal characters. The trained model will be ft_ followed by the same 24 characters.
kindfinetune.
modelThe base being trained.
datasetThe dataset it trains on.
recipe, objectiveThe recipe it follows and the objective that recipe trains.
training_intentOnly when the request carried intent: the objective, replay_weights, manifest_uri and manifest_sha256 kept with the job.
model_state, cold_start, scheduleAs on a page batch: the model's state, the expected start when it was not ready, and the schedule's verdict for a scheduled job.
optionsEvery option in force, your choices over the recipe's defaults: epochs, patience, seed and checkpoint_seconds.
statusQUEUED.
statequeued.
traceparentThe job's own trace context, to link your traces to.
estimate.usd_for_jobThe estimate in US dollars.
estimate.usd_microsThe same in micro-dollars, rounded: the amount set aside from your available credit while the job is open.
estimate.training_tokens, estimate.usd_per_1m_training_tokensThe training tokens the estimate assumes, and the price per 1M the job keeps.
estimate.basisThe estimate in words, with the speed it rests on and its date.
Location, traceparent (headers)The job's path, and its trace context.

Errors

StatusCodeWhen it happensWhat to do
400invalid_body, invalid_jsonThe body is not JSON, names no dataset, or options is not an object; expected shows the shape.Send the body as above.
400model_not_availableThe model named is not one this dataset can train; trainable lists those it can.Name one of them, or leave it out.
400recipe_not_availableThe recipe is unknown; available lists the recipes.Name one of them, or leave it out.
400invalid_objective, objective_recipe_mismatch, dataset_format_mismatchAn unknown objective (expected lists them), one the recipe does not train (recipe_objective), or a recipe whose record format (expected) is not the dataset's.Align objective, recipe and dataset by the table above.
400invalid_replay_weights, invalid_manifest_uri, invalid_manifest_sha256, manifest_mismatchA malformed intent field, or a manifest other than the one the dataset was registered with (field).Fix the field named.
400checkpoint_reference_unsupportedA nonempty base_checkpoint_uri.Leave it out.
400invalid_schedule, invalid_schedule_windowA schedule that is not valid; message says why.Fix the field named.
400option_out_of_rangeAn option is outside its bounds, not a number, or not one of the four; option names it, low and high give the bounds where there are any.Stay inside the bounds; lower patience with epochs.
400dataset_label_mismatchThe dataset was made for a label set other than the base model's.Make the dataset for this base.
401unauthorized, invalid_token, token_revoked, token_expiredNo token, or one that does not work (any more).Use a valid token.
402training_not_coveredYour available credit is less than the estimate; needed_usd_micros and available_usd_micros give both.Add credit, or ask for fewer epochs.
402token_daily_capThe estimate would pass the token's spend cap for the UTC day; resets_at says when the day ends.Wait for the reset, or raise the cap on your panel.
403scope_required, account_suspendedThe token lacks submit, or the account is suspended.Use a token with submit.
404dataset_not_foundThe dataset does not exist or belongs to another account.Check the id.
404not_configuredFine-tuning is not switched on for this service (feature: training).See Fine-tune a model.
409dataset_not_readyThe dataset's upload is not finished, or it failed; status says which.Upload it, or make a new dataset.
409idempotency_key_in_progressAn earlier request with this key is still running.Wait, then send again with the same key.
422idempotency_key_reusedThe key was used before for a different request.Use a new key.
429rate_limitedThe token sends work faster than its request rate.Wait the Retry-After seconds, then send again with the same key.
429overloadedThe service holds as much unfinished work as it takes (reason: queue_full); nothing was accepted.Wait the Retry-After seconds, then send again with the same key.

Examples

Four epochs on a small test dataset, from a test copy of the service (so the estimate is not a live price; model_state is left out):

sh
curl -s -i https://weights.fyi/run/v1/jobs \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: finetune-my-pages-1" \
  -d '{"kind": "finetune", "model": "laya-page-role-base", "dataset": "DATASET_ID", "recipe": "laya-page-role/v2", "options": {"epochs": 4, "patience": 3}}'
text
HTTP/1.1 201 Created
Content-Type: application/json
Location: /run/v1/jobs/job_a698e920d5f0db918008bc43
traceparent: 00-22f0dbf2bea34f47b832073adda56a66-459770a64a0f7855-01

{
  "job_id": "job_a698e920d5f0db918008bc43",
  "kind": "finetune",
  "model": "laya-page-role-base",
  "dataset": "ds_12be8b8818ceaf13696e7ff9",
  "recipe": "laya-page-role/v2",
  "objective": "sft",
  "options": {"epochs": 4, "patience": 3, "seed": 1729, "checkpoint_seconds": 300.0},
  "status": "QUEUED",
  "state": "queued",
  "traceparent": "00-22f0dbf2bea34f47b832073adda56a66-459770a64a0f7855-01",
  "estimate": {
    "usd_for_job": 0.0011111111111111111,
    "usd_micros": 1111,
    "training_tokens": 181346,
    "usd_per_1m_training_tokens": 0.006127,
    "basis": "An estimate: 4 epochs over 40 training pages at about 1,133 tokens a page, the tokens our trainer fed a page of a real release, about 181,346 training tokens at $0.0061 per 1M. The validation pass is not charged. The job is charged for the tokens the trainer actually trains, as it trains; its cost so far is on your panel and its job page."
  }
}

History

  • 2026-10-08: live, with the estimate as admission; the live drill moved a training job mid-epoch without losing a step.
  • 2026-10-09 (merged): admission counts waiting pages; the daily cap counts open training and stops a job at the cap.
  • 2026-10-10 implementation review: 429 overloaded, recovered retries, the dataset checked at upload.
  • 2026-11-16: documented specialist, multi-head and student (SFT, DPO) training, the intent fields and schedule; laya-page-role-base is one base among several.

See also

GET /v1/quote (finetune), GET /v1/jobs/{job_id}, GET /v1/jobs/{job_id}/results, Errors and limits for retries.