Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public partial interface ITextToSpeechClient
/// Synthesize speech and stream the audio back over Server-Sent Events. Same body as `/waves/v1/tts` — the only difference is the response is a stream of base64-encoded PCM chunks instead of one binary blob.<br/>
/// Pick the model with the `model` body parameter, same as the sync route.<br/>
/// &lt;Note&gt;<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/api-reference/text-to-speech/stream-speech-web-socket).<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/documentation/text-to-speech-lightning/streaming).<br/>
/// &lt;/Note&gt;<br/>
/// ## When to use this<br/>
/// - **Use this** when you want playback to start before synthesis is complete — long passages, latency-sensitive UI, live narration.<br/>
Expand Down Expand Up @@ -54,7 +54,7 @@ public partial interface ITextToSpeechClient
/// Synthesize speech and stream the audio back over Server-Sent Events. Same body as `/waves/v1/tts` — the only difference is the response is a stream of base64-encoded PCM chunks instead of one binary blob.<br/>
/// Pick the model with the `model` body parameter, same as the sync route.<br/>
/// &lt;Note&gt;<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/api-reference/text-to-speech/stream-speech-web-socket).<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/documentation/text-to-speech-lightning/streaming).<br/>
/// &lt;/Note&gt;<br/>
/// ## When to use this<br/>
/// - **Use this** when you want playback to start before synthesis is complete — long passages, latency-sensitive UI, live narration.<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ partial void ProcessSynthesizeSpeechSseResponse(
/// Synthesize speech and stream the audio back over Server-Sent Events. Same body as `/waves/v1/tts` — the only difference is the response is a stream of base64-encoded PCM chunks instead of one binary blob.<br/>
/// Pick the model with the `model` body parameter, same as the sync route.<br/>
/// &lt;Note&gt;<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/api-reference/text-to-speech/stream-speech-web-socket).<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/documentation/text-to-speech-lightning/streaming).<br/>
/// &lt;/Note&gt;<br/>
/// ## When to use this<br/>
/// - **Use this** when you want playback to start before synthesis is complete — long passages, latency-sensitive UI, live narration.<br/>
Expand Down Expand Up @@ -423,7 +423,7 @@ partial void ProcessSynthesizeSpeechSseResponse(
/// Synthesize speech and stream the audio back over Server-Sent Events. Same body as `/waves/v1/tts` — the only difference is the response is a stream of base64-encoded PCM chunks instead of one binary blob.<br/>
/// Pick the model with the `model` body parameter, same as the sync route.<br/>
/// &lt;Note&gt;<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/api-reference/text-to-speech/stream-speech-web-socket).<br/>
/// **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/documentation/text-to-speech-lightning/streaming).<br/>
/// &lt;/Note&gt;<br/>
/// ## When to use this<br/>
/// - **Use this** when you want playback to start before synthesis is complete — long passages, latency-sensitive UI, live narration.<br/>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SmallestAI/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"post": {
"operationId": "textToSpeech_synthesizeSpeechSse",
"summary": "Stream speech (SSE)",
"description": "Synthesize speech and stream the audio back over Server-Sent Events. Same body as `/waves/v1/tts` — the only difference is the response is a stream of base64-encoded PCM chunks instead of one binary blob.\n\nPick the model with the `model` body parameter, same as the sync route.\n\n<Note>\n **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/api-reference/text-to-speech/stream-speech-web-socket).\n</Note>\n\n## When to use this\n\n- **Use this** when you want playback to start before synthesis is complete — long passages, latency-sensitive UI, live narration.\n- **Use sync `/waves/v1/tts`** when total latency doesn't matter and you'd rather get one buffer.\n- **Use `/waves/v1/tts/live`** (WebSocket) when the *text* arrives incrementally (LLM token stream). SSE assumes you have the full text up front.\n\n## How it works\n\n1. POST your text + voice settings — same payload as `/waves/v1/tts`, plus optional `model`.\n2. The response is `Content-Type: text/event-stream`. Each chunk frame is `event: audio\\n` followed by `data: {\"audio\": \"<base64-pcm>\", \"done\": false, \"status\": \"206\"}\\n\\n`.\n3. Decode each chunk's `audio` field with base64 and feed the PCM bytes to your audio pipeline (browser `MediaSource`, ffmpeg pipe, raw PCM player, etc.).\n4. A final `data: {\"status\": \"200\", \"done\": true}\\n\\n` frame marks end of stream. Detect the terminator with `done == true`; every chunk frame also carries `done: false`, so `\"done\" in msg` matches every frame.\n\n## Examples\n\n**cURL**\n```bash\ncurl -N -X POST \"https://api.smallest.ai/waves/v1/tts/live\" \\\n -H \"Authorization: Bearer $SMALLEST_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"text\": \"Streaming this paragraph chunk by chunk so playback can start sooner.\",\n \"voice_id\": \"magnus\",\n \"sample_rate\": 24000,\n \"output_format\": \"pcm\"\n }'\n```\n\n## Common gotchas\n\n- **Use a streaming-friendly client.** `curl -N`, Python `iter_lines`, or a `fetch` `ReadableStream` reader. Buffering clients will hide the latency win.\n- **Audio is base64 inside the event payload**, not the raw event bytes. Decode the `data.audio` field per event.\n- **`output_format=pcm`** gives the lowest overhead for streaming playback. `wav`/`mp3` work but add per-chunk framing bytes.\n",
"description": "Synthesize speech and stream the audio back over Server-Sent Events. Same body as `/waves/v1/tts` — the only difference is the response is a stream of base64-encoded PCM chunks instead of one binary blob.\n\nPick the model with the `model` body parameter, same as the sync route.\n\n<Note>\n **The same URL serves the WebSocket endpoint.** `wss://api.smallest.ai/waves/v1/tts/live` accepts a WebSocket upgrade for streaming-text scenarios (LLM token streams, live captioning). The HTTP `POST` documented on this page returns SSE; use `wss://` to use the WebSocket protocol instead. See the [WebSocket reference](/models/documentation/text-to-speech-lightning/streaming).\n</Note>\n\n## When to use this\n\n- **Use this** when you want playback to start before synthesis is complete — long passages, latency-sensitive UI, live narration.\n- **Use sync `/waves/v1/tts`** when total latency doesn't matter and you'd rather get one buffer.\n- **Use `/waves/v1/tts/live`** (WebSocket) when the *text* arrives incrementally (LLM token stream). SSE assumes you have the full text up front.\n\n## How it works\n\n1. POST your text + voice settings — same payload as `/waves/v1/tts`, plus optional `model`.\n2. The response is `Content-Type: text/event-stream`. Each chunk frame is `event: audio\\n` followed by `data: {\"audio\": \"<base64-pcm>\", \"done\": false, \"status\": \"206\"}\\n\\n`.\n3. Decode each chunk's `audio` field with base64 and feed the PCM bytes to your audio pipeline (browser `MediaSource`, ffmpeg pipe, raw PCM player, etc.).\n4. A final `data: {\"status\": \"200\", \"done\": true}\\n\\n` frame marks end of stream. Detect the terminator with `done == true`; every chunk frame also carries `done: false`, so `\"done\" in msg` matches every frame.\n\n## Examples\n\n**cURL**\n```bash\ncurl -N -X POST \"https://api.smallest.ai/waves/v1/tts/live\" \\\n -H \"Authorization: Bearer $SMALLEST_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"text\": \"Streaming this paragraph chunk by chunk so playback can start sooner.\",\n \"voice_id\": \"magnus\",\n \"sample_rate\": 24000,\n \"output_format\": \"pcm\"\n }'\n```\n\n## Common gotchas\n\n- **Use a streaming-friendly client.** `curl -N`, Python `iter_lines`, or a `fetch` `ReadableStream` reader. Buffering clients will hide the latency win.\n- **Audio is base64 inside the event payload**, not the raw event bytes. Decode the `data.audio` field per event.\n- **`output_format=pcm`** gives the lowest overhead for streaming playback. `wav`/`mp3` work but add per-chunk framing bytes.\n",
"tags": [
"textToSpeech"
],
Expand Down