llm.speech/v1
A model reads text aloud and returns the audio as a file. Every call names its model as provider/model: a provider the app's admins added in Settings → LLM, a slash, and
that provider's own id for the model. Shared types (File, Usage, ModelInfo, Job, the errors) are in
pocketone.dev/ext/contracts/llm.
A wire contract at /api/_c/llm.speech/v1 (speech.go), one provider. The
llm extension provides it, over Vultr, Cloudflare Workers AI, OpenRouter and any
OpenAI-compatible API.
Use
In page code it's $llm.speech (bound by the llm extension):
const r = await $llm.speech.speakAsync({ model: "vultr/qwen3-tts-12hz-1.7b", text: page, voice: "vivian", instructions: "slow and calm" })
record.set("narration", $llm.file(r.file))
await $llm.speech.voicesAsync("vultr/qwen3-tts-12hz-1.7b")
// a voice cloned from a stored clip: leave voice and instructions out
await $llm.speech.speakAsync({ model: "vultr/qwen3-tts-12hz-1.7b", text: page, reference: { audio: $llm.fromRecord(clip, "audio"), text: clip.getString("passage") } })
Voice cloning. reference ({audio: File, text}) asks the model to read in the voice of that clip; text is what
the clip says, optional but closer with it. A model clones when one of its voices has mode: "clone" (voices), and a
provider that doesn't clone answers not_supported. Nothing is saved at the provider: the clip goes with every call.
instructions can't go with a reference.
Over HTTP (a superuser, or a token with the scope shown):
| Operation | HTTP | Body | Token scope |
|---|---|---|---|
| Speak | POST /api/_c/llm.speech/v1/speak |
{"model": "...", "text": "...", "voice": "", "format": "mp3"} |
llm |
| Voices | POST /api/_c/llm.speech/v1/voices |
{"model": "..."} |
llm:read |
| Models | GET /api/_c/llm.speech/v1/models |
?provider= (optional) |
llm:read |
speak answers {"file": File, "model", "usage"}; voices answers {"voices": [{"id", "name", "language", "mode", "description"}]} (empty when the provider doesn't list them; mode is builtin, design or clone when it says).
Errors: not_configured (no providers), unknown_model, not_supported, provider (the cloud's own error), timeout.
From Go: speechv1.Contract.Must(app) (from pocketone.dev/ext/contracts/llm/speech/v1).
Provide
Implement speechv1.Speech and provide it in Register (speechv1.Contract.Provide(app, impl)). Route on the
provider/ prefix, answer not_supported for a provider that can't do this kind, unknown_model for a missing model
or provider (and for a reference on a provider that can't clone), and provider with the cloud's own message (never its key) when the cloud refuses. Fill model with the
full provider/model that answered, and usage with what the provider reports.
Commands and APIs
Every operation is a REST endpoint, a pocketone command and an MCP tool, all generated from the contract and behind the same token scope check and hooks. See Remote CLI, or the full CLI, Extension APIs and MCP references.
speak
Reads the text aloud and returns the audio.
| REST | POST /api/_c/llm.speech/v1/speak |
| CLI | pocketone remote llm speech speak --model <value> --text <value> --voice <value> --format <value> --speed <n> --instructions <value> --reference <json> --options <json> |
| MCP | llm_speech_speak |
| Token scope | llm |
| Input field | Flag | Type |
|---|---|---|
model |
--model |
string |
text |
--text |
string |
voice |
--voice |
string |
format |
--format |
string |
speed |
--speed |
float |
instructions |
--instructions |
string |
reference |
--reference |
json |
options |
--options |
json |
voices
Lists a model's voices, when the provider says.
| REST | POST /api/_c/llm.speech/v1/voices |
| CLI | pocketone remote llm speech voices --model <value> |
| MCP | llm_speech_voices |
| Token scope | llm:read |
| Input field | Flag | Type |
|---|---|---|
model |
--model |
string |
models
Lists the speech models of every provider in Settings → LLM.
| REST | GET /api/_c/llm.speech/v1/models |
| CLI | pocketone remote llm speech models --provider <value> |
| MCP | llm_speech_models |
| Token scope | llm:read |
| Input field | Flag | Type |
|---|---|---|
provider |
--provider |
string |
Extensions
| Extension | |
|---|---|
| llm | provides |
License
MIT
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.