curl https://api.runmoth.ai/v1/images \
-H "Authorization: Bearer $MOTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-3-klein",
"prompt": "A lighthouse on a cliff at dusk",
"aspect_ratio": "1:1"
}'
# The reply is a job. Set JOB_ID to its id and poll it until its status is succeeded or failed,
# then fetch each output. Its charged_usd is what the job cost once it ends
curl https://api.runmoth.ai/v1/jobs/$JOB_ID -H "Authorization: Bearer $MOTH_API_KEY"
curl https://api.runmoth.ai/v1/jobs/$JOB_ID/output/0 -H "Authorization: Bearer $MOTH_API_KEY" -o output-0
Every image, video and music call returns a job, so the code polls it until it ends and then saves each output. Keys start with moth_, and the job reports what it cost in its charged_usd once it ends.
What a workload costs
At $0.00855 per image
With MothAt listYou save
Per call$0.00855$0.00900$0.00045
Per day$0.855$0.900$0.045
Over 30 days$25.65$27.00$1.35
The Moth price is what your balance is charged, settled to the micro-dollar on each call. Over 30 days that is 5% below list.
Your use
Last 30 days
Parameters
What POST /v1/images takes for this model
modelstringRequired
flux-3-klein
promptstringRequired
Up to 5,000 characters.
ninteger
Images per call, 1 to 4. Each is billed.
aspect_ratiostring
One of 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, 9:21.