API-Dokumentation
ClonyVoice bietet eine lokale REST-API, mit der Sie Text-to-Speech, Stimmklonen und Audioverarbeitung in Ihre eigenen Anwendungen integrieren können. Die API läuft auf Ihrem Rechner, solange ClonyVoice geöffnet ist.
The local API is included in the Pro and Studio plans. Create and manage your API keys from the API tab inside the app.
Basis-URL
Die API ist lokal verfügbar unter:
Authentifizierung
Alle API-Anfragen erfordern einen API-Schlüssel, der über den X-API-Key HTTP-Header übergeben wird. Erstellen Sie Schlüssel in der ClonyVoice Desktop-App unter dem API-Tab.
Endpunkte
Voices
| Method | Path | Description | Scope |
|---|---|---|---|
| GET | /api/voices | List all voices | voices:read |
| GET | /api/voices/{id} | Get voice details | voices:read |
| PUT | /api/voices/{id} | Update voice metadata | voices:write |
| DELETE | /api/voices/{id} | Delete voice | voices:write |
| GET | /api/favorites | Get favorite voices | voices:read |
| POST | /api/favorites/{id} | Toggle favorite | voices:write |
Text-to-Speech (TTS)
| Method | Path | Description | Scope |
|---|---|---|---|
| POST | /api/generate/clone | Generate speech (cloned voice) | tts:generate |
| POST | /api/generate/preset | Generate speech (preset voice) | tts:generate |
| POST | /api/generate/clone-chunked | Chunked generation (per sentence) | tts:generate |
| POST | /api/generate/clone-chunked-multivoice | Multi-voice chunked generation | tts:generate |
| POST | /api/generate/clone-chunked-multilang | Multi-language chunked generation | tts:generate |
| POST | /api/generate/regenerate-chunk | Regenerate a single chunk | tts:generate |
| POST | /api/generate/merge-chunks | Merge chunks into final audio | tts:generate |
| POST | /api/generation/cancel | Cancel ongoing generation | tts:generate |
| POST | /api/text/split | Split text into sentences | audio:process |
Voice Cloning & Design
| Method | Path | Description | Scope |
|---|---|---|---|
| POST | /api/clone/create-clips | Create voice clone (multi-clip with regions) | clone:create |
| POST | /api/clone/create | Create voice clone (single sample) | clone:create |
| POST | /api/clone/create-multi | Create voice clone (multi-sample) | clone:create |
| POST | /api/clone/cancel | Cancel clone creation | clone:create |
| POST | /api/design/create | Create voice from description | clone:create |
| POST | /api/design/cancel | Cancel design creation | clone:create |
| POST | /api/voices/{id}/generate-preview | Generate voice preview | clone:create |
Audio Processing
| Method | Path | Description | Scope |
|---|---|---|---|
| POST | /api/transcribe | Transcribe audio (Whisper) | audio:process |
| POST | /api/audio-duration | Get audio file duration | audio:process |
| GET | /api/audio/chunk/{task_id}/{index} | Retrieve generated audio chunk | tts:generate |
| POST | /api/download-video | Download audio from video URL | audio:process |
Timeline
| Method | Path | Description | Scope |
|---|---|---|---|
| GET | /api/timeline/{task_id} | Get timeline layout | tts:timeline |
| POST | /api/timeline/{task_id}/layout | Save block positions | tts:timeline |
| POST | /api/timeline/{task_id}/import-track | Import external audio track | tts:timeline |
| POST | /api/timeline/{task_id}/import-video | Import video/image for timeline | tts:timeline |
| POST | /api/generate/merge-timeline | Merge timeline into single file | tts:timeline |
System
| Method | Path | Description | Scope |
|---|---|---|---|
| GET | /api/system/stats | CPU, RAM, GPU stats | system:read |
| GET | /api/system/status | Detailed system status | system:read |
| GET | /api/system/gpu | Detailed GPU information | system:read |
| GET | /api/system/info | Hardware info | system:read |
| GET | /api/queue/status | GPU queue status | system:read |
| POST | /api/job/cancel | Cancel a queued job | system:read |
| POST | /api/api-keys | Create API key | system:read |
| GET | /api/api-keys | List API keys | system:read |
| DELETE | /api/api-keys/{key_id} | Delete an API key | system:read |
| POST | /api/api-keys/{key_id}/revoke | Revoke an API key | system:read |
WebSocket
| Method | Path | Description | Scope |
|---|---|---|---|
| WS | /ws | Real-time progress updates | ws:connect |
Codebeispiele
Rate Limiting
Jeder API-Schlüssel hat pro Scope Rate-Limits (Anfragen pro Minute). Bei Überschreitung gibt die API HTTP 429 zurück. Die Standardlimits sind pro Schlüssel konfigurierbar.
Scopes
Jeder Endpunkt erfordert einen bestimmten Scope. Schlüssel erhalten standardmäßig alle Scopes.
| Scope | Description | Default limit/min |
|---|---|---|
tts:generate | Generate speech (TTS) | 10 |
tts:timeline | Timeline editor access | 30 |
voices:read | Read voices | 60 |
voices:write | Modify / delete voices | 20 |
clone:create | Create voice clones | 2 |
audio:process | Process audio files | 5 |
system:read | Read system info | 60 |
ws:connect | WebSocket connection | 5 |