Choose your integration
Try the full-page chat demos for text, voice and media. The demos open /voice-chat/direct/{ticket} without an iframe, while retaining shared scoped sessions, authorization and metering. Enable Stream replies to display text as it arrives; turning it off keeps whole-reply delivery. Text-only streaming uses the normal per-request price. Live voice retains per-minute billing and the public demo retains its five-minute limit.
The demo selection pages offer Maryanne (female, left) and Michael (male, right) with portrait cards and a highlighted selection. Each fresh selection page defaults to Maryanne. The public /poc page includes both characters; older /poc/{voice} links redirect there. Character names are separate from voice IDs: the current picker sends eve for Maryanne and leo for Michael. Back to demos returns to the originating selection page through a validated same-origin return_to destination.
Live voice defaults to Allow voice interruptions off for new browser sessions; explicitly saved preferences persist. Stop Speaking appears only while assistant audio is playing, to the right of End Call and Mute on desktop and mobile. It stops the reply and queued playback while keeping the call connected. End Call disconnects the call.
Companion in a Box is the alternate, ready-made iframe integration documented here. Choose it when you want an embeddable interface with character, branding, history and budget controls. For a fully custom interface, use the direct streaming API through your own authenticated backend. It supports text SSE and live voice with optional hands-free turn detection; push-to-talk remains the default. Direct voice sessions do not automatically inherit widget history, media tools, member budgets or webhooks.
Integrate SexyChat V2 into your HTTPS website using the shared JavaScript SDK and a server-side session endpoint. All three options support client-supplied adult characters, branding and conversation history. Live calls also support signed call-end webhooks. This guide reflects the widget integration contract and hosted demo behavior reviewed October 25, 2026.
MCP tools are a separate integration: MCP setup and tool reference. MCP chat returns completed results; the direct API carries live audio and streamed text. Closing an embedded companion is processed once even when multiple close/unload events occur.
Three widget options
| Option | Session settings | Conversation and media |
|---|---|---|
| Text + Media | mode: "full_chat"non_live_voice: true | Typed messages and text replies, optional generated reply audio, image/video requests, reference uploads and a media carousel. No live microphone call. |
| Voice + Media | mode: "full_chat"non_live_voice: false | Live spoken conversation plus typed chat, image/video requests, reference uploads and a media carousel. |
| Voice Only | mode: "voice_only"non_live_voice: false | Live spoken conversation. Typed chat and media generation controls are hidden; generation endpoints are blocked server-side. |
These are three supported configurations of one SDK and one session API. The API keeps the existing mode values full_chat and voice_only; there is no third mode string. Send non_live_voice as a JSON boolean, not a string. Use true only with full_chat. Omitting both fields selects live voice with images and video.
1. Text + Media
{ "mode": "full_chat", "non_live_voice": true }
Audio is generated when the user selects Listen, or when they enable automatic reply audio in Settings. Automatic audio defaults off. The selected character voice is used for readout. Text requests are billed per request; generated reply audio currently costs 1 credit per reply. Replaying already generated audio is free. Images and videos are charged separately after the user reviews and approves the generation. This option does not start live voice or per-minute voice billing. Save/Load preserves the conversation but does not embed generated audio files.
2. Voice + Media
{ "mode": "full_chat", "non_live_voice": false }
The user starts a live call and grants microphone permission. They can speak or type and request images or videos during the conversation. Media generation follows the shared quote and approval flow and runs asynchronously. Live voice uses per-started-minute billing; typed requests and media generation have their own charges.
3. Voice Only
{ "mode": "voice_only", "non_live_voice": false }
Use this option for a focused spoken conversation. It uses live voice billing and requires microphone permission. Character profile photos can still appear at startup; a profile photo is not a media-generation feature. Character-sheet URLs may be retained in the character definition but do not enable generation in this option.
Add the settings above to the full server-side request shown below, together with origin, end_user_id and character or character_id. The SDK name WowifyVoiceWidget, script URL and API paths remain the same for all three options.
Both media options accept reference images and videos through the upload button in the text composer, clipboard paste, or drag and drop, up to 100 MB per file. The Media tool reviews generated output in session order. Voice Only excludes the text composer and media-generation controls.
Integration flow
- Your signed-in user clicks your chat button.
- The SDK POSTs to a same-origin endpoint on your backend.
- Your backend authenticates the user and creates a widget session using your issued API-Key and Client-ID.
- Your backend returns the session JSON unchanged. The SDK opens the hosted widget in a dialog.
- For live voice, your backend receives a signed call.completed webhook after the call-end event is saved. For text-only sessions, use saved transcript snapshots and the authenticated history endpoint. Save history on your side and pass it into a later session when needed.
Keep API credentials and webhook secrets on your server. The browser receives only the scoped session response. Each session ticket expires 24 hours after creation. Opening another session creates a fresh session; end_user_id alone does not restore history.
JavaScript embed
Load the SDK from the same service that creates the frame URL. The built-in SDK opens a modal dialog; it does not currently accept a mount element for an inline page embed.
<meta name="csrf-token" content="YOUR_APPLICATION_CSRF_TOKEN">
<button type="button" id="open-chat">Chat with Maya</button>
<script src="https://models.privatecloud.ai/public/js/voice-widget/widget.js"></script>
<script>
const chat = WowifyVoiceWidget.create({
sessionEndpoint: '/api/my-voice-session',
title: 'Chat with Maya',
showBalance: false,
labels: { close: 'Close', opening: 'Opening conversation...' },
onEvent(event) {
if (event.type === 'widget.error' || event.type === 'delivery.error') {
console.error(event.message);
}
if (event.type === 'transcript.updated' || event.type === 'call.completed') {
// Forward to your authenticated backend if using a browser fallback.
// Treat browser-provided billing fields as untrusted.
console.log(event.type, event.event_id);
}
}
});
document.getElementById('open-chat').addEventListener('click', () => {
chat.open({ option: 'text_media' });
});
// To close programmatically: chat.close();
</script>
sessionEndpoint must have the same origin as your webpage. The SDK sends JSON with same-origin credentials and uses csrfToken from its options, or the csrf-token meta tag, as X-CSRF-TOKEN. Adapt your own endpoint to your framework's CSRF convention. Values passed to open() are sent to your backend; your backend must validate them and build the authorized session payload. The SDK does not turn arbitrary open() values directly into character or branding settings. In this example, your backend reads and authorizes option, then passes it to createWidgetSession. Use text_media, voice_media or voice_only for the three application choices; map them to the API settings shown above.
Use HTTPS for all three options. Allow microphone access for the two live voice options; text with audio readout does not require microphone access. The iframe requests microphone, autoplay, and fullscreen permissions. Your site's Permissions-Policy and CSP must allow the hosted frame and SDK; a restrictive parent policy can still block microphone use. A user gesture is needed to start the voice interaction.
Server API and session example
Base URL: https://models.privatecloud.ai
| Method and path | Purpose |
|---|---|
| POST /voice-widget/api/sessions | Create a widget session |
| POST /voice-widget/api/characters | Issue a reusable character definition token |
Both endpoints require API-Key and Client-ID headers and Content-Type: application/json. You need only two credentials: the supplied common API key and your existing PrivateCloud access token. Send the common API key in API-Key and your access token in Client-ID. The same access token is the username value in API requests that require username. Access token, Client-ID and API username are the same account credential; no separate client ID or username is needed. Use the credentials issued for your integration. Client-ID identifies the authorized prepaid account; it is not the end user's ID. The account must be API enabled. The character and session creation routes have a configured throttle of 30 requests per minute; do not assume a separate quota per end user.
The following Node.js helper uses built-in fetch. Call it from your authenticated backend route and return its JSON response. Supply currentUser and savedHistory from your own server-side records, never from an unverified browser account ID.
// These option names belong to your application, not the upstream API.
const widgetOptions = {
text_media: { mode: 'full_chat', non_live_voice: true },
voice_media: { mode: 'full_chat', non_live_voice: false },
voice_only: { mode: 'voice_only', non_live_voice: false }
};
async function createWidgetSession(currentUser, savedHistory = [], option = 'text_media') {
if (!Object.prototype.hasOwnProperty.call(widgetOptions, option)) {
throw new Error('Unknown widget option');
}
// Authorize this selection for currentUser in your own backend.
const selection = widgetOptions[option];
const response = await fetch(
'https://models.privatecloud.ai/voice-widget/api/sessions',
{
method: 'POST',
headers: {
'API-Key': process.env.WOWIFY_WIDGET_API_KEY,
'Client-ID': process.env.WOWIFY_CLIENT_ID,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
...selection,
call_limit_seconds: -1, // Unlimited live call duration; credit and spending limits still apply.
show_balance: false,
origin: 'https://your-site.example',
end_user_id: String(currentUser.id),
character: {
name: 'Maya', age: 28, gender: 'female', voice: 'eve',
personality: 'Warm, friendly, playful and concise.',
appearance: 'An adult woman with long dark hair and brown eyes.',
interests: 'Art, travel and films.',
profile_photo_url: 'https://your-site.example/maya-profile.jpg',
character_sheet_url: 'https://your-site.example/maya-reference.jpg'
},
branding: {
name: 'Your Brand', creator: 'Your Company',
labels: { title: 'Chat with Maya', privacy: 'Save your conversation to keep a copy.' },
colors: { primary: '#6752d8', on_primary: '#ffffff' },
sizes: { font_size: 16, title_size: 18, page_padding: 6 }
},
history: savedHistory,
webhook: {
url: 'https://your-site.example/api/voice-webhook',
secret: process.env.WOWIFY_WEBHOOK_SECRET
}
})
}
);
const result = await response.json();
if (!response.ok) throw new Error(result.error || result.message || 'Session creation failed');
return result;
}
Your route must authenticate and authorize the current user, apply your own usage controls, and return a suitable JSON error on failure. Never proxy API-Key, Client-ID, origin, webhook destinations, or arbitrary account choices from browser input.
Successful creation returns HTTP 201 with session_id, expires_at (Unix seconds), history_expires_at, history_url, mode, frame_url, and appearance. Pass the complete response to the SDK. Treat frame_url as a temporary bearer credential: do not publish or log it. appearance includes normalized name, font_family, colors, labels, and sizes.
Session request fields
| Field | Meaning and limits |
|---|---|
| mode | full_chat (default) for text/media or live voice/media; voice_only for live voice without media |
| non_live_voice | JSON boolean, default false. Set true with full_chat for typed conversation with optional generated reply audio; false for both live voice options. |
| call_limit_seconds | Optional JSON integer for each live call: positive seconds or -1 for unlimited. Defaults to 300 when omitted. Zero, other negatives, fractions, strings and booleans are invalid. See Live call limits. |
| show_balance | Defaults to true. Send JSON false to hide the available account balance in the frame from initial rendering and suppress widget.balance notifications. Also set SDK showBalance: false to hide the outer dialog balance. |
| origin | Exact embedding HTTPS origin, such as https://example.com; optional explicit port; no path, query, fragment, or credentials |
| end_user_id | Required nonempty client end-user identifier, up to 160 bytes |
| character | Inline character definition; provide this or a valid issued character_id |
| character_id | Opaque vc1_ token issued by the character endpoint; bound to your Client-ID account; not an arbitrary local character name |
| branding | Optional appearance and wording object |
| history | Up to 100 messages; each has role user or assistant and string content up to 12,000 bytes; encoded message list up to 262,144 bytes |
| webhook | Optional url and secret; omit to disable server delivery |
The session request body is capped at 524,288 bytes. Full Chat enables typed conversation and image/video workflows. Voice Only restricts the frame to voice-related operations and conversation saving. Character and branding settings belong to your backend; their editor is hidden in the widget.
A frame action is authorized by its temporary ticket, not your normal application cookie. Expired tickets return 401; create a new session and seed history from your saved records.
Live call limits
Set call_limit_seconds in your backend's POST /voice-widget/api/sessions request. This controls each live Voice + Media or Voice Only call; it does not limit typed conversations or generated reply audio. Set it when creating the session, not as a browser-only timer or SDK appearance option.
| Value | Behavior |
|---|---|
-1 | No configured duration limit. Account credits, widget spending limits and connection availability still apply. |
600 | Ten-minute maximum connected duration per call. Any positive integer sets a limit in seconds. |
| Omitted | External widget sessions default to 300 seconds (five minutes). |
// Add one of these fields to your server-side session payload:
call_limit_seconds: -1 // Unlimited
call_limit_seconds: 600 // Ten minutes
Signed-in /voice-chat/session defaults to -1 and accepts a custom limit. Public /poc/session always uses 300 seconds and ignores overrides. Existing sessions retain their configuration; create a new session to change it.
The server signs the effective limit into the relay token, so changing the browser timer cannot extend a call. If widget spending limits are configured, the effective duration is shortened to the whole minutes affordable within the remaining user and session budgets. Finite calls reserve 15 credits per started minute of that effective duration, with unused budget released through settlement to actual usage. Unlimited calls without widget spending limits reserve the first 15 credits for tracking. Account credit availability is checked before every billed minute.
Billing continues at 15 credits per started minute beyond five minutes. For example, a 361-second call costs 105 credits. Unlimited duration does not override insufficient-credit cutoff, spending budgets, session-ticket expiry or disconnections.
The authenticated POST https://api.lightspeedcloud.ai/api/v2/voice/realtime/session endpoint also accepts call_limit_seconds, defaulting to 300. Its response includes relay.call_limit_seconds, matching the signed policy. Widget integrations pass the setting through their server-side widget session request and use the hosted relay flow.
Supported voices and male/female companions
Verified October 19, 2026. Use eve for the female example and leo for the male example. Character name and gender are independent of the voice ID: naming a character Michael does not create a voice named michael. Set the voice explicitly.
{"name":"Maya","age":28,"gender":"female","voice":"eve","personality":"Warm, friendly and concise."}
{"name":"Leo","age":30,"gender":"male","voice":"leo","personality":"Warm, confident and thoughtful."}
Current preset IDs: altair, ara, atlas, aurora, carina, castor, celeste, cosmo, eve, helios, helix, iris, kepler, leo, liora, lumen, luna, lux, naksh, orion, perseus, rex, rigel, sal, sirius, ursa, zagan, zenith.
Listen to Eve or Leo. The widget Settings also offers voice previews. Preset availability can change; for generated reply audio, retrieve the current list server-side with the API credentials issued for your account:
curl --fail-with-body https://api.lightspeedcloud.ai/api/v2/voice/tts \
-H "API-Key: $WOWIFY_WIDGET_API_KEY" \
-H "Client-ID: $WOWIFY_CLIENT_ID" \
-H "Accept: application/json"
This GET lists voices; it does not generate audio. Response: {"voices":[{"voice_id":"eve","name":"Eve","description":""},...]}. Use voice_id, not the display name. A 503 means discovery is temporarily unavailable; keep the last verified list and retry later. The listed IDs also match the currently deployed live-voice selector; do not assume future TTS additions automatically support live voice. Do not expose credentials or call this authenticated endpoint directly from frontend code.
Integrator billing, spending limits and model defaults
Server-side session creation accepts optional spending_limits, retail_pricing and generation_defaults. Configure these on your authenticated backend, never in untrusted browser input. Limits are enforced on the server against recorded widget operations across concurrent sessions. Incomplete or ambiguous paid operations retain reservations until reconciled; do not assume an incomplete operation was free.
{
"spending_limits": {"user_credits": 500, "session_credits": 100},
"retail_pricing": {"unit_label": "tokens", "units_per_credit": 5},
"generation_defaults": {
"image_model": "catalog/image-model",
"video_model": "catalog/video-model",
"audio_model": "catalog/tts-model",
"audio_input": {"voice": "Cherry"}
}
}
user_credits limits this PrivateCloud account and end_user_id combination across all recorded widget sessions. session_credits limits the current session. Both are optional positive numbers in PrivateCloud credits. Customer token amounts are presentation-only conversions; your application remains responsible for collecting customer payments. Generation default models are applied to assistant guidance when the end user did not explicitly select a different model. Generated reply audio uses audio_model when supplied; additional model-required parameters, such as an owned reference-audio URL for cloning, belong in audio_input. Live V2V continues to use preset live voices and cannot use cloned voice models.
Each text planning request, generated-audio purchase and image/video submission is accounted for by an operation ID, with atomic budget reservations. Live voice reserves the cost of the effective finite call limit, or the first minute for unlimited calls without widget spending limits, and settles to verified usage on call completion. Remaining widget budgets can shorten the effective call limit; see Live call limits. When a transaction is unconfirmed, its reservation remains pending; budget limits fail closed rather than risk overspending.
To reconcile, your backend can request GET /voice-widget/api/sessions/{sessionId}/billing with API-Key and Client-ID headers. The result lists each operation's type, amount, state, and customer-facing retail value. Configured signed webhooks also deliver billing.charge events with deterministic event IDs. The authenticated POST /voice-widget/api/sessions/{sessionId}/billing/retry endpoint resends failed deliveries; always deduplicate by event_id. These are financial events, distinct from transcript or call-completion events.
Generated-audio models must support a text-to-speech schema and return a supported audio output. Models requiring additional reference inputs must be configured by the integrator. Replaying locally cached audio does not bill a second time.
Billing reference
Deployed rates checked October 19, 2026. Amounts below are credits charged to the integration's Client-ID account. Your own end-user subscriptions, balances and spending permissions remain your application's responsibility.
| Operation | Charge | When it applies |
|---|---|---|
| Text chat API request | 1 credit per request | Text conversation and separately billed typed requests. Tool-assisted turns can make more than one text API request; do not assume one visible message always equals one request. |
| Generated reply audio | 1 credit per synthesis request | Listen or automatic audio; additional to text. Replaying the existing audio is free. Changing voice, a new session, or regenerating missing audio can require a new billed synthesis. |
| Live voice | 15 credits per started minute | First minute at call start; subsequent minutes at their boundaries. 20 seconds costs 15 credits; 74 seconds costs 30 credits. A new call starts a new billing period. Call duration is configurable with call_limit_seconds; -1 means unlimited. External widget sessions default to five minutes when the setting is omitted. |
| Images and videos | Model- and input-dependent | The widget quotes the generation for user approval. Added to text/audio/live charges. Talking during a render continues live voice billing. |
Text with audio readout has no live-minute charge. At least 15 credits are required to start a live call or buy its next minute; insufficient balance prevents the next paid block. A session's 24-hour ticket lifetime is not a 24-hour call allowance. Use account usage records to reconcile final charges. Browser and call-end event charged_credits cover live voice only, not combined spending. Rates can change; this section is the dated integration reference, while the actual generation quote and account usage are authoritative for individual operations.
Complete PHP backend and history example
Download the complete PHP backend example. Save it as /api/my-voice-session.php on your own site. Requires PHP 8.1 or later, cURL, and PDO_SQLite. It implements the authenticated session route, CSRF validation, all three options, two character choices, per-user request throttling, account-scoped history retrieval and durable SQLite snapshots. API credentials never reach the browser.
Connect it to your existing login/session bootstrap. The example expects $_SESSION['user_id'] to be set by your trusted login handler. Adapt that one authentication lookup to your framework; do not accept an identity from a query parameter or POST body. Set these environment variables on your PHP process, not in frontend JavaScript:
WOWIFY_WIDGET_API_KEY=YOUR_ISSUED_API_KEY
WOWIFY_CLIENT_ID=YOUR_ISSUED_CLIENT_ID
WIDGET_ORIGIN=https://your-site.example
WIDGET_DB_PATH=/var/lib/your-app/widget-history.sqlite
Create the database directory outside your public web root, owned by your application service user with mode 0700. The example creates its tables automatically and uses private file permissions. Use your application's existing secure session cookie settings. Add your own entitlement and spending controls before enabling paid sessions. This sample allows both characters and all three options for any signed-in user; it does not implement your retail billing system.
Use one active widget per user and character with this small example. For concurrent tabs or several application servers, replace its single-session mapping and local SQLite storage with your shared application database and explicit conversation IDs. It retains a durable copy of the latest retrieved text/media snapshot, not every historical message or the media files themselves. Protect and expire that copy under your own retention policy.
Use this page markup. The JavaScript below must be saved in /js/companion.js so it works with the CSP example without allowing inline scripts:
<select id="character">
<option value="maya">Maya</option>
<option value="leo">Leo</option>
</select>
<button disabled data-option="text_media">Text + Media</button>
<button disabled data-option="voice_media">Voice + Media</button>
<button disabled data-option="voice_only">Voice Only</button>
<p id="chat-status" role="status"></p>
<script defer src="https://models.privatecloud.ai/public/js/voice-widget/widget.js"></script>
<script defer src="/js/companion.js"></script>
(async () => {
const endpoint = '/api/my-voice-session.php';
const status = document.getElementById('chat-status');
const buttons = [...document.querySelectorAll('[data-option]')];
const selector = document.getElementById('character');
let current = null, lastSync = 0, syncing = false;
try {
const boot = await fetch(endpoint, { credentials: 'same-origin' });
const config = await boot.json();
if (!boot.ok) throw new Error(config.error || 'Sign in first.');
async function sync(force = false) {
if (!current || syncing || (!force && Date.now() - lastSync < 15000)) return;
syncing = true; lastSync = Date.now();
try {
const response = await fetch(endpoint, {
method: 'POST', credentials: 'same-origin', keepalive: true,
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': config.csrf_token },
body: JSON.stringify({ ...current, action: 'sync' })
});
if (!response.ok) throw new Error('History sync failed. Reopen to retry.');
} catch (error) { status.textContent = error.message; }
finally { syncing = false; }
}
const widget = WowifyVoiceWidget.create({
sessionEndpoint: endpoint, csrfToken: config.csrf_token,
showBalance: false,
onEvent(event) {
if (event.type === 'transcript.updated') sync();
if (event.type === 'call.completed') sync(true);
if (event.type === 'widget.closed') {
sync(true);
buttons.forEach(button => { button.disabled = false; });
selector.disabled = false;
}
if (event.type === 'widget.error' || event.type === 'delivery.error')
status.textContent = event.message;
if (event.type === 'widget.error') {
widget.close();
buttons.forEach(button => { button.disabled = false; });
selector.disabled = false;
}
}
});
buttons.forEach(button => {
button.disabled = false;
button.addEventListener('click', () => {
current = { option: button.dataset.option, character: selector.value };
status.textContent = '';
selector.disabled = true;
buttons.forEach(item => { item.disabled = true; });
widget.open(current);
});
});
} catch (error) { status.textContent = error.message; }
})();
The browser sends only a request to synchronize history; the backend obtains the actual snapshot using its authenticated history endpoint and stored session ID. It does not trust transcript text or billing figures supplied by the browser. Synchronization is throttled to once per 15 seconds while messages arrive, and requested on close/call-end. Reopening also retrieves the last saved upstream snapshot. If upstream history has expired, the stored local copy is used. Abrupt browser loss can still omit the final update. For live sessions, add the signed webhook flow described below if you need server delivery independent of this browser callback; text sessions do not emit call.completed.
Copyable browser policies
Send these HTTP response headers on the parent website page. This is a minimal starting policy for the example; merge it with your existing asset hosts and application requirements rather than replacing a site's policy blindly.
Permissions-Policy: microphone=(self "https://models.privatecloud.ai"), autoplay=(self "https://models.privatecloud.ai"), fullscreen=(self "https://models.privatecloud.ai")
Content-Security-Policy: default-src 'self'; script-src 'self' https://models.privatecloud.ai; frame-src https://models.privatecloud.ai; connect-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; object-src 'none'; base-uri 'self'; form-action 'self'
The SDK sets inline styles on the dialog, so this example permits inline styles. It does not require unsafe-inline for scripts. The two script tags above load external files. The SDK sets iframe allow="microphone; autoplay; fullscreen"; keep that permission delegation if you implement your own frame wrapper. The parent connect-src controls the same-origin backend request; the hosted frame uses its own policy for its media and connections. If your page is nested inside another iframe, that ancestor must also delegate microphone access.
Use HTTPS, open from a user click, and allow microphone access when prompted for either live option. The text option does not need microphone permission. Test on the actual customer origin in mobile Safari and desktop browsers. A microphone denied by browser settings or a stricter ancestor policy cannot be repaired by the widget. Check the browser console for CSP violations and use Settings to restore site microphone permission.
Sending characters
Inline character fields:
| Field | Requirement |
|---|---|
| name | Required nonempty string, maximum 80 bytes |
| age | Required adult age 18-99, integer or two-digit string |
| gender | Required: female, male, or nonbinary |
| personality | Optional string, maximum 1,200 bytes |
| appearance | Optional string, maximum 1,200 bytes |
| interests | Optional string, maximum 1,200 bytes |
| voice | Defaults to eve; lowercase letters, numbers, underscores, or hyphens; 2-32 characters |
Name, personality, and appearance are normalized to ASCII. Voice syntax validation does not guarantee that a requested voice exists; use a provisioned supported voice. Character preferences do not override service rules, permissions, or purchase approvals. Appearance describes the character; it does not guarantee exact visual identity.
character.profile_photo_url and character.character_sheet_url are optional public HTTPS image URLs, up to 2,048 bytes each. The profile photo appears when the chat opens, before the first message, in all three options. The character sheet supplies a visual reference for image/video requests involving that character; it is an image URL, not a document parser. Both fields are supported by the character-definition endpoint and retained in the issued character_id. References do not guarantee exact likeness.
To reuse a character, POST {"character": {...}} to /voice-widget/api/characters with the same authentication headers. The HTTP 201 response is {"character_id":"vc1_..."}. Store the full token on your backend. For later session creation, send character_id instead of character. When both are sent, the resolved token definition replaces the inline character. To change the definition, issue a new token and update your stored mapping.
The token contains an encrypted definition bound to your account; the character endpoint does not create a server-side character database record. Keep your own human-readable character ID mapped to the issued token. The character_id in webhook events is that session's character_id; inline sessions without one use default.
Appearance customization
Pass these settings in branding when creating a session. Changes apply to the new session; there is no live appearance-update endpoint in this V1. Layout positions are fixed by the standard interface. Fully custom layouts are separately scoped work.
| Field | Supported value |
|---|---|
| name / creator | Brand name (80 bytes) and creator label (100 bytes) |
| language / direction | Language label up to 20 bytes; direction ltr or rtl |
| font_family | Family list up to 120 bytes; letters, numbers, spaces, commas, quotes, underscores, and hyphens |
| font_url | Optional HTTPS stylesheet URL |
| logo_url / avatar_url / background_image_url | Optional HTTPS image URLs |
| colors | background, panel, text, muted, primary, on_primary, user_bubble, bot_bubble, border; each a 3- or 6-digit hex color |
| labels | title, start, end, send, placeholder, credits, save, load, close, opening, privacy; strings up to 500 bytes |
| wording | Up to 100 exact-text replacements; source up to 500 bytes, replacement up to 1,000 bytes |
HTTPS asset URLs are limited to 2,048 bytes. Wording replacement applies to interface text, not chat transcript bubbles. Labels govern their supported UI locations; arbitrary wording overrides are exact matches, not substring search. The outer dialog reads close and opening from appearance, while additional inner-control wording can use wording overrides. In Full Chat, the privacy note and pricing explanation appear in Instructions.
branding.sizes contains integer pixel values:
| Key | Default | Allowed range |
|---|---|---|
| font_size | 16 | 12-24 |
| title_size | 18 | 14-32 |
| page_padding | 6 | 0-24 |
| panel_padding | 8 | 0-24 |
| control_gap | 4 | 0-16 |
| bubble_radius | 16 | 0-32 |
Page and panel padding apply to Full Chat. Other size controls are available to all three options. Preserve readable contrast when selecting colors.
To hide available credits throughout an integration, set showBalance: false in WowifyVoiceWidget.create() and show_balance: false in the server-side session payload. Both default to true. The SDK option hides the outer dialog balance and requests frame hiding; the server setting hides the frame balance before JavaScript runs and prevents balance notifications to the parent. These options change balance presentation only; credit checks, charges, and live call cost displays remain active.
Browser events
For text with audio readout, do not rely on call.completed: no live call is started. Use transcript.updated and the authenticated history endpoint to retrieve saved text and media snapshots. Closing the widget requests a final transcript update, but an abrupt page or network loss can prevent it. The charged_credits and elapsed_seconds event fields describe a verified live voice call only, not total text, reply-audio or image/video spending. The mode response/event field alone does not distinguish the two full_chat options; retain your selected option on your backend.
Supply onEvent to WowifyVoiceWidget.create(). Messages from the hosted frame include source: wowify-voice-widget; the SDK validates the message origin and iframe before invoking your callback. Locally generated widget.error has type and message.
| Type | Data and use |
|---|---|
| widget.ready | mode and session_id; frame initialized |
| transcript.updated | Conversation snapshot and event fields below, plus history_saved, webhook_status, webhook_delivered and webhook_configured |
| call.completed | Call-end event and event fields below, plus delivery flags |
| delivery.error | message; frame could not submit or parse its event request |
| widget.error | message; opening or session setup failed |
| widget.closed | Close acknowledgement |
The call-end event response confirms history_saved before webhook delivery runs. webhook_status is initially pending for a configured new attempt, not_configured when omitted, and not_sent for transcript updates. webhook_delivered is not final while pending; retrieve the history endpoint for the stored delivery outcome. Browser events are optional UI notifications, not the server-to-server integration or trusted financial records.
Webhook configuration and payload
Provide webhook.url as a publicly reachable HTTPS endpoint on port 443, without embedded credentials, and webhook.secret as a 24-256 character secret. Private/local IP destinations are rejected. Redirects are not followed. Omit webhook to disable server delivery.
The service sends one server-to-server call.completed webhook after the call-end event is received and saved. Transcript updates are saved for recovery but are not sent to your webhook. Example payload, with illustrative values:
{
"event_id": "<sha256 event identifier>",
"type": "call.completed",
"session_id": "<32-character session ID>",
"character_id": "vc1_...",
"end_user_id": "user-123",
"call_id": "<32-character call ID>",
"status": "completed",
"elapsed_seconds": 74.2,
"charged_credits": 30,
"messages": [
{"role": "user", "content": "Hello"},
{"role": "assistant", "content": "Hi!"}
],
"media": [
{"type": "image", "url": "https://assets.example/image.jpg"}
]
}
| Field | Meaning |
|---|---|
| event_id | SHA-256 identifier for deduplicating the same event content; not a timestamp or ordering sequence |
| type | transcript.updated or call.completed |
| session_id | Temporary widget session identifier |
| character_id | Session character token, or default for an inline definition without a token |
| end_user_id | Your supplied user identifier |
| call_id | Verified call ID associated with this widget session and account, or null if unmatched |
| status | completed if a matched usage record has an end time; otherwise ended for call.completed, or active for transcript.updated |
| elapsed_seconds | Matched usage record elapsed value, or 0 |
| charged_credits | Matched voice call usage cost, or 0; excludes separate image/video charges |
| messages | Snapshot of up to 200 recent user/assistant messages; each content clipped to 12,000 characters by the widget |
| media | Up to 100 image/video entries with HTTP(S) URLs |
Transcript updates are debounced and skip unchanged snapshots in the frame. Events contain snapshots, not append-only message deltas. Do not append the full message list blindly on every delivery. There is no sequence number, so do not assume arrival order. A call.completed event can have status ended and zero billing values if its usage record is not yet matched or finalized. Use account usage records for final billing reconciliation.
Messages and media originate in the browser; the server validates their shape but does not certify their factual content. An abrupt browser loss can prevent the final call-end snapshot from arriving; retrieval then returns the last successfully saved snapshot, not a guaranteed complete final transcript. Signature verification authenticates delivery by the service, not the truth of client-submitted transcript text.
Delivery recovery: The original webhook attempt runs after the call-end response. If your receiver was unavailable, check GET /voice-widget/api/sessions/{sessionId}/history for webhook_delivery.status. When it says failed, your authenticated backend may send POST /voice-widget/api/sessions/{sessionId}/webhook/retry with the same API-Key and Client-ID headers used for session creation. HTTP 202 means a recovery attempt was accepted; HTTP 409 means there is no retryable failed event. A pending delivery older than two minutes may also be recovered. Recheck history for delivered or failed status. Sessions expire, so preserve events in your own database. Webhook requests include X-Widget-Event-ID; consumers must deduplicate on event_id because retries can legitimately redeliver. This mechanism applies to call.completed only, not per-image/text/audio billing or total session spending.
Verify webhook signatures
Headers:
- Content-Type: application/json
- X-Widget-Timestamp: Unix seconds
- X-Widget-Signature: sha256=<hex digest>
Compute HMAC-SHA256 with your webhook secret over the exact timestamp header, a period, and the unmodified raw HTTP body. Verify before parsing JSON. Example Node.js verifier:
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verifyWidgetWebhook(rawBody, timestamp, signature, secret) {
if (!Buffer.isBuffer(rawBody) || typeof secret !== 'string') return false;
if (typeof timestamp !== 'string' || !/^[0-9]+$/.test(timestamp)) return false;
if (typeof signature !== 'string' || !/^sha256=[a-f0-9]{64}$/.test(signature)) return false;
// Receiver policy: reject requests more than five minutes from our clock.
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const expected = createHmac('sha256', secret)
.update(timestamp + '.')
.update(rawBody)
.digest();
const received = Buffer.from(signature.slice(7), 'hex');
return received.length === expected.length && timingSafeEqual(received, expected);
}
Configure your framework to preserve raw bytes for this route; reserializing parsed JSON changes the signed input. After verification, parse JSON, validate the expected event type and account/user mapping, and store events idempotently by event_id. Return a 2xx response promptly after durable acceptance. Reject invalid signatures. The five-minute window is an example receiver policy, not an additional field sent by the service.
V1 delivery and retention behavior
History is saved before one webhook attempt runs after the HTTP response. Delivery uses a two-second connection timeout and five-second total timeout; any HTTP 2xx is success. There is no delivery queue or automatic retry, and delivery does not extend the voice call or billing. If webhook.url is omitted, delivery is skipped. Use the authenticated history lookup if delivery fails or the webhook is missed. A worker crash can leave delivery marked pending; the saved snapshot remains retrievable.
Retrieve saved history with GET https://models.privatecloud.ai/voice-widget/api/sessions/{session_id}/history using the same API-Key and Client-ID headers and Accept: application/json. The creating account alone can retrieve it; enforce your own end-user authorization in your backend. Response fields are session_id, expires_at, history_expires_at, event (latest saved snapshot), last_call (latest saved call.completed event), and webhook_delivery (event_id, status, attempted_at). event is null before the first snapshot. Delivery status can be pending, delivered, failed, or not_configured. The endpoint permits 60 requests per minute. History expires 24 hours after the server receives the latest call-end event, independently of the 24-hour access ticket. The current Unix deadline is returned as history_expires_at. Duplicate end events do not extend it. If no end event arrives, retention is measured from the latest saved transcript update; before any update, the initial deadline is session creation plus 24 hours. Previously issued tickets retain their original expiry; reopen the widget to obtain a new 24-hour ticket. Expired retained history returns 410 while its files still exist; missing or other-account sessions return 404. Cleanup removes expired files when new sessions are created. Save your own long-term copy. Restore text with history on a later session; media must be handled separately.
Appearance and character changes require a new session. No customer PHP, Blade, or arbitrary JavaScript is executed by the configuration API.
Errors and integration checklist
Common responses include 401 for invalid API credentials or an expired frame ticket, 403 for an unauthorized or API-disabled account, 413 for an oversized session request, 422 for invalid configuration, and 429 for throttling. Response bodies can use error or message; send Accept: application/json and handle both. Your own session route may also return framework-specific authentication or CSRF errors.
Before client launch, verify:
- Session credentials remain server-side and the browser cannot choose a billing account.
- All three configurations open on desktop and mobile. Text readout works without microphone access, both live options obtain microphone permission, and Voice Only blocks media generation.
- Your chosen character, wording, colors, and sizes render correctly.
- Signed webhook events are verified using raw bytes and stored without duplicate processing.
- Closing and reopening restores saved text history; expired sessions are recreated.
- Webhook outages, page closure, render errors, and unfinalized billing values are handled explicitly.
This guide covers all three SexyChat V2 widget options. Image and video generation are available within the two full_chat configurations; voice_only excludes them.