Skip to content

train

Managementcatalog

Train Models

Not in the default tool list

This tool lives in the tool catalog. Discover it with scenario_tools_search (or enumerate everything with scenario_tools_list) and run it via scenario_tool_execute_write. To list every tool directly, connect with ?toolsets=full.

Manage custom model training: upload_images uploads a dataset, update_image replaces a training image, delete_image removes one, set_pairs replaces pair mappings, configure estimates cost, start launches training, and stop cancels it. Changes can replace or delete dataset entries or end a run; confirm the exact target and requested change first. config fields: epochs, nb_repeats, batch_size, learning_rate, sample_prompts, sample_source_images. action="start" is the ONLY action that launches training. It is paid and irreversible: CU are charged when the job is created, not as epochs complete. action="stop" refunds nothing, even at 0%. Get the user's explicit go-ahead on the quoted CU before starting. action="configure" always sends ?dryRun=true: it never creates a job or charges. To launch the quote, repeat as action="start" with the same config. start with dry_run=true also only estimates. Image captions are asset descriptions: edit a training image's caption with asset_update metadata.description (catalog-only — run via scenario_tool_execute_write). Returns: dataset changes, cost estimates or training state. Estimates carry creativeUnitsCost, training_started=false and no job. A real start returns a job; track it with jobs_wait or job_get. Examples: - "Upload training images" -> action="upload_images", model_id="model_xxx", images=["asset_xxx", "asset_yyy"] (upload local files with upload_asset first) - "Estimate 20 epochs" -> action="configure", model_id="model_xxx", config={"epochs": 20} - "Start training with 12 epochs" (after the user approved the quote) -> action="start", model_id="model_xxx", config={"epochs": 12, "sample_prompts": ["a mountain village at night", "a stone bridge over a river"]} - "Start training with defaults" -> action="start", model_id="model_xxx" Don't use when: running inference on an existing model — use model_run.
destructiveopen-world

Parameters

NameTypeRequiredDescription
actionenum(upload_images | update_image | delete_image | set_pairs | configure | start | stop)✓Training action: upload_images, update_image, delete_image, set_pairs, configure, start, or stop. Only 'start' launches paid training; 'configure' prices a configuration without launching.
model_idstring✓Model ID (required for all training actions).
training_image_idstring—Training image ID (for update_image/delete_image); it is the image's asset id. update_image swaps in a different asset: the training image takes that asset's id (returned as trainingImage.id) and that asset's own caption. A caption set on the replaced image does not carry over; caption the returned id instead.
imagesarray—Asset IDs of pre-uploaded images (for upload_images). Pass the IDs returned by upload_asset, or existing asset_ids not raw URLs.
image_datarecord—For update_image, the replacement image: assetId (an existing asset) or data (a data URL) plus name. Captions cannot be set here: edit them with asset_update metadata.description (catalog-only — run via scenario_tool_execute_write). For set_pairs, the pairs as { body: [{ sourceId, targetId, instruction }] }.
configunknown—Training hyper-parameters. Required for configure (which only prices them); pass the same object to start to launch with them.
dry_runboolean—Estimate cost without running. Sends ?dryRun=true so the API returns the cost estimate without starting the training job. Only meaningful for action=start (configure is always a dry run and ignores dry_run=true; dry_run=false is rejected there).
team_idstring—Team ID. Required with project_id for OAuth callers; an API key is scoped by the key.
project_idstring—Project ID. Required with team_id for OAuth callers; an API key is scoped by the key.
response_formatenum(json | markdown)jsonOutput format: 'json' for structured data, 'markdown' for human-readable text.

Example Request

JSON
{
  "action": "upload_images",
  "model_id": "model_custom_abc",
  "images": [
    "https://cdn.example.com/ref1.png",
    "https://cdn.example.com/ref2.png",
    "https://cdn.example.com/ref3.png"
  ],
  "team_id": "team_abc123",
  "project_id": "proj_xyz789"
}

Example Response

JSON
{
  "status": "uploaded",
  "count": 3
}

Common Use Cases

  • Upload reference images to a model before starting fine-tuning
  • Configure training hyperparameters like steps and learning rate
  • Start or stop a training job programmatically
  • Pair before/after training images with an edit instruction for image-editing training