moth docs
Reference Create a job

Create a job

Starts an image, video or music job and answers at once with the job, which you then read until it succeeds.

POSThttps://api.runmoth.si/v1/jobs

Body

modelrequired

A media model ID from the catalog.

promptrequired

Up to 10,000 characters, or the model's max_prompt_chars when it is lower.

ninteger

Images to make, up to the model's max_images. Images only, and 1 by default.

duration_secondsinteger

The clip's length, one of the model's durations. Video only, and the first listed by default.

aspect_ratiostring

Such as 16:9, one of the model's aspect_ratios, for images and video.

sizestring

Such as 1536x1024, turned into a ratio when aspect_ratio isn't sent. Images only.

stylestring

A style for the song, up to 200 characters. Music only.

instrumentalboolean

A song with no vocals. Music only.

It answers 202 with the job's hold taken. POST /images is the same endpoint limited to image models, and Images, video and music walks through a whole job.

Errors

400invalid_request_errorThe body isn't valid, names a chat model, or asks for a setting the model doesn't take
401authentication_errorThe key is missing, revoked or expired
402insufficient_creditThe balance or the key's cap can't cover the job's hold
403permission_errorThe key may not use this model
404not_found_errorThe model isn't in the catalog
429rate_limit_errorToo many calls from the key or the account, or to the model, so wait for retry-after when it is sent
503overloaded_errorMoth is briefly at capacity, so wait for retry-after
529overloaded_errorThe model is paused, or busy or down at its host, so choose another or wait for retry-after when it is sent
curl https://api.runmoth.si/v1/jobs \
  -H "Authorization: Bearer $MOTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "nano-banana-2", "prompt": "A moth resting on a warm lamp at night", "n": 1, "aspect_ratio": "3:2" }'
Response
moth-request-id  req_4Gk9tQ2wXb7Lm1Pz8RcV
{
  "id": "job_7Hc2pW9kLm4Qx8Rt1Vz3",
  "object": "job",
  "model": "nano-banana-2",
  "modality": "image",
  "status": "running",
  "created_at": 1793347200,
  "completed_at": null,
  "unit": "image",
  "units": 1,
  "held_usd": "0.047059",
  "charged_usd": null,
  "progress": 0,
  "outputs": []
}