Skip to content

Commit 0bcb4c9

Browse files
authored
feat(tts): add Inworld speech provider (#55972)
Adds the bundled Inworld speech provider with docs, config surface, SSRF-guarded fetches, directive overrides, native voice-note/telephony output coverage, and live `.profile` verification. Co-authored-by: cshape <[email protected]>
1 parent 167588c commit 0bcb4c9

23 files changed

Lines changed: 1295 additions & 16 deletions

‎.env.example‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ OPENCLAW_GATEWAY_TOKEN=
8282

8383
# ELEVENLABS_API_KEY=...
8484
# XI_API_KEY=... # alias for ElevenLabs
85+
# INWORLD_API_KEY=...
8586
# DEEPGRAM_API_KEY=...

‎.github/labeler.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@
307307
- changed-files:
308308
- any-glob-to-any-file:
309309
- "extensions/huggingface/**"
310+
"extensions: inworld":
311+
- changed-files:
312+
- any-glob-to-any-file:
313+
- "extensions/inworld/**"
314+
- "docs/providers/inworld.md"
310315
"extensions: kilocode":
311316
- changed-files:
312317
- any-glob-to-any-file:

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Docs: https://docs.openclaw.ai
5454
- Providers/Xiaomi: add MiMo TTS as a bundled speech provider with MP3/WAV output and voice-note Opus transcoding. Fixes #52376. (#55614) Thanks @zoujiejun.
5555
- Providers/ElevenLabs: include `eleven_v3` in the bundled TTS model catalog so model selection surfaces can offer ElevenLabs v3. (#68321) Thanks @itsuzef.
5656
- Providers/Local CLI TTS: add a bundled local command speech provider with file/stdout input, voice-note Opus conversion, and telephony PCM output. (#56239) Thanks @solar2ain.
57+
- Providers/Inworld: add Inworld as a bundled speech provider with streaming TTS synthesis, voice listing, voice-note output, and PCM telephony output. (#55972) Thanks @cshape.
5758
- Android/Talk Mode: expose Talk Mode in the Voice tab with runtime-owned voice capture modes and microphone foreground-service escalation. Thanks @alex-latitude.
5859
- Providers/LiteLLM: register `litellm` as an image-generation provider so `image_generate model=litellm/...` calls and `agents.defaults.imageGenerationModel.fallbacks` entries resolve through the LiteLLM proxy. Thanks @zqchris.
5960
- Codex harness: require Codex app-server `0.125.0` or newer and cover native MCP `PreToolUse`, `PostToolUse`, and `PermissionRequest` payloads through the OpenClaw hook relay.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
9ac3d271f9bfa9611557f0b52e4d0a600693bdd1de75cc1bafc320fc4d4f0075 config-baseline.json
1+
0b0d796bceddfb9e2929518ba84af626da7f5d75c392a217041f36e850c4e74f config-baseline.json
22
271fdf1d6652927e0fc160a6f25276bf6dccb8f1b27fab15e0fc2620e8cacab4 config-baseline.core.json
33
7cd9c908f066c143eab2a201efbc9640f483ab28bba92ddeca1d18cc2b528bc3 config-baseline.channel.json
4-
7825b56a5b3fcdbe2e09ef8fe5d9f12ac3598435afebe20413051e45b0d1968e config-baseline.plugin.json
4+
17eb3f8887193579ff32e35f9bd520ba2bd6049e52ab18855c5d41fcbf195d83 config-baseline.plugin.json

‎docs/docs.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,7 @@
13171317
"providers/groq",
13181318
"providers/huggingface",
13191319
"providers/inferrs",
1320+
"providers/inworld",
13201321
"providers/kilocode",
13211322
"providers/litellm",
13221323
"providers/lmstudio",

‎docs/providers/inworld.md‎

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
summary: "Inworld streaming text-to-speech for OpenClaw replies"
3+
read_when:
4+
- You want Inworld speech synthesis for outbound replies
5+
- You need PCM telephony or OGG_OPUS voice-note output from Inworld
6+
title: "Inworld"
7+
---
8+
9+
Inworld is a streaming text-to-speech (TTS) provider. In OpenClaw it
10+
synthesizes outbound reply audio (MP3 by default, OGG_OPUS for voice notes)
11+
and PCM audio for telephony channels such as Voice Call.
12+
13+
OpenClaw posts to Inworld's streaming TTS endpoint, concatenates the
14+
returned base64 audio chunks into a single buffer, and hands the result to
15+
the standard reply-audio pipeline.
16+
17+
| Detail | Value |
18+
| ------------- | ----------------------------------------------------------- |
19+
| Website | [inworld.ai](https://inworld.ai) |
20+
| Docs | [docs.inworld.ai/tts/tts](https://docs.inworld.ai/tts/tts) |
21+
| Auth | `INWORLD_API_KEY` (HTTP Basic, Base64 dashboard credential) |
22+
| Default voice | `Sarah` |
23+
| Default model | `inworld-tts-1.5-max` |
24+
25+
## Getting started
26+
27+
<Steps>
28+
<Step title="Set your API key">
29+
Copy the credential from your Inworld dashboard (Workspace > API Keys)
30+
and set it as an env var. The value is sent verbatim as the HTTP Basic
31+
credential, so do not Base64-encode it again or convert it to a bearer
32+
token.
33+
34+
```
35+
INWORLD_API_KEY=<base64-credential-from-dashboard>
36+
```
37+
38+
</Step>
39+
<Step title="Select Inworld in messages.tts">
40+
```json5
41+
{
42+
messages: {
43+
tts: {
44+
auto: "always",
45+
provider: "inworld",
46+
providers: {
47+
inworld: {
48+
voiceId: "Sarah",
49+
modelId: "inworld-tts-1.5-max",
50+
},
51+
},
52+
},
53+
},
54+
}
55+
```
56+
</Step>
57+
<Step title="Send a message">
58+
Send a reply through any connected channel. OpenClaw synthesizes the
59+
audio with Inworld and delivers it as MP3 (or OGG_OPUS when the channel
60+
expects a voice note).
61+
</Step>
62+
</Steps>
63+
64+
## Configuration options
65+
66+
| Option | Path | Description |
67+
| ------------- | -------------------------------------------- | ----------------------------------------------------------------- |
68+
| `apiKey` | `messages.tts.providers.inworld.apiKey` | Base64 dashboard credential. Falls back to `INWORLD_API_KEY`. |
69+
| `baseUrl` | `messages.tts.providers.inworld.baseUrl` | Override Inworld API base URL (default `https://api.inworld.ai`). |
70+
| `voiceId` | `messages.tts.providers.inworld.voiceId` | Voice identifier (default `Sarah`). |
71+
| `modelId` | `messages.tts.providers.inworld.modelId` | TTS model id (default `inworld-tts-1.5-max`). |
72+
| `temperature` | `messages.tts.providers.inworld.temperature` | Sampling temperature `0..2` (optional). |
73+
74+
## Notes
75+
76+
<AccordionGroup>
77+
<Accordion title="Authentication">
78+
Inworld uses HTTP Basic auth with a single Base64-encoded credential
79+
string. Copy it verbatim from the Inworld dashboard. The provider sends
80+
it as `Authorization: Basic <apiKey>` without any further encoding, so
81+
do not Base64-encode it yourself and do not pass a bearer-style token.
82+
See [TTS auth notes](/tools/tts#inworld-primary) for the same callout.
83+
</Accordion>
84+
<Accordion title="Models">
85+
Supported model ids: `inworld-tts-1.5-max` (default),
86+
`inworld-tts-1.5-mini`, `inworld-tts-1-max`, `inworld-tts-1`.
87+
</Accordion>
88+
<Accordion title="Audio outputs">
89+
Replies use MP3 by default. When the channel target is `voice-note`
90+
OpenClaw asks Inworld for `OGG_OPUS` so the audio plays as a native
91+
voice bubble. Telephony synthesis uses raw `PCM` at 22050 Hz to feed
92+
the telephony bridge.
93+
</Accordion>
94+
<Accordion title="Custom endpoints">
95+
Override the API host with `messages.tts.providers.inworld.baseUrl`.
96+
Trailing slashes are stripped before requests are sent.
97+
</Accordion>
98+
</AccordionGroup>
99+
100+
## Related
101+
102+
<CardGroup cols={2}>
103+
<Card title="Text-to-speech" href="/tools/tts" icon="waveform-lines">
104+
TTS overview, providers, and `messages.tts` config.
105+
</Card>
106+
<Card title="Configuration" href="/gateway/configuration" icon="gear">
107+
Full config reference including `messages.tts` settings.
108+
</Card>
109+
<Card title="Providers" href="/providers" icon="grid">
110+
All bundled OpenClaw providers.
111+
</Card>
112+
<Card title="Troubleshooting" href="/help/troubleshooting" icon="wrench">
113+
Common issues and debugging steps.
114+
</Card>
115+
</CardGroup>

‎docs/tools/tts.md‎

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ read_when:
77
title: "Text-to-speech"
88
---
99

10-
OpenClaw can convert outbound replies into audio using ElevenLabs, Google Gemini, Gradium, Local CLI, Microsoft, MiniMax, OpenAI, Vydra, xAI, or Xiaomi MiMo.
10+
OpenClaw can convert outbound replies into audio using ElevenLabs, Google Gemini, Gradium, Inworld, Local CLI, Microsoft, MiniMax, OpenAI, Vydra, xAI, or Xiaomi MiMo.
1111
It works anywhere OpenClaw can send audio.
1212

1313
## Supported services
1414

1515
- **ElevenLabs** (primary or fallback provider)
1616
- **Google Gemini** (primary or fallback provider; uses Gemini API TTS)
1717
- **Gradium** (primary or fallback provider; supports voice-note and telephony output)
18+
- **Inworld** (primary or fallback provider; uses the Inworld streaming TTS API)
1819
- **Local CLI** (primary or fallback provider; runs a configured local TTS command)
1920
- **Microsoft** (primary or fallback provider; current bundled implementation uses `node-edge-tts`)
2021
- **MiniMax** (primary or fallback provider; uses the T2A v2 API)
@@ -38,11 +39,12 @@ or ElevenLabs.
3839

3940
## Optional keys
4041

41-
If you want OpenAI, ElevenLabs, Google Gemini, Gradium, MiniMax, Vydra, xAI, or Xiaomi MiMo:
42+
If you want ElevenLabs, Google Gemini, Gradium, Inworld, MiniMax, OpenAI, Vydra, xAI, or Xiaomi MiMo:
4243

4344
- `ELEVENLABS_API_KEY` (or `XI_API_KEY`)
4445
- `GEMINI_API_KEY` (or `GOOGLE_API_KEY`)
4546
- `GRADIUM_API_KEY`
47+
- `INWORLD_API_KEY`
4648
- `MINIMAX_API_KEY`; MiniMax TTS also accepts Token Plan auth via
4749
`MINIMAX_OAUTH_TOKEN`, `MINIMAX_CODE_PLAN_KEY`, or
4850
`MINIMAX_CODING_API_KEY`
@@ -64,6 +66,7 @@ so that provider must also be authenticated if you enable summaries.
6466
- [ElevenLabs Text to Speech](https://elevenlabs.io/docs/api-reference/text-to-speech)
6567
- [ElevenLabs Authentication](https://elevenlabs.io/docs/api-reference/authentication)
6668
- [Gradium](/providers/gradium)
69+
- [Inworld TTS API](https://docs.inworld.ai/tts/tts)
6770
- [MiniMax T2A v2 API](https://platform.minimaxi.com/document/T2A%20V2)
6871
- [Xiaomi MiMo speech synthesis](/providers/xiaomi#text-to-speech)
6972
- [node-edge-tts](https://github.com/SchneeHertz/node-edge-tts)
@@ -217,6 +220,35 @@ by the bundled Google image-generation provider. Resolution order is
217220
`messages.tts.providers.google.apiKey` -> `models.providers.google.apiKey` ->
218221
`GEMINI_API_KEY` -> `GOOGLE_API_KEY`.
219222

223+
### Inworld primary
224+
225+
```json5
226+
{
227+
messages: {
228+
tts: {
229+
auto: "always",
230+
provider: "inworld",
231+
providers: {
232+
inworld: {
233+
apiKey: "inworld_api_key",
234+
baseUrl: "https://api.inworld.ai",
235+
voiceId: "Sarah",
236+
modelId: "inworld-tts-1.5-max",
237+
temperature: 0.8,
238+
},
239+
},
240+
},
241+
},
242+
}
243+
```
244+
245+
The `apiKey` value must be the Base64-encoded credential string copied
246+
verbatim from the Inworld dashboard (Workspace > API Keys). The provider
247+
sends it as `Authorization: Basic <apiKey>` without any additional
248+
encoding, so do not pass a raw bearer token and do not Base64-encode it
249+
yourself. The key falls back to the `INWORLD_API_KEY` env var. See
250+
[Inworld provider](/providers/inworld) for full setup.
251+
220252
### xAI primary
221253

222254
```json5
@@ -415,7 +447,7 @@ Then run:
415447
- `tagged` only sends audio when the reply includes `[[tts:key=value]]` directives or a `[[tts:text]]...[[/tts:text]]` block.
416448
- `enabled`: legacy toggle (doctor migrates this to `auto`).
417449
- `mode`: `"final"` (default) or `"all"` (includes tool/block replies).
418-
- `provider`: speech provider id such as `"elevenlabs"`, `"google"`, `"gradium"`, `"microsoft"`, `"minimax"`, `"openai"`, `"vydra"`, `"xai"`, or `"xiaomi"` (fallback is automatic).
450+
- `provider`: speech provider id such as `"elevenlabs"`, `"google"`, `"gradium"`, `"inworld"`, `"microsoft"`, `"minimax"`, `"openai"`, `"vydra"`, `"xai"`, or `"xiaomi"` (fallback is automatic).
419451
- If `provider` is **unset**, OpenClaw uses the first configured speech provider in registry auto-select order.
420452
- Legacy `provider: "edge"` config is repaired by `openclaw doctor --fix` and
421453
rewritten to `provider: "microsoft"`.
@@ -429,7 +461,7 @@ Then run:
429461
- `maxTextLength`: hard cap for TTS input (chars). `/tts audio` fails if exceeded.
430462
- `timeoutMs`: request timeout (ms).
431463
- `prefsPath`: override the local prefs JSON path (provider/limit/summary).
432-
- `apiKey` values fall back to env vars (`ELEVENLABS_API_KEY`/`XI_API_KEY`, `GEMINI_API_KEY`/`GOOGLE_API_KEY`, `GRADIUM_API_KEY`, `MINIMAX_API_KEY`, `OPENAI_API_KEY`, `VYDRA_API_KEY`, `XAI_API_KEY`, `XIAOMI_API_KEY`).
464+
- `apiKey` values fall back to env vars (`ELEVENLABS_API_KEY`/`XI_API_KEY`, `GEMINI_API_KEY`/`GOOGLE_API_KEY`, `GRADIUM_API_KEY`, `INWORLD_API_KEY`, `MINIMAX_API_KEY`, `OPENAI_API_KEY`, `VYDRA_API_KEY`, `XAI_API_KEY`, `XIAOMI_API_KEY`).
433465
- `providers.elevenlabs.baseUrl`: override ElevenLabs API base URL.
434466
- `providers.openai.baseUrl`: override the OpenAI TTS endpoint.
435467
- Resolution order: `messages.tts.providers.openai.baseUrl` -> `OPENAI_TTS_BASE_URL` -> `https://api.openai.com/v1`
@@ -453,6 +485,10 @@ Then run:
453485
- `providers.tts-local-cli.timeoutMs`: command timeout in milliseconds (default `120000`).
454486
- `providers.tts-local-cli.cwd`: optional command working directory.
455487
- `providers.tts-local-cli.env`: optional string environment overrides for the command.
488+
- `providers.inworld.baseUrl`: override Inworld API base URL (default `https://api.inworld.ai`).
489+
- `providers.inworld.voiceId`: Inworld voice identifier (default `Sarah`).
490+
- `providers.inworld.modelId`: Inworld TTS model (default `inworld-tts-1.5-max`; also supports `inworld-tts-1.5-mini`, `inworld-tts-1-max`, `inworld-tts-1`).
491+
- `providers.inworld.temperature`: sampling temperature `0..2` (optional).
456492
- `providers.google.model`: Gemini TTS model (default `gemini-3.1-flash-tts-preview`).
457493
- `providers.google.voiceName`: Gemini prebuilt voice name (default `Kore`; `voice` is also accepted).
458494
- `providers.google.audioProfile`: natural-language style prompt prepended before the spoken text.
@@ -586,6 +622,7 @@ These override `messages.tts.*` for that host.
586622
with `ffmpeg`.
587623
- **Google Gemini**: Gemini API TTS returns raw 24kHz PCM. OpenClaw wraps it as WAV for audio attachments, transcodes it to 48kHz Opus for voice-note targets, and returns PCM directly for Talk/telephony.
588624
- **Gradium**: WAV for audio attachments, Opus for voice-note targets, and `ulaw_8000` at 8 kHz for telephony.
625+
- **Inworld**: MP3 for normal audio attachments, native `OGG_OPUS` for voice-note targets, and raw `PCM` at 22050 Hz for Talk/telephony.
589626
- **xAI**: MP3 by default; `responseFormat` may be `mp3`, `wav`, `pcm`, `mulaw`, or `alaw`. OpenClaw uses xAI's batch REST TTS endpoint and returns a complete audio attachment; xAI's streaming TTS WebSocket is not used by this provider path. Native Opus voice-note format is not supported by this path.
590627
- **Microsoft**: uses `microsoft.outputFormat` (default `audio-24khz-48kbitrate-mono-mp3`).
591628
- The bundled transport accepts an `outputFormat`, but not all formats are available from the service.

‎extensions/inworld/index.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2+
import { buildInworldSpeechProvider } from "./speech-provider.js";
3+
4+
export default definePluginEntry({
5+
id: "inworld",
6+
name: "Inworld Speech",
7+
description: "Bundled Inworld speech provider",
8+
register(api) {
9+
api.registerSpeechProvider(buildInworldSpeechProvider());
10+
},
11+
});
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { describe, expect, it } from "vitest";
2+
import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
3+
import {
4+
registerProviderPlugin,
5+
requireRegisteredProvider,
6+
} from "../../test/helpers/plugins/provider-registration.js";
7+
import plugin from "./index.js";
8+
9+
const INWORLD_API_KEY = process.env.INWORLD_API_KEY?.trim() ?? "";
10+
const LIVE = isLiveTestEnabled() && INWORLD_API_KEY.length > 0;
11+
const describeLive = LIVE ? describe : describe.skip;
12+
13+
const registerInworldPlugin = () =>
14+
registerProviderPlugin({
15+
plugin,
16+
id: "inworld",
17+
name: "Inworld",
18+
});
19+
20+
describeLive("inworld plugin live", () => {
21+
it("lists voices through the registered speech provider", async () => {
22+
const { speechProviders } = await registerInworldPlugin();
23+
const provider = requireRegisteredProvider(speechProviders, "inworld");
24+
25+
const voices = await provider.listVoices?.({
26+
apiKey: INWORLD_API_KEY,
27+
});
28+
29+
expect(voices?.length).toBeGreaterThan(0);
30+
expect(voices).toEqual(expect.arrayContaining([expect.objectContaining({ id: "Sarah" })]));
31+
}, 120_000);
32+
33+
it("synthesizes MP3, native voice-note Ogg/Opus, and telephony PCM", async () => {
34+
const { speechProviders } = await registerInworldPlugin();
35+
const provider = requireRegisteredProvider(speechProviders, "inworld");
36+
const providerConfig = {
37+
apiKey: INWORLD_API_KEY,
38+
voiceId: "Sarah",
39+
modelId: "inworld-tts-1.5-max",
40+
};
41+
42+
const audioFile = await provider.synthesize({
43+
text: "OpenClaw Inworld text to speech integration test OK.",
44+
cfg: { plugins: { enabled: true } } as never,
45+
providerConfig,
46+
target: "audio-file",
47+
timeoutMs: 90_000,
48+
});
49+
50+
expect(audioFile.outputFormat).toBe("mp3");
51+
expect(audioFile.fileExtension).toBe(".mp3");
52+
expect(audioFile.voiceCompatible).toBe(false);
53+
expect(audioFile.audioBuffer.byteLength).toBeGreaterThan(512);
54+
expect(audioFile.audioBuffer.subarray(0, 4).toString("ascii")).not.toBe("RIFF");
55+
56+
const voiceNote = await provider.synthesize({
57+
text: "OpenClaw Inworld voice note integration test OK.",
58+
cfg: { plugins: { enabled: true } } as never,
59+
providerConfig,
60+
target: "voice-note",
61+
timeoutMs: 90_000,
62+
});
63+
64+
expect(voiceNote.outputFormat).toBe("ogg_opus");
65+
expect(voiceNote.fileExtension).toBe(".ogg");
66+
expect(voiceNote.voiceCompatible).toBe(true);
67+
expect(voiceNote.audioBuffer.byteLength).toBeGreaterThan(128);
68+
expect(voiceNote.audioBuffer.subarray(0, 4).toString("ascii")).toBe("OggS");
69+
70+
const telephony = await provider.synthesizeTelephony?.({
71+
text: "OpenClaw Inworld telephony check OK.",
72+
cfg: { plugins: { enabled: true } } as never,
73+
providerConfig,
74+
timeoutMs: 90_000,
75+
});
76+
if (!telephony) {
77+
throw new Error("Inworld telephony synthesis did not return audio");
78+
}
79+
expect(telephony.outputFormat).toBe("pcm");
80+
expect(telephony.sampleRate).toBe(22_050);
81+
expect(telephony.audioBuffer.byteLength).toBeGreaterThan(512);
82+
expect(telephony.audioBuffer.subarray(0, 4).toString("ascii")).not.toBe("RIFF");
83+
}, 180_000);
84+
});

0 commit comments

Comments
 (0)