VocalFace API (v1)
Auth: header x-api-key: mk_... on everything except /v1/signup, /v1/billing/plans, webhooks, /health. Errors are {"detail": ...}. Interactive spec: /docs on the API server itself, raw: /openapi.json. Route list below was taken from the app's generated OpenAPI. Routes owned by other modules (knowledge, realtime) are listed with their request shapes at time of writing; check /openapi.json for changes.
Account
POST /v1/signup{email}->{account_id, api_key, credits_seconds}(600 free seconds)GET /v1/usage->{credits_seconds}GET /v1/usage/ledger?limit=-> ledger rows (kind: topup|plan|usage|grant|adjust,seconds+/-,amount_cents,ref)GET /v1/audit?limit=-> audit log rows for the accountGET /health
Replicas
POST /v1/replicas{name, train_video_url};GET /v1/replicas;GET /v1/replicas/{rid}- A replica cannot be marked
readywithout a consent record (worker must callsafety.require_consent(replica_id)).POST /v1/videosreturns 409 until ready.
Consent
POST /v1/replicas/{rid}/consent/challenge->{challenge_id, phrase, expires_at}(15 min, single use; phrase includes a random code)POST /v1/replicas/{rid}/consent{challenge_id, speaker_name, audio_url, transcript}. 422 if the transcript (case/punctuation-insensitive) does not equal the phrase; 410 if expired/used.GET /v1/replicas/{rid}/consent->{has_consent, records};DELETErevokes all records.
Personas, knowledge, memories
POST /v1/personas{name, system_prompt, replica_id?, llm?, tts_voice?, knowledge?};GET /v1/personasPOST /v1/personas/{pid}/knowledge/text{title, text};POST .../knowledge/upload(multipartfile,title?);GET .../knowledge;DELETE .../knowledge/{did};POST .../knowledge/search{query, k?}POST /v1/personas/{pid}/memories{conversation_id?, summary?, turns?};GET .../memories?limit=
Conversations
POST /v1/conversations{persona_id}-> 402 if out of credits;POST /v1/conversations/{cid}/end(deducts seconds)- WebSocket
/v1/conversations/{cid}/stream?api_key=; close codes 4401 bad key, 4404 not found, 4402 ended/no credits GET /v1/playgroundHTML test page (?cid=&api_key=)
Videos
POST /v1/videos{replica_id, script};GET /v1/videos/{vid}. Scripts should be passed throughsafety.moderate_or_raise(not yet wired into resources.py; see below).
Billing
GET /v1/billing/plans,GET /v1/billing/statusPOST /v1/billing/checkout{provider: stripe|razorpay, kind: topup|plan, sku, success_url?, cancel_url?}->{provider, checkout_url, id}. 501provider_not_configuredwhen keys are absent.POST /v1/billing/webhooks/stripe(headerStripe-Signature, eventcheckout.session.completed),POST /v1/billing/webhooks/razorpay(headerX-Razorpay-Signature, eventpayment_link.paid). 400 bad signature, 503 secret not set. Credits are added once per event id.- Env:
STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET,RAZORPAY_KEY_ID,RAZORPAY_KEY_SECRET,RAZORPAY_WEBHOOK_SECRET,VOCALFACE_USD_INR(default 85).
Moderation
POST /v1/moderation/check{text}->{allowed, reasons, classifier}. Blocklist always; setVOCALFACE_MODERATION_OLLAMA_MODELfor an extra Ollama classifier (falls back to blocklist-only if Ollama is down). Extra terms:VOCALFACE_BLOCKLIST=a,b.
Integration hooks for other modules (python)
app.safety.require_consent(replica_id)before settingReplica.status="ready".app.safety.moderate_or_raise(script)increate_videoand persona creation.app.billing.record_usage(session, acc, seconds, ref=f"conv:{cid}")inend_conversationto populate the ledger.app.safety.enforce_rate_limit(acc.api_key, limit, window)(in-process only).
SDKs
Python sdk/python/vocalface_sdk (VocalFace(api_key, base_url)), TypeScript sdk/js (npm run build), embed sdk/embed/widget.js.