Skip to content

Commit a4b8bf8

Browse files
committed
api doc
1 parent e0d26f6 commit a4b8bf8

File tree

4 files changed

+64
-321
lines changed

4 files changed

+64
-321
lines changed

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,30 +133,56 @@ Request body:
133133
{
134134
"input": "Hello, world!",
135135
"voice": "alloy",
136-
"response_format": "mp3"
136+
"response_format": "mp3",
137+
"instructions": "Speak in a cheerful tone"
137138
}
138139
```
139140

141+
#### Parameters
142+
- `input` (required): The text to convert to speech
143+
- `voice` (required): The voice to use. Supported voices: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse
144+
- `response_format` (optional): The format of the audio output. Default: mp3. Supported formats: mp3, opus, aac, flac, wav, pcm
145+
- `instructions` (optional): Additional instructions for voice modulation
146+
147+
#### Response
148+
- Success: Returns audio data with appropriate content type
149+
- Error: Returns JSON with error message and status code
150+
140151
### Queue Status
141152
```http
142153
GET /api/queue-size
143154
```
144155

156+
Response:
157+
```json
158+
{
159+
"queue_size": 5,
160+
"max_queue_size": 100
161+
}
162+
```
163+
145164
### Voice Samples
146165
```http
147166
GET /api/voice-sample/{voice}
148167
```
149168

169+
#### Parameters
170+
- `voice` (required): The voice to get a sample for. Must be one of: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse
171+
172+
#### Response
173+
- Success: Returns MP3 audio sample
174+
- Error: Returns JSON with error message and status code
175+
150176
### Version
151177
```http
152178
GET /api/version
153179
```
154180

155-
## 🧪 Testing
156-
Run the test suite:
157-
```bash
158-
python test_api.py
159-
python test_queue.py
181+
Response:
182+
```json
183+
{
184+
"version": "v2.0.0-alpha1"
185+
}
160186
```
161187

162188
## 📝 License

README_CN.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,30 +133,56 @@ POST /v1/audio/speech
133133
{
134134
"input": "你好,世界!",
135135
"voice": "alloy",
136-
"response_format": "mp3"
136+
"response_format": "mp3",
137+
"instructions": "用欢快的语气说话"
137138
}
138139
```
139140

141+
#### 参数
142+
- `input` (必需): 要转换为语音的文本
143+
- `voice` (必需): 要使用的语音。
144+
- `response_format` (可选): 音频输出格式。默认: mp3。支持的格式: mp3, opus, aac, flac, wav, pcm
145+
- `instructions` (可选): 语音调制的额外指令
146+
147+
#### 响应
148+
- 成功: 返回音频数据和相应的内容类型
149+
- 错误: 返回包含错误信息和状态码的 JSON
150+
140151
### 队列状态
141152
```http
142153
GET /api/queue-size
143154
```
144155

156+
响应:
157+
```json
158+
{
159+
"queue_size": 5,
160+
"max_queue_size": 100
161+
}
162+
```
163+
145164
### 语音样本
146165
```http
147166
GET /api/voice-sample/{voice}
148167
```
149168

169+
#### 参数
170+
- `voice` (必需): 要获取样本的语音。必须是以下之一: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse
171+
172+
#### 响应
173+
- 成功: 返回 MP3 音频样本
174+
- 错误: 返回包含错误信息和状态码的 JSON
175+
150176
### 版本
151177
```http
152178
GET /api/version
153179
```
154180

155-
## 🧪 测试
156-
运行测试套件:
157-
```bash
158-
python test_api.py
159-
python test_queue.py
181+
响应:
182+
```json
183+
{
184+
"version": "v2.0.0-alpha1"
185+
}
160186
```
161187

162188
## 📝 许可证

test_api.py

Lines changed: 0 additions & 201 deletions
This file was deleted.

0 commit comments

Comments
 (0)