Media generation
Media runs as asynchronous jobs: submit, poll, download. Output is copied into platform storage as soon as the job finishes, so it does not expire with the provider.
Endpoints
| Endpoint | Produces |
|---|---|
| POST /v1/images/generations | Images |
| POST /v1/videos | Video |
| POST /v1/audio/speech | Speech audio |
| POST /v1/audio/transcriptions | Text from uploaded audio |
| POST /v1/music/generations | Music |
| POST /v1/workflows | Whatever the workflow graph produces |
Submit a job
curl https://api.openmayhem.ai/v1/images/generations \
-H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tongyi/z-image-turbo",
"prompt": "A lighthouse on a cliff at dusk",
"size": "1024x1024"
}'
# → { "id": "JOB_ID", "status": "running", "polling_url": "/v1/jobs/JOB_ID" }Poll it
curl https://api.openmayhem.ai/v1/jobs/JOB_ID \
-H "Authorization: Bearer $OPENMAYHEM_API_KEY"
# When completed, the job lists artifacts and the final cost:
# { "status": "completed", "cost": "0.002500",
# "artifacts": [{ "id": "ARTIFACT_ID", "content_type": "image/png", ... }] }GET /v1/jobs lists your recent jobs; DELETE /v1/jobs/JOB_ID cancels a running one. A cancelled job is charged exactly for the work its receipt records, never the full estimate.
Download artifacts
curl -L https://api.openmayhem.ai/v1/artifacts/ARTIFACT_ID \
-H "Authorization: Bearer $OPENMAYHEM_API_KEY" -o image.pngThe artifact route checks ownership and redirects to a signed URL valid for a few minutes. Artifacts are retained for 30 days.
Billing holds a worst-case estimate at submission and settles to the receipted amount at completion. A job that fails without producing work charges nothing; a partial failure charges only what the provider’s receipt records.