Skip to main content
POST
/
generate
/
audio
Generate audio
curl --request POST \
  --url https://api.horizon.new/v1/generate/audio \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "<string>",
  "voice": "<string>",
  "tempo": 135,
  "durationSeconds": 60,
  "webhookUrl": "<string>"
}'
{
  "jobId": "job_01hx9q9",
  "status": "queued",
  "statusUrl": "<string>",
  "result": {},
  "etaSeconds": 123,
  "jobType": "extract/pdf"
}
Render high-quality speech or music stems based on a descriptive prompt. Audio is delivered in both lossless (.wav) and compressed (.mp3) formats for immediate use in your products or marketing materials.

Request body

  • prompt — Required narrative or sonic description.
  • voice — Optional voice preset slug for speech synthesis.
  • tempo — Optional beats per minute when generating music; ignored for spoken word.
  • durationSeconds — Optional cap on clip length (up to 300); defaults to 60.
  • webhookUrl — Optional HTTPS URL Horizon should call when the audio job finishes.

Sample request

curl https://api.horizon.new/v1/generate/audio \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Warm, confident narrator welcoming new Horizon users.",
    "voice": "serene-female",
    "durationSeconds": 30
  }'

Response

Returns 202 Accepted with a jobId, statusUrl, and previews for each format. Completed jobs include waveform analysis (RMS, LUFS) so you can loudness-match clips programmatically.

Notes

  • When you omit voice, the generator auto-selects a voice that matches the prompt’s tone.
  • To get subtitles alongside speech, add "includeCaptions": true to the request body.
  • Poll GET /jobs/{jobId} (same destination as statusUrl) to check progress or retrieve the audio bundle later.

x402 flow

Audio rendering is likewise defended by Coinbase’s x402 protocol. When additional payment is required, Horizon returns a structured 402 response:
HTTP/1.1 402 Payment Required
Content-Type: application/json

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "base-sepolia",
      "maxAmountRequired": "150000",               // $0.15 in 6‑decimal USDC
      "resource": "POST /generate/audio",
      "description": "Horizon audio generation",
      "mimeType": "application/json",
      "payTo": "0xYourReceivingWallet",
      "maxTimeoutSeconds": 180,
      "asset": "0xYourUSDCContract",
      "extra": {
        "name": "USDC",
        "version": "1"
      }
    }
  ],
  "error": null
}
To unlock the job:
  1. Send the challenge to your facilitator (see Client & server responsibilities) and call /verify and /settle.
  2. Replay the request with the facilitator’s Base64 payload inside the standard X-PAYMENT header:
    curl https://api.horizon.new/v1/generate/audio \
      -H "Content-Type: application/json" \
      -H "X-PAYMENT: eyJ4NDAyVmVyc2lvbiI6MSwic2NoZW1lIjoiZXhhY3QiLC4uLn0=" \
      -d '{ ...original body... }'
    
  3. Horizon validates the proof (locally or via facilitator). Successful responses may include X-PAYMENT-RESPONSE with the settlement record.
See the Quickstart for sellers for facilitator setup guidance before you roll out paid audio generation.

Body

application/json
prompt
string
required
voice
string
tempo
integer
Required range: 30 <= x <= 240
durationSeconds
integer
default:60
Required range: 1 <= x <= 300
webhookUrl
string<uri>

Webhook to call when the audio job completes.

Response

Audio generation job accepted

jobId
string
required
Example:

"job_01hx9q9"

status
enum<string>
required
Available options:
queued,
processing,
completed,
failed
statusUrl
string<uri>
required

Canonical link to GET /jobs/{jobId} for this job.

jobType
string
required
Example:

"extract/pdf"

result
object | null

Present when the job completes synchronously.

etaSeconds
integer | null

Estimated seconds until completion.