Skip to main content
Everything the cloud trainer does is in the API: build a dataset, caption it, train one LoRA per base model, and download the final LoRA and its checkpoints. Agents get the same through the MCP server.

Script LoRA training against the API. Paste into Claude Code, Cursor or VS Code in your project, and your agent writes the dataset, caption and training calls for you.

Open in Cursor

Before you start

Create a production key (sk_live_) with these scopes. New keys don’t have them, so tick them when you create the key. See Authentication. A sandbox key (sk_test_) can build and edit datasets. Training, auto-caption, synthetic images and LoRA tests run on GPUs, so a sandbox key gets 422 with sandbox_unsupported.

1. Create a dataset

POST /v1/datasets · scope training:write
The trigger word is added to the front of every caption when training starts, so don’t repeat it in captions. GET /v1/datasets lists your datasets, newest first; reuse one rather than building it again.

2. Add images

Upload each JPG, PNG or WebP image the way Uploads describes (POST /v1/uploads with "kind":"image", then PUT the bytes), then add the upload_keys: POST /v1/datasets/{id}/items · scope training:write
The answer is the dataset with every image and its id. Up to 200 images per call; 10 to 50 trains well. To set or change a caption: PATCH /v1/datasets/{id}/items/{itemId} · scope training:write
To set every image and caption in one call, PUT /v1/datasets/{id}/items with {"items":[{"assetId":"<upload_key>","caption":"..."}]}; it replaces the dataset’s images with that list. DELETE /v1/datasets/{id}/items/{itemId} removes one image.

From a character

For a character built in Omnichar Cloud, copy the photos it was built from: POST /v1/datasets/{id}/import-character · scope training:write · body {"characterId":"..."} With only a few photos, generate 12, 24 or 48 more of the character in varied angles, light and expressions. They are captioned and added for you: POST /v1/datasets/{id}/synthetic · scope training:write · body {"characterId":"...","size":12} The answer has a planId and the credits it holds. Poll GET /v1/builds/{planId} until stage is done; synthetic.done and synthetic.total count the images. Each image is priced like a 1K character image, and one that fails is not charged. See Pricing.

3. Caption it

POST /v1/datasets/{id}/caption · scope training:write
credits is the most it can cost. You are charged per caption written, so an image it can’t caption costs nothing. Poll GET /v1/datasets/{id}/caption/{jobId} until state is completed; the captions are then on the dataset. GET /v1/datasets/{id} also returns captionCreditsPerImage, the price per image.

4. Price and start training

The model slugs are train-lora-flux-2-klein-4b, train-lora-krea-2, train-lora-krea-2-turbo, train-lora-z-image, train-lora-moss-image, train-lora-minimax-h3 and train-lora-ltx-2-5; Base models says what each is for. POST /v1/training/estimate · scope training:read
POST /v1/training · scope training:write
The estimate is held when the run starts. You pay for the GPU time used, the rest comes back, and a failed run costs nothing. A model with no free GPU comes back in refused while the others start.

5. Get the LoRA

Poll GET /v1/training (filter with characterId or status) or GET /v1/runs/{runId} until the run completes. Then: GET /v1/runs/{runId}/outputs · scope training:read or runs:read
The output with checkpoint: false is the final LoRA; each checkpoint carries its step. Links expire: download right away, or ask for the outputs again. To render a test image with the LoRA, POST /v1/training/{runId}/test with {"prompt":"...","step":200}, and read the result as a normal run. POST /v1/training/{runId}/retry trains a failed run again on the same settings.

Errors

See Errors for the response body.