tts.v1

docs/capabilities/tts.v1.md · wiki index

tts.v1

Status: v1. A published shape is frozen by spec.md section 20.1. Capability key: tts Route: POST /tts

Parts in

One row for each part kind that this capability accepts. A kind that is not in this table is invalid_part.

kindrolerequiredmeaning
textanyyes, one or morethe text to speak. The role is not significant.

Parameters

The plugin validates these. A parameter that is not in this table is ignored, not an error (spec.md R26). A default of catalogue means the model entry in the catalogue gives the value.

nametypedefaultmeaning
voicestringcataloguethe voice to speak with
speedfloat1.0the speaking rate multiplier
formatstringcataloguethe sample format to emit

Channels out

One row for each channel that this capability can emit.

channelmimepayload
pcmaudio/pcm; enc=s16le; rate=24000; channels=1one run of audio bytes. The mime states the sample format, the rate, and the channel count.
progressapplication/json{stage, pct} while the plugin synthesises

Terminal metadata

done.meta is vocabulary-defined. The core stores it and never reads it. done without meta means {}.

keytypemeaning
modelstringthe served name that ran the job
rateuintthe sample rate in hertz, measured by the plugin
channelsuintthe channel count, measured by the plugin
formatstringthe sample format that the plugin used

These keys are present when outcome is completed. They are absent when the outcome is cancelled or expired.

Request

POST /tts
{
  "model": "<served-name>",
  "input": [
    {"kind": "text", "text": "A ledger records reserved bytes."},
    {"kind": "text", "text": "Every device has room."}
  ],
  "params": {"voice": "warm", "speed": 1.0, "format": "f32le"},
  "stream": true
}

Response, no stream

{"job": "019...", "outcome": "completed",
 "pcm": {"mime": "audio/pcm; enc=f32le; rate=24000; channels=1", "inline": "<audio bytes>"},
 "usage": {"tokens_in": 6, "audio_ms": 1800},
 "meta": {"model": "<served-name>", "rate": 24000, "channels": 1, "format": "f32le"}}

Stream

The mime of each pcm event carries the format. The plugin states the format that it used.

event  ch=pcm  audio/pcm; enc=f32le; rate=24000; channels=1  <audio bytes>
event  ch=pcm  audio/pcm; enc=f32le; rate=24000; channels=1  <audio bytes>
done   outcome=completed meta={"model":"<served-name>","rate":24000,"channels":1,"format":"f32le"}

Rules

  1. At least one text part is required. A request with no text part is invalid_part.
  2. An image, audio, video, or tokens part is invalid_part.
  3. The plugin speaks several text parts in input order. Audio for part i precedes audio for part i + 1.
  4. The mime of a pcm event names the sample format, the rate, and the channel count.
  5. Every pcm event of one job states the same rate and the same channel count.
  6. meta.format equals the format named in the mime of every pcm event.
  7. meta.rate and meta.channels equal the values named in that mime.
  8. format selects a sample format that the plugin declares. An undeclared value gives a refusal that names format.
  9. voice selects a voice that the plugin declares. An undeclared voice gives a refusal that names voice.
  10. speed = 1.0 means the natural rate of the voice. A larger value is faster.
  11. A pcm event carries whole samples only. A sample never spans two events.
  12. No event follows a cancel. The terminal frame is done with outcome = cancelled.
  13. The plugin emits audio bytes on the pcm channel and progress events. It emits nothing else for this job.
  14. progress.pct never decreases within one job.