Skip to content

Commit e0a5e6a

Browse files
cshapesteipete
authored andcommitted
feat(tts): add Inworld as built-in speech provider
Registers a new bundled speech plugin at extensions/inworld/ that follows the openclaw/plugin-sdk/* contract: the plugin entry registers an Inworld SpeechProviderPlugin via api.registerSpeechProvider, and the manifest declares the speechProviders contract with enabledByDefault=true so core picks it up through normal plugin discovery. Provider covers MP3 output, OGG_OPUS voice-notes, PCM telephony, listVoices, and API-key resolution via messages.tts.providers.inworld.apiKey or INWORLD_API_KEY. Uses the shared openclaw/plugin-sdk/speech coerce helpers to stay consistent with the OpenAI and ElevenLabs bundled providers. Docs, .env.example, and the Unreleased changelog are updated; no core src/tts, src/config, or src/secrets edits are needed under the current plugin-owned pattern.
1 parent 167588c commit e0a5e6a

12 files changed

Lines changed: 812 additions & 4 deletions

File tree

‎.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=...

‎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.

‎docs/tools/tts.md‎

Lines changed: 37 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/docs/tts-overview)
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,32 @@ 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: "Dennis",
236+
modelId: "inworld-tts-1.5-max",
237+
temperature: 0.8,
238+
},
239+
},
240+
},
241+
},
242+
}
243+
```
244+
245+
Inworld authenticates with HTTP Basic using a single Base64-encoded credential
246+
string taken from the Inworld dashboard. The provider reads the key from
247+
`messages.tts.providers.inworld.apiKey` or the `INWORLD_API_KEY` env var.
248+
220249
### xAI primary
221250

222251
```json5
@@ -415,7 +444,7 @@ Then run:
415444
- `tagged` only sends audio when the reply includes `[[tts:key=value]]` directives or a `[[tts:text]]...[[/tts:text]]` block.
416445
- `enabled`: legacy toggle (doctor migrates this to `auto`).
417446
- `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).
447+
- `provider`: speech provider id such as `"elevenlabs"`, `"google"`, `"gradium"`, `"inworld"`, `"microsoft"`, `"minimax"`, `"openai"`, `"vydra"`, `"xai"`, or `"xiaomi"` (fallback is automatic).
419448
- If `provider` is **unset**, OpenClaw uses the first configured speech provider in registry auto-select order.
420449
- Legacy `provider: "edge"` config is repaired by `openclaw doctor --fix` and
421450
rewritten to `provider: "microsoft"`.
@@ -429,7 +458,7 @@ Then run:
429458
- `maxTextLength`: hard cap for TTS input (chars). `/tts audio` fails if exceeded.
430459
- `timeoutMs`: request timeout (ms).
431460
- `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`).
461+
- `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`).
433462
- `providers.elevenlabs.baseUrl`: override ElevenLabs API base URL.
434463
- `providers.openai.baseUrl`: override the OpenAI TTS endpoint.
435464
- Resolution order: `messages.tts.providers.openai.baseUrl` -> `OPENAI_TTS_BASE_URL` -> `https://api.openai.com/v1`
@@ -453,6 +482,10 @@ Then run:
453482
- `providers.tts-local-cli.timeoutMs`: command timeout in milliseconds (default `120000`).
454483
- `providers.tts-local-cli.cwd`: optional command working directory.
455484
- `providers.tts-local-cli.env`: optional string environment overrides for the command.
485+
- `providers.inworld.baseUrl`: override Inworld API base URL (default `https://api.inworld.ai`).
486+
- `providers.inworld.voiceId`: Inworld voice identifier (default `Dennis`).
487+
- `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`).
488+
- `providers.inworld.temperature`: sampling temperature `0..2` (optional).
456489
- `providers.google.model`: Gemini TTS model (default `gemini-3.1-flash-tts-preview`).
457490
- `providers.google.voiceName`: Gemini prebuilt voice name (default `Kore`; `voice` is also accepted).
458491
- `providers.google.audioProfile`: natural-language style prompt prepended before the spoken text.

‎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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"id": "inworld",
3+
"enabledByDefault": true,
4+
"contracts": {
5+
"speechProviders": ["inworld"]
6+
},
7+
"configSchema": {
8+
"type": "object",
9+
"additionalProperties": false,
10+
"properties": {}
11+
}
12+
}

‎extensions/inworld/package.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@openclaw/inworld-speech",
3+
"version": "2026.4.16",
4+
"private": true,
5+
"description": "OpenClaw Inworld speech plugin",
6+
"type": "module",
7+
"devDependencies": {
8+
"@openclaw/plugin-sdk": "workspace:*"
9+
},
10+
"openclaw": {
11+
"extensions": [
12+
"./index.ts"
13+
]
14+
}
15+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { afterEach, describe, expect, it, vi } from "vitest";
2+
import { buildInworldSpeechProvider } from "./speech-provider.js";
3+
4+
describe("buildInworldSpeechProvider", () => {
5+
const originalEnv = process.env.INWORLD_API_KEY;
6+
7+
afterEach(() => {
8+
process.env.INWORLD_API_KEY = originalEnv;
9+
vi.restoreAllMocks();
10+
});
11+
12+
it("reports configured when INWORLD_API_KEY env var is set", () => {
13+
process.env.INWORLD_API_KEY = "test-key";
14+
const provider = buildInworldSpeechProvider();
15+
expect(
16+
provider.isConfigured({
17+
providerConfig: {},
18+
timeoutMs: 30_000,
19+
}),
20+
).toBe(true);
21+
});
22+
23+
it("reports configured when providerConfig apiKey is set", () => {
24+
delete process.env.INWORLD_API_KEY;
25+
const provider = buildInworldSpeechProvider();
26+
expect(
27+
provider.isConfigured({
28+
providerConfig: { apiKey: "config-key" },
29+
timeoutMs: 30_000,
30+
}),
31+
).toBe(true);
32+
});
33+
34+
it("reports not configured when no key is available", () => {
35+
delete process.env.INWORLD_API_KEY;
36+
const provider = buildInworldSpeechProvider();
37+
expect(
38+
provider.isConfigured({
39+
providerConfig: {},
40+
timeoutMs: 30_000,
41+
}),
42+
).toBe(false);
43+
});
44+
45+
it("has correct provider metadata", () => {
46+
const provider = buildInworldSpeechProvider();
47+
expect(provider.id).toBe("inworld");
48+
expect(provider.label).toBe("Inworld");
49+
expect(provider.autoSelectOrder).toBe(30);
50+
expect(provider.models).toContain("inworld-tts-1.5-max");
51+
expect(provider.models).toContain("inworld-tts-1.5-mini");
52+
});
53+
54+
it("normalizes provider-owned speech config from raw provider config", () => {
55+
const provider = buildInworldSpeechProvider();
56+
const resolved = provider.resolveConfig?.({
57+
cfg: {} as never,
58+
timeoutMs: 30_000,
59+
rawConfig: {
60+
providers: {
61+
inworld: {
62+
apiKey: "basic-key",
63+
baseUrl: "https://custom.inworld.example.com/",
64+
voiceId: "Ashley",
65+
modelId: "inworld-tts-1.5-mini",
66+
temperature: 0.8,
67+
},
68+
},
69+
},
70+
});
71+
72+
expect(resolved).toEqual({
73+
apiKey: "basic-key",
74+
baseUrl: "https://custom.inworld.example.com",
75+
voiceId: "Ashley",
76+
modelId: "inworld-tts-1.5-mini",
77+
temperature: 0.8,
78+
});
79+
});
80+
});

0 commit comments

Comments
 (0)