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