LLM Gatewaydocs

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 REQUIRED
GET/v1/music/generations/{id}poll
DELETE/v1/music/generations/{id}cancel or delete
GET/v1/jobs/{id}kind-agnostic job view
Provider 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"
  }'
FieldTypeNotes
modelstring, requiredA modality: "music" model.
promptstring ≤ 10,000, required
duration_secondsnumber 1–600Drives the cost estimate (per_music_second).
formatmp3 | wav | flacOutput container.
sample_rateintegere.g. 44100, where supported.
instrumentalbooleanNo vocals.
webhook_urlhttps URLPublic hosts only.
metadataobject of stringsEchoed back.
max_cost_microintegerCap the reservation.
routingobjectRouting 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} (or GET /v1/jobs/{id}) with backoff.
  • DELETE cancels non-terminal jobs (→ canceled, reservation released) or deletes terminal ones (204).
  • Webhooks carry event: "job.completed" | "job.failed" and an X-LLM-Signature: sha256=… HMAC; verify exactly as shown in Video → Webhooks.
  • Same state machine: queued → submitted → running → succeeded, with failed, canceled, expired as the other terminal states.
  • Same error codes.