Capabilities
Create a musical
Generate a narrated bedtime story with a sung lullaby in the middle, as an MP3, from prompt to download in four steps.
1. Get an API key
Create a key from your Dashboard. The Free plan includes credits to try the API. Keys look like sk_live_... and are sent as a bearer token on every request.
2. Submit the job
POST /api/v1/musical with a prompt describing what the musical should be about. A successful submission costs 2 credits (3 with a cover image) and returns 202 Accepted with a job_id:
curl -X POST https://www.sleepytale.com/api/v1/musical \
-H "Authorization: Bearer $SLEEPYTALE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "a sleepy little fox curling up under the stars"}'{
"job_id": "1936f2b0a1c-7e1c2a3b-…",
"status": "queued"
}3. Poll for the result
Poll GET /api/v1/jobs/{job_id} every few seconds until status is succeeded or failed. Musicals generate both narration and song, so expect them to take longer than lullabies.
curl https://www.sleepytale.com/api/v1/jobs/$JOB_ID \
-H "Authorization: Bearer $SLEEPYTALE_API_KEY"{
"job_id": "1936f2b0a1c-7e1c2a3b-…",
"status": "processing",
"result": null,
"error": null
}4. Download the audio
Once the job succeeds, result.audio_url is a public URL of the finished MP3, result.lyrics holds the full narrated text, and result.title is a generated title. Here's the kind of audio you'll get:
Musical sample
Options
- Cover art. Set
include_image: trueto also generate AI cover art (+1 credit).result.cover_urlis then a public image URL instead ofnull. Add an optionalstylestring (e.g."watercolor") to steer the art style. It only affects the image, never the audio. - Idempotency. Send an
Idempotency-Keyheader to make retries safe: replaying the same key returns the same job instead of creating (and charging for) a new one.
Charged on success only
Prompt tips
- Name a character and a setting: “a sleepy little fox curling up under the stars” beats “a nice song”.
- Set the mood you want (calm, dreamy, cozy) and the musical will follow it.
- Musicals are stories: a simple arc (a small problem, gently resolved, then sleep) gives the narration structure.
- Keep prompts under 2,000 characters; a sentence or two is usually plenty.
- Prompts are content-checked for child-appropriateness. Rejected prompts return
400(content_rejected) and cost nothing.