mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-15 12:50:42 -07:00
- Created new directory structure for documentation under `/docs2`. - Added `.gitignore` to exclude build artifacts and dependencies. - Introduced `package.json`, `next.config.mjs`, and `postcss.config.mjs` for project configuration. - Implemented MDX components in `mdx-components.tsx` for rendering documentation. - Migrated existing documentation content and created new files for auto-updater and other features. - Established compatibility layer for Mintlify components in `mintlify-compat.tsx`. - Set up OpenAPI documentation in `openapi.json`. - Updated README and migration guide to reflect new structure and usage instructions. - Ensured all components and pages are ready for development and deployment with Fumadocs.
120 lines
1.7 KiB
Plaintext
120 lines
1.7 KiB
Plaintext
---
|
|
title: "Generation API"
|
|
description: "Generate speech from text"
|
|
---
|
|
|
|
## Generate Speech
|
|
|
|
```http
|
|
POST /generate
|
|
```
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
"text": "Hello world",
|
|
"profile_id": "abc123",
|
|
"language": "en"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "gen123",
|
|
"text": "Hello world",
|
|
"profile_id": "abc123",
|
|
"language": "en",
|
|
"audio_url": "/audio/gen123.wav",
|
|
"duration": 2.3,
|
|
"created_at": "2024-01-29T12:00:00Z"
|
|
}
|
|
```
|
|
|
|
## List History
|
|
|
|
```http
|
|
GET /history
|
|
```
|
|
|
|
**Query Parameters:**
|
|
- `profile_id` (optional) - Filter by voice profile
|
|
- `limit` (optional) - Number of results (default: 50)
|
|
- `offset` (optional) - Pagination offset
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"generations": [
|
|
{
|
|
"id": "gen123",
|
|
"text": "Hello world",
|
|
"profile_id": "abc123",
|
|
"duration": 2.3,
|
|
"created_at": "2024-01-29T12:00:00Z"
|
|
}
|
|
],
|
|
"total": 100
|
|
}
|
|
```
|
|
|
|
## Get Generation
|
|
|
|
```http
|
|
GET /history/{id}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "gen123",
|
|
"text": "Hello world",
|
|
"profile_id": "abc123",
|
|
"language": "en",
|
|
"audio_url": "/audio/gen123.wav",
|
|
"duration": 2.3,
|
|
"created_at": "2024-01-29T12:00:00Z"
|
|
}
|
|
```
|
|
|
|
## Delete Generation
|
|
|
|
```http
|
|
DELETE /history/{id}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
## TypeScript Example
|
|
|
|
```typescript
|
|
import { VoiceboxClient } from '@/lib/api'
|
|
|
|
const client = new VoiceboxClient({
|
|
baseUrl: 'http://localhost:17493'
|
|
})
|
|
|
|
// Generate speech
|
|
const generation = await client.generate({
|
|
text: 'Hello world',
|
|
profile_id: 'abc123',
|
|
language: 'en'
|
|
})
|
|
|
|
// Get audio URL
|
|
const audioUrl = generation.audio_url
|
|
|
|
// List history
|
|
const history = await client.listHistory({
|
|
profile_id: 'abc123',
|
|
limit: 20
|
|
})
|
|
```
|
|
|
|
For full API documentation, visit `http://localhost:17493/docs` when the server is running.
|