inworld-tts

TotalClaw 作者 totalclaw

通过 Inworld.ai API 进行文本转语音。在从文本生成语音音频、创建口头响应或将文本转换为 MP3/音频文件时使用。支持多种语音、语速和长文本流。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~gugic-inworld-tts
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~gugic-inworld-tts/file -o gugic-inworld-tts.md
# Inworld TTS

Generate speech audio from text using Inworld.ai's TTS API.

## Setup

1. Get API key from https://platform.inworld.ai
2. Generate key with "Voices: Read" permission
3. Copy the "Basic (Base64)" key
4. Set environment variable:

```bash
export INWORLD_API_KEY="your-base64-key-here"
```

For persistence, add to `~/.bashrc` or `~/.clawdbot/.env`.

## Installation

```bash
# Copy skill to your skills directory
cp -r inworld-tts /path/to/your/skills/

# Make script executable
chmod +x /path/to/your/skills/inworld-tts/scripts/tts.sh

# Optional: symlink for global access
ln -sf /path/to/your/skills/inworld-tts/scripts/tts.sh /usr/local/bin/inworld-tts
```

## Usage

```bash
# Basic
./scripts/tts.sh "Hello world" output.mp3

# With options
./scripts/tts.sh "Hello world" output.mp3 --voice Dennis --rate 1.2

# Streaming (for text >4000 chars)
./scripts/tts.sh "Very long text..." output.mp3 --stream
```

## Options

| Option | Default | Description |
|--------|---------|-------------|
| `--voice` | Dennis | Voice ID |
| `--rate` | 1.0 | Speaking rate (0.5-2.0) |
| `--temp` | 1.1 | Temperature (0.1-2.0) |
| `--model` | inworld-tts-1.5-max | Model ID |
| `--stream` | false | Use streaming endpoint |

## API Reference

| Endpoint | Use |
|----------|-----|
| `POST https://api.inworld.ai/tts/v1/voice` | Standard synthesis |
| `POST https://api.inworld.ai/tts/v1/voice:stream` | Streaming for long text |

## Requirements

- `curl` - HTTP requests
- `jq` - JSON processing  
- `base64` - Decode audio

## Examples

```bash
# Quick test
export INWORLD_API_KEY="aXM2..."
./scripts/tts.sh "Testing one two three" test.mp3
mpv test.mp3  # or any audio player

# Different voice and speed
./scripts/tts.sh "Slow and steady" slow.mp3 --rate 0.8

# Fast-paced narration
./scripts/tts.sh "Breaking news!" fast.mp3 --rate 1.5
```

## Troubleshooting

**"INWORLD_API_KEY not set"** - Export the environment variable before running.

**Empty output file** - Check API key is valid and has "Voices: Read" permission.

**Streaming issues** - Ensure `jq` supports `--unbuffered` flag.

## Links

- Inworld Platform: https://platform.inworld.ai
- API Examples: https://github.com/inworld-ai/inworld-api-examples

---

## 中文说明

# Inworld TTS

使用 Inworld.ai 的 TTS API 从文本生成语音音频。

## 设置

1. 从 https://platform.inworld.ai 获取 API 密钥
2. 生成具有 "Voices: Read" 权限的密钥
3. 复制 "Basic (Base64)" 密钥
4. 设置环境变量:

```bash
export INWORLD_API_KEY="your-base64-key-here"
```

如需持久化,请添加到 `~/.bashrc` 或 `~/.clawdbot/.env`。

## 安装

```bash
# Copy skill to your skills directory
cp -r inworld-tts /path/to/your/skills/

# Make script executable
chmod +x /path/to/your/skills/inworld-tts/scripts/tts.sh

# Optional: symlink for global access
ln -sf /path/to/your/skills/inworld-tts/scripts/tts.sh /usr/local/bin/inworld-tts
```

## 用法

```bash
# Basic
./scripts/tts.sh "Hello world" output.mp3

# With options
./scripts/tts.sh "Hello world" output.mp3 --voice Dennis --rate 1.2

# Streaming (for text >4000 chars)
./scripts/tts.sh "Very long text..." output.mp3 --stream
```

## 选项

| 选项 | 默认值 | 说明 |
|--------|---------|-------------|
| `--voice` | Dennis | 语音 ID |
| `--rate` | 1.0 | 语速(0.5-2.0) |
| `--temp` | 1.1 | 温度(0.1-2.0) |
| `--model` | inworld-tts-1.5-max | 模型 ID |
| `--stream` | false | 使用流式端点 |

## API 参考

| 端点 | 用途 |
|----------|-----|
| `POST https://api.inworld.ai/tts/v1/voice` | 标准合成 |
| `POST https://api.inworld.ai/tts/v1/voice:stream` | 长文本流式处理 |

## 依赖

- `curl` - HTTP 请求
- `jq` - JSON 处理  
- `base64` - 解码音频

## 示例

```bash
# Quick test
export INWORLD_API_KEY="aXM2..."
./scripts/tts.sh "Testing one two three" test.mp3
mpv test.mp3  # or any audio player

# Different voice and speed
./scripts/tts.sh "Slow and steady" slow.mp3 --rate 0.8

# Fast-paced narration
./scripts/tts.sh "Breaking news!" fast.mp3 --rate 1.5
```

## 故障排查

**"INWORLD_API_KEY not set"** - 运行前请导出该环境变量。

**输出文件为空** - 检查 API 密钥是否有效并具有 "Voices: Read" 权限。

**流式问题** - 确保 `jq` 支持 `--unbuffered` 标志。

## 链接

- Inworld 平台:https://platform.inworld.ai
- API 示例:https://github.com/inworld-ai/inworld-api-examples