Music
Music generation follows the same asynchronous job pattern as Video: submit with a required Idempotency-Key, get 202, poll or receive a signed webhook, cancel or delete with DELETE.
POST
/v1/music/generations202 · Idempotency-Key REQUIREDGET
/v1/music/generations/{id}pollDELETE
/v1/music/generations/{id}cancel or deleteGET
/v1/jobs/{id}kind-agnostic job viewProvider availability
Real music providers are not yet wired. Unless the mock media provider is enabled by your operator, submissions return 501 not_implemented. Check GET /v1/models for modality: "music" models.
Submit
bash
curl "https://api.smartapihub.com/v1/music/generations" \
-H "Authorization: Bearer $LLM_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "vendor/music-model",
"prompt": "Lo-fi hip hop, warm vinyl crackle, 80 bpm, rainy evening",
"duration_seconds": 60,
"format": "mp3",
"instrumental": true,
"webhook_url": "https://api.example.com/hooks/llm-jobs"
}'| Field | Type | Notes |
|---|---|---|
model | string, required | A modality: "music" model. |
prompt | string ≤ 10,000, required | |
duration_seconds | number 1–600 | Drives the cost estimate (per_music_second). |
format | mp3 | wav | flac | Output container. |
sample_rate | integer | e.g. 44100, where supported. |
instrumental | boolean | No vocals. |
webhook_url | https URL | Public hosts only. |
metadata | object of strings | Echoed back. |
max_cost_micro | integer | Cap the reservation. |
routing | object | Routing override. |
Response — 202 Accepted
json
{
"id": "5b7e2d10-3c4f-4a9b-8e21-0f6c9a7d2b44",
"object": "music.generation",
"status": "queued",
"model": "vendor/music-model",
"created_at": "2026-09-04T10:15:00Z",
"estimated_cost_micro": 120000
}Poll, cancel, webhooks
Identical to video — the job object has object: "music.generation" and kind: "music", and artifacts have content_type such as audio/mpeg with duration_seconds set:
json
{
"id": "5b7e2d10-3c4f-4a9b-8e21-0f6c9a7d2b44",
"object": "music.generation",
"kind": "music",
"status": "succeeded",
"progress": 100,
"cost_micro": 118000,
"artifacts": [
{
"id": "d1e2…",
"type": "audio",
"content_type": "audio/mpeg",
"size_bytes": 1440000,
"width": null,
"height": null,
"duration_seconds": 60,
"url": "https://media.example.com/artifacts/…/d1e2.mp3?X-Amz-Expires=3600&…",
"expires_at": "2026-09-04T11:20:00Z"
}
],
"…": "other MediaJob fields as documented for video"
}- Poll
GET /v1/music/generations/{id}(orGET /v1/jobs/{id}) with backoff. DELETEcancels non-terminal jobs (→canceled, reservation released) or deletes terminal ones (204).- Webhooks carry
event: "job.completed" | "job.failed"and anX-LLM-Signature: sha256=…HMAC; verify exactly as shown in Video → Webhooks. - Same state machine:
queued → submitted → running → succeeded, withfailed,canceled,expiredas the other terminal states. - Same error codes.