Documentation API

ClonyVoice fournit une API REST locale qui vous permet d'integrer la synthese vocale, le clonage de voix et le traitement audio dans vos propres applications. L'API fonctionne sur votre machine lorsque ClonyVoice est ouvert.

URL de base

L'API est disponible localement a :

http://127.0.0.1:8765

Authentification

Toutes les requetes API necessitent une cle API transmise via le header HTTP X-API-Key. Creez des cles dans l'application ClonyVoice, onglet API.

X-API-Key: cvk_your_api_key_here

Endpoints

Voices

MethodPathDescriptionScope
GET/api/voicesList all voicesvoices:read
GET/api/voices/{id}Get voice detailsvoices:read
PUT/api/voices/{id}Update voicevoices:write
DELETE/api/voices/{id}Delete voicevoices:write
GET/api/favoritesGet favoritesvoices:read
POST/api/favorites/{id}Toggle favoritevoices:write

Text-to-Speech (TTS)

MethodPathDescriptionScope
POST/api/generate/cloneGenerate speech (clone)tts:generate
POST/api/generate/presetGenerate speech (preset)tts:generate
POST/api/generate/designGenerate speech (design)tts:generate
POST/api/text/splitSplit text into sentencesaudio:process
POST/api/generation/cancelCancel generationtts:generate

Voice Cloning & Design

MethodPathDescriptionScope
POST/api/clone/createCreate voice cloneclone:create
POST/api/clone/create-multiMulti-sample cloneclone:create
POST/api/design/createCreate voice from descriptionclone:create

Audio Processing

MethodPathDescriptionScope
POST/api/transcribeTranscribe audio (Whisper)audio:process
POST/api/audio-durationGet audio durationaudio:process

System

MethodPathDescriptionScope
GET/api/system/statsCPU, RAM, GPU statssystem:read
GET/api/system/infoHardware infosystem:read
GET/api/api-keysList API keyssystem:read
POST/api/api-keysCreate API keysystem:read

WebSocket

MethodPathDescriptionScope
WS/wsReal-time progress updatesws:connect

Exemples de code

curl -X POST "http://127.0.0.1:8765/api/generate/clone" \ -H "X-API-Key: cvk_your_key" \ -H "Content-Type: application/json" \ -d '{ "voice_id": "voice_abc123", "text": "Hello, world!", "language": "en" }'
import requests response = requests.post( "http://127.0.0.1:8765/api/generate/clone", headers={"X-API-Key": "cvk_your_key"}, json={ "voice_id": "voice_abc123", "text": "Hello, world!", "language": "en" } ) print(response.json())
const response = await fetch( "http://127.0.0.1:8765/api/generate/clone", { method: "POST", headers: { "X-API-Key": "cvk_your_key", "Content-Type": "application/json" }, body: JSON.stringify({ voice_id: "voice_abc123", text: "Hello, world!", language: "en" }) } ); const data = await response.json(); console.log(data);

Rate Limiting

Chaque cle API a des limites par scope (requetes par minute). En cas de depassement, l'API retourne HTTP 429. Les limites par defaut sont configurables par cle.

Scopes

Chaque endpoint necessite un scope specifique. Les cles recoivent tous les scopes par defaut.

ScopeDescriptionDefault limit/min
tts:generateGenerate speech (TTS)10
tts:timelineTimeline editor access30
voices:readRead voices & categories60
voices:writeModify / delete voices20
clone:createCreate voice clones2
audio:processProcess audio files5
projects:readRead compositions60
projects:writeModify compositions20
system:readRead system info60
ws:connectWebSocket connection5