fix(tts): support OpenRouter voice overrides and fallback
This commit is contained in:
1 parent
c362114cf1
commit
c180590799
7 files changed
+454
-21
No files matched your search
@@ -455,7 +455,7 @@ Use `mode = lines` when:
|
||||
"tools": {
|
||||
"read_file": {
|
||||
"enabled": true,
|
||||
"mode": "lines",
|
||||
"mode": "lines",
|
||||
"max_read_file_size": 65536
|
||||
}
|
||||
}
|
||||
@@ -838,6 +838,9 @@ Legacy Telegram environment variables remain compatible: `PICOCLAW_CHANNELS_TELE
|
||||
|
||||
Failure behavior is intentionally conservative: if streaming fails before any visible chunk is sent, PicoClaw retries once through the normal `Chat()` path. If a chunk has already been shown to the user, PicoClaw does not send a second non-streaming answer, because that would duplicate visible output.
|
||||
|
||||
For model-specific TTS request fields such as custom speech `voice` names or
|
||||
`response_format: "mp3"`, use `model_list[].extra_body`.
|
||||
|
||||
#### Vendor-Specific Examples
|
||||
|
||||
> **Tip**: You can omit `api_key` fields and store them in `.security.yml` for better security. See [Security Configuration](#-security-configuration-recommended).
|
||||
@@ -856,6 +859,35 @@ Failure behavior is intentionally conservative: if streaming fails before any vi
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>OpenRouter TTS (MAI Voice 2)</b></summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"model_name": "mai-voice-2",
|
||||
"provider": "openrouter",
|
||||
"model": "microsoft/mai-voice-2",
|
||||
"api_base": "https://openrouter.ai/api/v1",
|
||||
"extra_body": {
|
||||
"voice": "en-US-Harper:MAI-Voice-2",
|
||||
"response_format": "mp3"
|
||||
}
|
||||
// api_key: set in .security.yml
|
||||
}
|
||||
```
|
||||
|
||||
Pair this with:
|
||||
|
||||
```json
|
||||
{
|
||||
"voice": {
|
||||
"tts_model_name": "mai-voice-2"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>VolcEngine (Doubao)</b></summary>
|
||||
|
||||
|
||||
@@ -138,6 +138,9 @@ This design also enables **multi-agent support** with flexible provider selectio
|
||||
|
||||
When streaming is disabled, omit the `streaming` block. Writing `"streaming": {"enabled": false}` is optional and not needed in generated or hand-written config.
|
||||
|
||||
`extra_body` is especially useful for model-specific TTS fields on OpenAI-compatible
|
||||
speech routes, for example custom `voice` names or `response_format: "mp3"`.
|
||||
|
||||
#### Tool Schema Compatibility
|
||||
|
||||
By default, PicoClaw now forwards tool JSON Schemas unchanged.
|
||||
@@ -205,6 +208,41 @@ If `voice.model_name` is not configured, PicoClaw will continue to fall back to
|
||||
}
|
||||
```
|
||||
|
||||
#### Voice Synthesis
|
||||
|
||||
You can configure a dedicated text-to-speech model with `voice.tts_model_name`.
|
||||
When the provider needs model-specific TTS request fields, put them in
|
||||
`model_list[].extra_body`.
|
||||
|
||||
Example with OpenRouter `microsoft/mai-voice-2`:
|
||||
|
||||
```json
|
||||
{
|
||||
"model_list": [
|
||||
{
|
||||
"model_name": "mai-voice-2",
|
||||
"provider": "openrouter",
|
||||
"model": "microsoft/mai-voice-2",
|
||||
"api_base": "https://openrouter.ai/api/v1",
|
||||
"extra_body": {
|
||||
"voice": "en-US-Harper:MAI-Voice-2",
|
||||
"response_format": "mp3"
|
||||
},
|
||||
"api_keys": ["sk-or-your-openrouter-key"]
|
||||
}
|
||||
],
|
||||
"voice": {
|
||||
"tts_model_name": "mai-voice-2"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Notes that matter:
|
||||
|
||||
- PicoClaw still uses the OpenAI-compatible `/audio/speech` route for this setup.
|
||||
- The default TTS request uses `voice: alloy` and `response_format: opus`.
|
||||
- Override those defaults with `extra_body` when your selected TTS model requires different values.
|
||||
|
||||
#### Vendor-Specific Examples
|
||||
|
||||
**OpenAI**
|
||||
|
||||
Reference in new issue
Block a user