Spaces:
Sleeping
title: VoiceCraft CPU Clone Server
emoji: ποΈ
colorFrom: gray
colorTo: blue
sdk: docker
app_port: 7860
startup_duration_timeout: 1h
VoiceCraft FastAPI Worker 3.1.2
Deploy the contents of this HF directory at the root of a Docker Hugging Face Space.
The worker provides:
- Edge, Piper, and Silero text-to-speech where available
- Optional Pocket TTS CPU voice cloning
- Firebase license, device, credit, version, and worker-assignment enforcement
- FastAPI health/status endpoints for the admin tools
- Capacity protection and per-license/device rate limits
Required protected settings
VOICECRAFT_AUTH_MODE=licenseFIREBASE_SERVICE_ACCOUNT_JSONcontaining the complete Firebase service-account JSONVOICECRAFT_SPACE_ID=autoso Hugging Face'sSPACE_IDidentifies each worker uniquely
For a TTS-only worker:
ENABLE_CLONE_ENGINES=0
For a clone worker:
ENABLE_CLONE_ENGINES=1HF_TOKENwith read access after accepting the Pocket TTS model terms
A single protected VOICECRAFT_SPACE_CONFIG_JSON may be used instead:
{
"space_id": "auto",
"auth_mode": "license",
"max_concurrent_jobs": 1,
"service_version": "3.1.2",
"minimum_version": "3.0.0",
"enable_clone_engines": false,
"firebase_service_account": {
"type": "service_account",
"project_id": "YOUR_PROJECT_ID",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk@YOUR_PROJECT_ID.iam.gserviceaccount.com",
"token_uri": "https://oauth2.googleapis.com/token"
}
}
Keep space_id set to auto when reusing the same configuration across workers. A fixed ID would make multiple workers write health and usage under the same Firestore document.
Optional settings
VOICECRAFT_MAX_CONCURRENT_JOBSβ 1 to 20; default 1VOICECRAFT_SERVICE_VERSIONβ reported service versionMIN_CLIENT_VERSIONβ fallback minimum desktop versionTTS_REQUESTS_PER_MINUTEβ default 60CLONE_REQUESTS_PER_MINUTEβ default 8VOICECRAFT_SPACE_URLβ explicit public worker URL when auto-detection is unavailableVOICECRAFT_DISABLE_WARMUP=1β testing only; prevents startup model warm-up
VOICECRAFT_AUTH_MODE=layered requires both Firebase licensing and VOICECRAFT_API_SECRET. api_secret mode exists for legacy private integrations and is not recommended for distributed desktop software.
Firebase worker document
Create or update the worker in the admin Spaces page. Important fields include:
- canonical Space ID matching the worker's reported
space_id - HTTPS
.hf.spaceURL - enabled status
clone_enabledvisibility:publicorprivate- priority and maximum concurrent jobs
Private workers are excluded from the public runtime pool. The worker also rejects direct requests from accounts that are not assigned to it.
Endpoints
GET/HEAD /healthβ health and availabilityGET /statusβ service status and policy summaryGET /all_voicesβ available voicesPOST /register_userβ Firebase user/device registrationPOST /activate_licenseβ license activationGET /license_statusβ current license statePOST /ttsβ authenticated TTS or voice-clone generation
Local Docker test
docker build -t voicecraft-worker .
docker run --rm -p 7860:7860 \
-e VOICECRAFT_DISABLE_WARMUP=1 \
-e ENABLE_CLONE_ENGINES=0 \
voicecraft-worker
For an authenticated /tts test, supply a real test Firebase project, license, device ID, worker document, and client headers. Never test with production customer credentials in shared logs.
Pocket TTS access
- Accept the model terms on the Pocket TTS model page while signed in.
- Create a Hugging Face read token.
- Store it as the protected
HF_TOKENsecret. - Restart the Space.
First startup can be slow while model files download. Keep cloning requests within the application's documented character limits and test representative reference audio before enabling the worker for customers.