Skip to content

Narrate an entry

Read a blog post, a lesson or any other entry aloud in a curated voice, spending Sherpo AI credits, and publish it to its readers.

Updated

An entry with a text body can carry a narration: its text read aloud in one of a few curated voices, which its readers play beside it. A podcast’s episodes are audio already, so they take none. Narration needs a plan with AI, as AI for media does, and it is off until you generate one.

Pick a voice

GET /narration/voices lists the voices a narration may be read in, each with a short sample to hear before choosing. A sample’s preview_url is a short-lived link, and is null while its preview_state is pending, for a moment the first time your store lists them while the store fetches its samples, or failed, when a sample can’t be fetched for now. A failed sample’s preview_reason says why: no_key while narration is unavailable, cooldown until its preview_retry_at, when listing again may fetch it, or retry when listing again may fetch it now.

Generate it

POST /products/{product}/entries/{entry}/narration/generate reads the entry’s latest saved text in the voice you pick: its staged body when it has one, else its published one. It reads the title, the subtitle, then the body’s headings, paragraphs, list items and quotes in order, and leaves code, tables, files and embeds out. Send language (an ISO 639-1 code) to read it in that language, or leave it out to read it in the text’s own.

A narration costs 10 Sherpo AI credits per 1,000 characters of the text it reads, rounded up, and reads at most 100,000 characters (1,000 credits); a longer text is refused with conflict on value. The credits are reserved when you generate, and settle at what was read once the narration lands or fails. A narration that fails before any of it was read gives every credit back; once a part was read, that part stays charged.

Reading a post in Darian’s voice, in English:

curl -X POST 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/products/6f1c2a9e-4b7d-4e2a-9c51-0d3e8b7a1f42/entries/7a1d3f5b-9c2e-4b6d-8f0a-2c4e6a8b0d1f/narration/generate' \
  -H "Authorization: Bearer $SHERPO_TOKEN" \
  -H 'Idempotency-Key: narrate-autumn-post' \
  -H 'Content-Type: application/json' \
  -d '{
  "voice": "darian",
  "language": "en"
}'
const answer = await sherpo('POST', '/v1/stores/STORE_ID/products/6f1c2a9e-4b7d-4e2a-9c51-0d3e8b7a1f42/entries/7a1d3f5b-9c2e-4b6d-8f0a-2c4e6a8b0d1f/narration/generate', {
  body: {
    "voice": "darian",
    "language": "en"
  },
  key: 'narrate-autumn-post',
});

Generating, publishing and deleting a narration need entry:write; reading it and listing the voices need entry:read. It lands as a draft. While it is generated, and after, the version your readers hear plays on.

Read it

GET /products/{product}/entries/{entry}/narration answers the latest version (current: generating, a draft, or failed with its reason) and the one your readers hear (published), each with a stream_url to play it once its audio landed. outdated is true once the entry’s latest saved text no longer reads as the text a version read; generate it again to catch up. quote is what generating it now would cost; it is null when the entry has no text to read aloud, which generating refuses, or when its text can’t be read.

Publish it

POST /products/{product}/entries/{entry}/narration/publish with published: true puts the latest draft in front of the entry’s readers, in place of the version they heard. It reaches only those who may open the entry: a reader the entry is locked to never hears it. published: false takes it back, which turns it the draft again unless a newer version stands. DELETE /products/{product}/entries/{entry}/narration deletes every version with its audio; deleting the entry does too.

Type to search…

↑↓ navigate↵ selectEsc close