# Perxona Connect Kit β€” full handbook (English) Source: https://connect.perxona.ai (single-page handbook, split per section). Generated from the public page; regenerate with tools/handbook-to-markdown/handbook2md.py. ## What Can You Build? Connect Kit gets a talking 3D avatar on screen in under 15 minutes β€” and gives you a full platform to extend it as far as you need. Here is what is available today and what is on the roadmap. 1 β€” Out-of-the-Box Everything you need for a lifelike avatar experience β€” ready to deploy the moment you pick your configuration. πŸ§‘β€πŸŽ¨ #### Avatar Catalog Upload your own VRM avatar and pick it from the catalog β€” it's on-screen in minutes. Built-in avatars will follow on a date announced separately. πŸŽ™οΈ #### Voice β€” Azure & Google TTS Rich, human-sounding voices from Azure and Google TTS. Speech automatically drives the avatar's lip-sync β€” no extra setup required. πŸ€– #### Chatbot Upload a knowledge file, wire simple tool calls, and pair with the 3D Avatar for a fully voiced AI agent β€” no extra backend required. 🌐 #### Built to Run Everywhere Focus on building your product β€” we handle the rest. All features run reliably on Chrome, Safari, and Edge across desktop and mobile with no platform workarounds needed. 2 β€” Integration with Your Own 🧠 #### Bring Your Own LLM Use any LLM. Embed motion cues inline via Markup Motion Language so the avatar's body language matches the conversation. πŸ”Š #### Bring Your Own Voice Pass your own audio (an `ArrayBuffer` holding a complete WAV or MP3 file, from any TTS service or a pre-recorded clip) via `presenter.presentWithAudio()`. The avatar lip-syncs to your audio and the Motion Director still drives gestures and expressions from the text β€” no Perxona TTS required. πŸͺ† #### Bring Your Own Avatar (VRM 1.0) Upload a VRM 1.0 character to match your brand or audience and make it speak. ⚑ #### Compose Your Own Performance `presenter.presentDirect()` plays your audio with motions you supply: from the Connect API's `/motion-suggestion` or `/presentation`, or generated yourself. Split and queue the lines however suits your app. See [Example: Gemini Live](https://connect.perxona.ai/#gemini-live-example). 3 β€” Presentation Engine Real-time avatar performances that stream instantly β€” no large file downloads, no video buffering, no game-engine install. The avatar responds the moment you call `present()`. 🎬 #### In-house Motion Director The engine reads the text and selects matching body motion and facial expressions automatically β€” the avatar's face and body react to what it's saying. ✏️ #### Be your own Motion Director Override motion timing at the sentence level using Markup Motion Language β€” full creative control in plain text. ```js // Presentation Engine β€” available now const presenter = document.querySelector("sv-presenter"); button.addEventListener("click", async () => { await presenter.resumeAudioPlayback(); await presenter.initializeWithConnectKey(connectKey, { avatarId, sceneId, voiceId }); presenter.present("Hello world! I'm Perxona agent and I can talk to you."); }); ``` [β†’ Presenter Component](https://connect.perxona.ai/#sdk-reference) Developer Handbook # Perxona Connect Kit Build a browser-native avatar experience. The public integration surface for the **Perxona Connect API** and the `` avatar Web Component. This handbook explains those contracts first; the Express sample appears later as one implementation path. ## What is Perxona Connect Kit? Connect Kit is the public integration surface for placing a real-time 3D avatar in a web product. It separates the browser rendering contract from the server-facing Connect API, so you can use either with your own application architecture. It has two complementary parts: - **``** β€” a browser Web Component that renders the avatar, initializes a selected avatar/scene/voice target, and runs speech, motion, and lip-sync playback. - **Connect API** β€” authenticated HTTP endpoints for catalog assets, voices, presentations, and chatbots. Authenticate with a **Connect API key**, sent as an `X-Connect-Key` header. Keys come in two types: a **secret** key stays on your server, and a **publishable** key is the one you hand to the browser β€” it can read your catalog, generate presentations, and mint speech tokens, and nothing beyond that. ## Integration Architecture A Connect integration has three responsibilities. Your backend owns credentials and access policy, the Connect API owns the avatar resources and presentation services, and `` owns browser-side rendering and playback. ``` Your backend Browser - stores Connect credentials - renders your product UI - attaches its secret key - receives the publishable key | | v v Connect API <---------------- assets Β· voices Β· presentation initializes Β· speaks Β· animates chatbots handles lip-sync and playback ``` ### Responsibility Boundary - **Your backend** holds the **secret** Connect API key, applies your own user authorization, and serves the browser the **publishable** key β€” never the secret one. - **Connect API** exposes the catalog of avatars, scenes, voices, and motions, plus presentation and chatbot operations. - **``** receives the publishable key and selected asset IDs, then communicates with Connect directly for the runtime services it needs. ### Runtime Flow 1. Your backend sends its **secret** key as an `X-Connect-Key` header on every Connect request. There is no login step and no token to refresh. 2. Your application lists or selects an active avatar, scene, and optional voice from the Connect API. 3. In a direct user gesture, call `presenter.resumeAudioPlayback()` to satisfy the browser autoplay policy. 4. Call `presenter.initializeWithConnectKey(connectKey, { avatarId, sceneId, voiceId })`. 5. When the component reports `Ready`, call `presenter.present(content)`, `presenter.presentWithAudio(audio, content)`, or `presenter.presentDirect(payload)`, which plays your own audio with motions you supply (see [Example: Gemini Live](https://connect.perxona.ai/#gemini-live-example)). ⚠️ **Only the publishable key may reach a browser.** Anyone who opens devtools on your page can read whatever you hand the presenter, so hand it the key that is meant to be read. A **publishable** key can read your assets and voices, generate presentations, and mint speech tokens β€” note that the last two *bill your organization*, so an unrestricted publishable key that someone copies off your page keeps spending your credits through any other page's script. Restrict its domains before you ship β€” that stops another page's script, since only a real browser sends a genuine `Origin` header. It does not stop someone who copies the raw key into their own script: `Origin` is just a header, and nothing outside a browser is bound to send a truthful one. If a key leaks, revoking it from the console is the actual stop. A **secret** key adds everything a server needs: writing assets, talking to your chatbots, and creating, editing and deleting them. Keep it on your server and never serve it on any route. ⚠️ **Putting the wrong one in the wrong variable is silent.** Both types share the `pxc_` prefix and the upstream accepts either, so a secret key in `PERXONA_CONNECT_PUBLISHABLE_KEY` does not fail β€” everything works, and every visitor is handed a key that can manage your chatbots. The console is the only place that tells you which type a key is. 🌐 **Leave the secret key's allowed domains empty.** A domain restriction is matched against the browser's `Origin` header, and a server-to-server request never sends one β€” so a secret key with domains configured is refused on every call β€” and the error says only that the origin is not allowed, never what it saw, because nothing was sent. Domain restrictions belong on the publishable key, which really is used by a browser. ## Presenter Component Reference `` is the browser runtime for a Connect avatar. Load the approved Presenter module, add the element to the DOM, then interact with its JavaScript API. The component starts in one of two modes: Catalog mode loads the avatar and scene you pick from the Perxona catalog by ID, and Direct mode loads avatar, scene and motion files you supply yourself β€” see [Two Ways to Initialize](https://connect.perxona.ai/#presenter-modes). ### Load the Component Read `PRESENTER_URL` from trusted application configuration supplied by your server or Perxona, then inject it once as a module script. The URL is not a credential, but the module runs with your page's full rights, so check that its host is Perxona's CDN before injecting it. index.html ```html ``` app.js ```js // Read this from trusted application configuration; it is not a secret. const presenterUrl = getPresenterUrlFromAppConfig(); // The module runs with this page's full rights: load it only from a host listed // here, over https. A build you serve on localhost may use http. Own CDN? Add it. const LOCAL_HOSTS = new Set(['localhost', '127.0.0.1']); const ALLOWED_PRESENTER_HOSTS = new Set(['cdn.perxona.ai', ...LOCAL_HOSTS]); const { hostname, protocol } = new URL(presenterUrl); const local = LOCAL_HOSTS.has(hostname) && protocol === 'http:'; if (!ALLOWED_PRESENTER_HOSTS.has(hostname) || (protocol !== 'https:' && !local)) { throw new Error(`Refusing the presenter engine from ${protocol}//${hostname}: see ALLOWED_PRESENTER_HOSTS`); } // Load the Presenter module once before reading the custom element. await new Promise((resolve, reject) => { const script = document.createElement('script'); script.type = 'module'; script.src = presenterUrl; script.onload = resolve; script.onerror = () => reject(new Error('Presenter engine failed to load')); document.head.append(script); }); const presenter = document.querySelector('sv-presenter'); ``` ### Legacy Presenter Integrations built before Connect Kit 1.0 load the Presenter from `prod/latest/`. This legacy Presenter keeps receiving updates until it is retired. Retirement is planned for the end of 2026, once built-in avatars are available in the current Presenter; the exact date will be announced separately. New integrations use `prod/connect/latest/`. - `https://cdn.perxona.ai/asia/prod/latest/widget/entry/presenter.js` The legacy Presenter already sends `X-Legacy-Presenter: 1` on its own requests. If your server calls the Connect API itself β€” the catalog, `/presentation` or `/motion-suggestion` β€” send the same header, so the response uses assets the legacy Presenter can load. ### Two Ways to Initialize Pick the mode by where your assets live. An element runs in one mode for its whole life: once it has initialized, calling the other mode's initializer fails, so create a new `` to switch. | | Catalog mode | Direct mode | | --- | --- | --- | | Assets | Avatar, scene and motions hosted by Perxona, chosen by ID | Your own files: a VRM avatar, an image scene, VRMA motions | | Initialize | `initializeWithConnectKey` | `initializeDirectWithBlobs` | | Present | `present` / `presentWithAudio` / `playMotion`. `presentDirect` also works here, with motions you supply (see [Example: Gemini Live](https://connect.perxona.ai/#gemini-live-example)). | `presentDirect`, together with the Connect API's [`/motion-suggestion`](https://connect.perxona.ai/#api-reference). `presentDirect` also works on a Catalog element. | | Speech | Perxona TTS, or your own audio | Your own audio | ### Catalog Mode Flow ```js // Your backend serves the publishable key. It never serves the secret one. const getConnectKeyFromYourBackend = async () => { const response = await fetch('/your-backend/connect-key'); return response.json(); }; // Listen for state changes before launching the component. presenter.addEventListener('PRESENTER_STATUS', (e) => { // e.detail.status: 'Uninitialized' | 'Initializing' | 'Ready' | 'Failed' console.log('Presenter status:', e.detail.status); }); launchButton.addEventListener('click', async () => { // Must run inside a direct user gesture to unlock autoplay. await presenter.resumeAudioPlayback(); const { connectKey } = await getConnectKeyFromYourBackend(); await presenter.initializeWithConnectKey(connectKey, { avatarId: selectedAvatarId, sceneId: selectedSceneId, voiceId: selectedVoiceId, // optional }); // present() never rejects; inspect the returned result instead. const result = await presenter.present('Hello from Perxona!'); if (!result.success) console.warn(result.code, result.message); }); // A refused key has no refresh to fall back on: it is revoked, expired, // restricted to other domains, or was never granted the scope, and // presenting it again fails the same way. presenter.addEventListener('CONNECT_KEY_REJECTED', () => { console.error('Connect key rejected β€” reissue it in the console, then launch again.'); }); // Stop current playback and clear the queue when your UI needs it. presenter.interruptPresentation(); ``` ### Direct Mode Flow Direct mode boots from files you already hold and never looks anything up for you, so each line is presented with `presentDirect`: your own audio, plus the motion marks and motion assets that the Connect API's [`/motion-suggestion`](https://connect.perxona.ai/#api-reference) returns for that line. ```js // The avatar's body; /motion-suggestion needs the same values to pick motions for it. const GENDER = 'female'; // 'male' | 'female' const HEADS_TALL = 6; // 3 | 6 | 8 heads tall launchButton.addEventListener('click', async () => { // Must run inside a direct user gesture to unlock autoplay. await presenter.resumeAudioPlayback(); // Subscribe before initializing; loading has no deadline, so show progress. presenter.addEventListener('ASSET_LOADING_PROGRESS', (e) => { showProgress(e.detail.assetType, e.detail.progress); // 0 to 1 per asset type }); // Files picked by the user or fetched by your app, e.g. from . const result = await presenter.initializeDirectWithBlobs({ avatar: vrmFile, // VRM 1.0 gender: GENDER, headsTall: HEADS_TALL, scene: backgroundImage, // optional; omit it for a transparent background // VRMA clips per state; an empty idle or talking state uses built-in motions. motions: { idle: [idleVrma], listening: [listeningVrma], }, }); if (!result.success) console.warn(result.code, result.message); }); // Map a /motion-suggestion response onto the payload presentDirect() takes. const ASSET_TYPE_TO_DIRECT_MOTION_TYPE = { motion: 'body', facial_motion: 'face' }; const toDirectPresentation = (text, suggestion, audio) => ({ audio, // a complete WAV or MP3 file, not raw PCM displayText: text, // reported by PLAYING_SPEECH_TEXT presentationScript: suggestion.markup, // its [MOTION] marks time each motion motions: Object.entries(suggestion.performance_manifest) // Skip entries without a URL and entries that are not motions. .filter(([, entry]) => entry.lod0 && ASSET_TYPE_TO_DIRECT_MOTION_TYPE[entry.type]) .map(([id, entry]) => ({ id, type: ASSET_TYPE_TO_DIRECT_MOTION_TYPE[entry.type], assetUrl: entry.lod0, // configs is grouped by asset type; a motion's own config is configs.motion. runtimeConfig: entry.configs?.motion ?? null, })), }); const speak = async (text) => { // Your own calls: the Connect API's /motion-suggestion, and your TTS. // From the browser, call /motion-suggestion with the publishable key only; // the secret key stays on your server. // Neither depends on the other, so run them in parallel. const [suggestion, audio] = await Promise.all([ getMotionSuggestion({ text, gender: GENDER, heads_tall: HEADS_TALL }), synthesizeWithYourTts(text), ]); // Resolves once queued, not once played, and never rejects. const payload = toDirectPresentation(text, suggestion, audio); const result = await presenter.presentDirect(payload); if (!result.success) console.warn(result.code, result.message); }; ``` ### Example: Gemini Live `presentDirect` works in both Catalog and Direct mode and does not depend on the Connect API for its motions: you hand it a line's audio, its text with motion marks, and the motion assets. Take them from `/motion-suggestion`, from [`POST /presentation`](https://connect.perxona.ai/#api-reference) without `voice_id` (BYO TTS mode, for a Catalog avatar), or generate them yourself, and decide how to split the speech into lines and when to queue each one. Calls play in the order you make them. This example drives a Catalog avatar from the [Gemini Live API](https://ai.google.dev/gemini-api/docs/live). Its native-audio models stream raw 16-bit PCM at 24 kHz and, with `outputAudioTranscription` enabled, the text of what they say. The example cuts a line at the first pause after each sentence end in that text, requests its motions at once, and queues it. - `presentDirect` takes a complete WAV or MP3 file, not raw PCM, so each line's PCM gets a WAV header first. - The transcription runs a few tenths of a second ahead of its audio, so a line is cut at the first pause (150 ms of silence) after its sentence ends, not the moment the sentence end arrives. - Your Gemini API key must not reach the browser: connect with an [ephemeral token](https://ai.google.dev/gemini-api/docs/ephemeral-tokens) or through your server. - For a Direct avatar, request the motions from `/motion-suggestion` as in the Direct Mode Flow above. ```js // Catalog avatar: motions from POST /presentation without voice_id (BYO TTS mode). // Call it from the browser with the publishable key, as with /motion-suggestion, or // from your server with the secret key. Each call is one billed motion request. // toDirectPresentation is the mapper in the Direct Mode Flow above; getPresentation // (your POST /presentation call), base64ToArrayBuffer and pcm16ToWav are your own. // Give getPresentation a timeout (for example AbortSignal.timeout on its fetch): // lines play in order, so a slow reply holds up every line after it. const SENTENCE_END = /[.!?γ€‚οΌοΌŸ]\s*$/; // the simplest test; an abbreviation only adds a cut const QUIET_RMS = 400; // 16-bit PCM quieter than this counts as silence const PAUSE_SAMPLES = 24000 * 0.15; // 150 ms of silence at 24 kHz is a pause // The transcription puts spaces between Chinese or Japanese words; drop them. const CJK_SPACE = /(?<=[\u3000-\u30ff\u3400-\u9fff\uff00-\uffef])\s+(?=[\u3000-\u30ff\u3400-\u9fff\uff00-\uffef])/g; let lineText = ''; let textAfterSentenceEnd = ''; // arrives after a sentence end but before its pause let linePcm = []; let sentenceEnded = false; let spoke = false; // the line's PCM has sound in it, not only the previous pause let quietSamples = 0; // length of the silence at the end of the PCM so far let interruptionCount = 0; // lines queued before the latest interruption are dropped let enqueueChain = Promise.resolve(); // settles once each line is queued, not played const isQuiet = (samples) => Math.sqrt(samples.reduce((sum, x) => sum + x * x, 0) / (samples.length || 1)) < QUIET_RMS; // Start collecting the next line from the given text. const startLine = (text) => { [lineText, textAfterSentenceEnd, linePcm, spoke] = [text, '', [], false]; sentenceEnded = SENTENCE_END.test(lineText); // carried-over text may end a sentence }; // Queue the line collected so far. Its motion request starts now; presentDirect // runs after the previous line's call, so lines play in order. const queueLine = () => { const text = lineText.replace(CJK_SPACE, '').trim(); const pcm = linePcm; const interruptionCountAtQueue = interruptionCount; startLine(textAfterSentenceEnd); if (!text) return; const audio = pcm16ToWav(pcm, 24000); // join the PCM and add a WAV header const suggestion = getPresentation({ avatar_id: selectedAvatarId, message: text }).then( (response) => ({ markup: response.presentation, performance_manifest: response.performance_manifest }), () => ({ markup: text, performance_manifest: {} }) // no motions, but the line still plays ); enqueueChain = enqueueChain .then(async () => { const motions = await suggestion; if (interruptionCountAtQueue !== interruptionCount) return; // interrupted while it waited const result = await presenter.presentDirect(toDirectPresentation(text, motions, audio)); if (!result.success) console.warn(result.code, result.message); }) .catch((error) => console.warn(error)); // a failed line must not stop the ones after it }; // Messages of a Gemini Live session opened with responseModalities: [Modality.AUDIO] // and outputAudioTranscription: {}. The transcription runs a little ahead of its // audio, so a line is cut at the first pause after its sentence ends. const onGeminiMessage = ({ serverContent: content }) => { if (!content) return; if (content.interrupted) { interruptionCount += 1; startLine(''); presenter.interruptPresentation(); return; } const piece = content.outputTranscription?.text ?? ''; if (sentenceEnded) textAfterSentenceEnd += piece; else { lineText += piece; sentenceEnded = SENTENCE_END.test(lineText); } for (const part of content.modelTurn?.parts ?? []) { if (!part.inlineData?.data) continue; const pcm = base64ToArrayBuffer(part.inlineData.data); const quiet = isQuiet(new Int16Array(pcm)); quietSamples = quiet ? quietSamples + pcm.byteLength / 2 : 0; spoke ||= !quiet; linePcm.push(pcm); if (sentenceEnded && spoke && quietSamples >= PAUSE_SAMPLES) queueLine(); } if (content.generationComplete) { lineText += textAfterSentenceEnd; // no pause came after the last sentence end textAfterSentenceEnd = ''; queueLine(); } }; ``` ### API Members #### Catalog Mode | Member | Description | | --- | --- | | `initializeWithConnectKey(connectKey, target)` | Boot the presenter. Resolves `target` (avatarId/sceneId/voiceId) against the Connect API and mints a speech token. Returns a Promise β€” awaiting it means the presenter is ready. Rejects if the element was already initialized with `initializeDirectWithBlobs`; create a new element instead. Add `personalityTrait` to `target` to choose the personality the avatar plays; see [Personality trait](https://connect.perxona.ai/#personality-trait). | | `present(content, options?)` | Synthesize `content` into speech and play it on the avatar. `options.emotion` and `options.intensity` set the line's tone, which picks its facial expression. Returns `PresentationResult { success: boolean, code: string, message?: string }`. **Never rejects** β€” always check `result.success`. | | `presentWithAudio(audio, content, options?)` | Play caller-supplied audio on the avatar, bypassing Perxona TTS. Pass an `ArrayBuffer` from any TTS service or pre-recorded clip. The Motion Director still runs β€” gestures and expressions are driven by `content`. `options.emotion` and `options.intensity` set the line's tone, which picks its facial expression, as in `present`. Returns `PresentationResult`. **Never rejects.** | | `playMotion(motionId)` | Play one body motion by ID, outside the speech queue. Resolves once the motion is sent to the avatar, not when it finishes; concurrent calls do not keep their order, so await each one when order matters. Returns `PresentationResult`. **Never rejects.** | #### Direct Mode | Member | Description | | --- | --- | | `initializeDirectWithBlobs(config)` | Boot the presenter from files you supply as `Blob`s. `config`: - `avatar`: a VRM 1.0 file. - `gender`: `'male'` | `'female'`. - `headsTall`: `3` | `6` | `8` (heads tall). - `scene` (optional): an image drawn behind the avatar; leave it out for a transparent background. - `motions`: VRMA clips keyed by state β€” `idle`, `talking`, `listening` (played by `setListening(true)`), `loading` (played by `setThinking(true)`). An empty `idle` or `talking` is filled with built-in motions matched to `gender` and `headsTall`; an empty `listening` or `loading` plays nothing. The type also accepts `error`, which is reserved: the presenter does not play it yet. Resolves with `PresentationResult` once the assets are loaded. There is no loading deadline, so show progress from `ASSET_LOADING_PROGRESS`. `INITIALIZATION_CONFLICT` means the element was already initialized, in either mode; create a new element to retry. A file that fails to load is not reported as a failure: the presenter may reach ready without it, or this call may stay pending. Rejects only when this presenter version cannot load from `Blob`s. | | `presentDirect(payload)` | Play your own audio with motions you have already resolved, usually from the Connect API's `/motion-suggestion`. `payload`: - `audio`: an `ArrayBuffer` holding a complete WAV or MP3 file, not raw PCM. - `displayText`: the text to show; reported by `PLAYING_SPEECH_TEXT`. - `presentationScript`: the text with `[MOTION id:priority]` marks that time each motion. - `motions`: `{ id, type: 'body' | 'face', assetUrl, runtimeConfig }[]`, the assets the marks refer to. Calls share one queue and play in call order. Resolves with `PresentationResult` once queued, not once played. **Never rejects.** | #### Both Modes | Member | Description | | --- | --- | | `resumeAudioPlayback()` | Unlock browser autoplay policy. **Must be called from a direct user gesture.** Returns a Promise. Call this in your click handler before initializing; until it has run once, `present`, `presentWithAudio` and `presentDirect` fail with `AUDIO_CONTEXT_UNAVAILABLE`. | | `interruptPresentation()` | Stop the current performance and clear the queue immediately. | | `setListening(isListening)` | Pass `true` to have the avatar act as if listening β€” for example, while the user speaks β€” and `false` to stop. | | `setThinking(isThinking)` | Pass `true` to have the avatar act as if thinking β€” for example, while your app waits for a reply β€” and `false` to stop. | | `muteAudio(muted)` | Mute or unmute the speech audio. | | `updateCameraAngle(angle)` | Frame the avatar `'fullbody'` or `'halfbody'`. | | `updateCameraFOV(offsets)` | Fine-tune the framing from `updateCameraAngle` by moving the camera. Each value is a step from βˆ’10 to +10; 0 keeps the framing as it is. - `distance`: positive pulls the camera back, negative moves it closer. - `horizontal`: positive moves the camera right, negative left. - `vertical`: positive raises the camera, negative lowers it. Example: `presenter.updateCameraFOV({ distance: -3, horizontal: 0, vertical: 2 })`. Calling `updateCameraAngle` resets all three to 0. | | `setCameraOrbit(orbit | null)` | Place the camera freely around the avatar, overriding `updateCameraAngle` and `updateCameraFOV`. Pass `null` to return to the default framing; a later `updateCameraAngle` or `updateCameraFOV` call does the same. `orbit`: - `target` (required): what the camera circles β€” a bone such as `{ bone: 'head' }`, which the camera keeps following as the avatar moves, or a fixed point `{ point: [x, y, z] }` in metres, with the avatar at the origin facing +Z. - `distance`, `yaw`, `pitch`: how far from the target, in metres, and the angle around and above it, in degrees. - `lookAt`: what the camera faces, given like `target`; defaults to `target`. - `screenOffset`, `fov`, `roll`: optional fine-tuning of the shot. Bone names are VRM humanoid bone names, such as `hips`, `head` or `leftHand`. Example: `presenter.setCameraOrbit({ target: { bone: 'head' }, distance: 0.8, yaw: 30 })`. | | `getCameraOrbit()` | The current orbit, or `null` when the camera is on the default framing. Read it to adjust the shot from where it is, such as turning `yaw` a little further. | | `getBoneTransform(bone)` | A bone's current position, `{ position: [x, y, z] }`, in the same coordinates as `setCameraOrbit` β€” for example, to aim the camera at the midpoint between both hands. Returns `null` if the avatar is not loaded yet or has no such bone. To keep the camera on a bone, pass the bone to `setCameraOrbit` instead of reading its position every frame. | | `setExpressionWeight(name, weight)` | Sets how strongly an expression shows, from 0 (off) to 1 (full). Use a VRM preset name such as `happy`, `sad`, `aa` or `blink`, or any other expression the avatar has. Once any expression is above 0, you control the whole face and its animation no longer moves it. Set everything back to 0 and the animation takes over again. Blinking is the exception: the avatar keeps blinking as usual until you set a blink yourself. Lip sync still plays on top while the avatar speaks. The eyes work the same way: setting `lookUp`, `lookDown`, `lookLeft` or `lookRight` sets where the avatar looks, but the avatar mostly looks at the camera, so your gaze shows only some of the time. Changing the avatar clears every weight. Example: `presenter.setExpressionWeight('happy', 0.8)` | | `getExpressionWeight(name)` | Returns the weight you last set for this expression, or 0 if you haven't set it. This is your setting, not necessarily what the face shows right now (while the avatar speaks, for example). Returns `null` if the presenter isn't ready yet or the avatar doesn't have this expression. | | `resetExpressionWeights()` | Sets every expression back to 0 and returns the face to its animation. | #### Events | Member | Description | | --- | --- | | event `PRESENTER_STATUS` | Fired as state changes. `e.detail.status`: `"Uninitialized"` β†’ `"Initializing"` β†’ `"Ready"`, or `"Failed"` when the stage cannot come up, with the reason in `e.detail.message`. Call `initializeWithConnectKey` again to retry. | | event `ASSET_LOADING_PROGRESS` | Fired while assets load. `e.detail.assetType`: `"Avatar"` | `"Motion"` | `"Scene"`; `e.detail.progress`: how far that asset type has loaded, from 0 to 1. Subscribe before calling `initialize*`. | | event `AUDIO_PLAYBACK_STATE` | Fired when the audio context changes state. `e.detail.state`: `"suspended"` | `"running"` | `"closed"`. | | event `PERFORMANCE_STATE` | Fired when the avatar's visible state changes. `e.detail.state`: `"Idle"` | `"Listening"` | `"Thinking"` | `"Talking"`. | | event `PERFORMANCE_START` / `PERFORMANCE_END` | Fired as each queued line starts and stops playing. | | event `ALL_PERFORMANCE_FINISHED` | Fired once the whole queue has drained, not once per line. | | event `PLAYING_SPEECH_TEXT` | Fired when a line starts playing. `e.detail.text`: the text being spoken, for subtitles or a chat bubble β€” in Direct mode, the `displayText` you passed. | | event `CONNECT_KEY_REJECTED` | **Catalog mode only.** Fired when the Connect API refuses the key: revoked, expired, restricted to other domains, or never granted the scope. **There is nothing to retry** β€” the same key fails the same way. Reissue it in the console, then initialize again. | ### Transparent Background When the scene you initialize with carries the `background:transparent` tag, the presenter renders the 3D view on a transparent canvas and your page shows through behind the avatar; a scene without the tag renders its own built-in background instead, and nothing shows through. In Catalog mode the scene decides it: there is no method and no attribute that switches transparency on, so whether you get it follows from which `sceneId` you pass to `initializeWithConnectKey`. Both `/assets/scenes` and `/assets/scenes/{scene_id}` return each scene's `tags`, so your picker can tell which scenes are transparent. When you pick one of those, whatever should show behind the avatar belongs on the element's own container β€” the presenter paints no background of its own. In Direct mode, `initializeDirectWithBlobs` decides it by its `scene`: pass an image and it is drawn behind the avatar; leave `scene` out and the background is transparent. ## Connect API Reference Connect API is the server-facing half of the kit. Unless noted otherwise, the paths below are relative to your regional base URL, for example `https://console.perxona.ai/asia/api/v1/connect`. Authenticate protected calls with a Connect API key, sent as an `X-Connect-Key` header. πŸ—ΊοΈ **This is the real Connect API** β€” the one your own backend calls, at `console.perxona.ai`. The Express sample later in this handbook wraps some of these endpoints behind its own `/api/*` routes, on a second, separate server β€” see [Express Sample Adapter API](https://connect.perxona.ai/#sample-api-adapter) for those. If you are writing your own backend, call the endpoints on this page directly; you do not need the sample's routes. πŸ’‘ Send `X-Connect-Key: ` on every protected call β€” see [Get Your API Credentials](https://connect.perxona.ai/#credentials) for how to create one. ⚠️ **Never send both headers on one request.** The API rejects `X-Connect-Key` and `Authorization: Bearer` together with `400`, whether you are migrating off `Authorization: Bearer` or testing both. ### Usage and Subscription ⚠️ Connect Kit sign-ups are treated as Perxona Console `Free Plan` users by default. If that organization's credits are exhausted, **or its subscription itself is no longer active**, metered calls β€” currently `POST /api/chatbots/:id/chat` (chatbot conversations) β€” fail with the same HTTP `400` and `code: 1003`, with a body like one of these: ``` {"code": 1003, "details": "credit_points exhausted for org_id: ..."} ``` ``` {"code": 1003, "details": "Subscription status is not valid for org_id: ..."} ``` The `details` field is what tells the two apart. A third, separate case β€” no subscription record exists for the organization at all β€” fails with HTTP `403` and `code: 14005` instead: ``` {"code": 14005, "details": "No active subscription found for org_id: ..."} ``` Non-metered calls (catalog lookups, chatbot CRUD, presentation) are **not** affected. To check your current usage or top up credits, sign in to [Perxona Console β†’ Subscription](https://console.perxona.ai/asia/organization/subscription/) (use the region matching your account). If you are building your own app on top of the Connect API, consider detecting `code: 1003` and `code: 14005` in the response and showing your users a friendly message β€” the sample demos in this kit show this pattern for `1003`; the same approach applies to `14005`. πŸ’‘ **Credit is your organization's shared usage meter, not scoped to Connect.** The metered calls described above (chatbot conversations) draw from the same org-wide pool as any other billable conversation traffic on your account. Check your organization's current usage with a **Secret** key: ```bash curl -X GET "$CONNECT_API_BASE/credit" \ -H "X-Connect-Key: pxc_..." ``` ``` { "used_credit_points": 42, "total_credit_points": 100, "remaining_credit_points": 58, "is_quota_exceeded": false, "period_start": "2026-08-01T00:00:00Z", "period_end": "2026-09-01T00:00:00Z" } ``` These numbers refresh roughly every 10 minutes β€” a background worker recalculates usage rather than updating it on every metered call, so checking right after a conversation may not reflect it yet. This endpoint is **Secret-key only** β€” a Publishable key gets `403`, same as every other capability a browser-facing key doesn't hold (see the capability table in [Get Your API Credentials](https://connect.perxona.ai/#credentials)). ⚠️ **Authorization: Bearer authentication is deprecated, and Connect's self-service sign-up and password recovery are no longer supported.** Use a Connect API key instead, and create your account on the console β€” see [Get Your API Credentials](https://connect.perxona.ai/#credentials) for both. ### Avatar and Scene Catalog | Method | Path | Purpose | | --- | --- | --- | | GET | `/assets/avatars` | List active avatars available to the authenticated organization. | | GET | `/assets/avatars/{avatar_id}` | Read avatar detail, including its runtime configuration. Add `include=default_motions` to also get `default_motions`: the default motions for `idle`, `talking`, `listening` and `loading`, plus the default `facial_motions`. Every key is always present; a group with no motion is an empty list. `personality_trait` picks the default motions and `lower_body_pool` for a personality; see [Personality trait](https://connect.perxona.ai/#personality-trait). | | GET | `/assets/avatars/{avatar_id}/motions` | List motions compatible with the avatar; filter by `pose_tag` or `motion_ids` when needed. | | GET | `/assets/scenes` `/assets/scenes/{scene_id}` | List active scenes or read one scene's detail. | | POST | `/assets/vrm/upload` | Upload a `.vrm` file as multipart form data and publish it as an active avatar. Requires a **secret** key. Fields: `vrm_file`, `gender` (`male` or `female`), `heads_tall` (`3`, `6` or `8`), and optionally `avatar_name` and `lipsync_mode`. Returns the new `avatar_id`. See [VRM Uploader](https://connect.perxona.ai/#vrm-uploader) for the script that checks a file before sending it. | ### Voices and Presentation | Method | Path | Purpose | | --- | --- | --- | | GET | `/voices` `/voices/{voice_id}` | List custom voices or read a voice's public synthesis details. Each voice carries a `languages` array of the languages it speaks, as short codes (`en`, `ja`, … β€” never locales like `en-US`). The list supports `language` and `provider` filters; see the callout below this table. | | POST | `/voice-tokens/tts` | Issue a provider TTS token for JSON body `{ voice_id }`. Normal `` speech manages this runtime step for you. | | POST | `/presentation` | Generate a one-shot presentation payload. Send `avatar_id` and `message`; `voice_id`, `emotion`, `intensity`, and `personality_trait` are optional. Without `voice_id` it synthesizes no speech (BYO TTS mode; see [Example: Gemini Live](https://connect.perxona.ai/#gemini-live-example)). | | POST | `/motion-suggestion` | Suggest motions for a line of text without an avatar. Send `gender`, `heads_tall`, and `text`, and optionally `personality_trait`; returns the text with motion marks and the motion assets they refer to. | 🎭 **Personality trait.** `GET /assets/avatars/{avatar_id}` (a query parameter), `POST /presentation` and `POST /motion-suggestion` (a body field) take an optional `personality_trait`: `Casual`, `Energetic` or `Professional`. Omitted, it is `Casual`. Write the value capitalized exactly as listed: unlike `emotion` and `intensity`, which are lowercase, `casual` or `PROFESSIONAL` is refused with `422`. With ``, set `personalityTrait` on the `target` of `initializeWithConnectKey`; the presenter sends it with the avatar detail and with every `/presentation` call. An app that calls `/motion-suggestion` itself sends its own `personality_trait`, the same value it gives the presenter. Each result narrows to the trait differently, so a motion outside it is not always a bug: - `default_motions`: each group keeps the motions with that trait, and keeps all of its motions when none has it. With `Professional`, the avatar may still idle in a motion that is not Professional. - `lower_body_pool`, the motions the presenter may play under gestures as a shared lower body: only the motions with that trait. When none has it, the list is empty. An empty list can also mean no motion fits the avatar's skeleton, or the organization has lower-body blending off; gestures then play their full body. - The gestures `/presentation` and `/motion-suggestion` suggest: only motions with that trait; a motion with no trait is left out too. Some avatars therefore get no gesture at all for a trait. `facial_motions` do not depend on the trait. πŸ’‘ **Pick a voice by the languages it speaks.** A multilingual agent needs a voice whose `languages` cover every language it will speak. The field uses short language codes (`en`, `ja`, `zh`, …), never locales like `en-US`; the full list of valid codes is the `Language` enum in the generated OpenAPI spec. To narrow the list server-side, pass one of those codes as the `language` filter: ```bash curl -X GET "$CONNECT_API_BASE/voices?language=ja" \ -H "X-Connect-Key: pxc_..." ``` ``` { "items": [ { "id": "8f14e45f-...", "name": "Sakura", "description": null, "languages": ["ja"], "provider": "azure" } ], "total": 1, "page": 1, "size": 50, "pages": 1 } ``` That body is one page, not the whole catalogue. `page` and `size` are query parameters (`size` defaults to 50, maximum 100), and `pages` tells you how many pages the filter matched β€” keep requesting pages until you have read them all before concluding that no voice speaks a language. A voice with no recorded language data returns an empty `languages` array β€” treat that as "unknown", not "supports nothing". ### Chatbots | Method | Path | Purpose | | --- | --- | --- | | GET POST | `/chatbots` | List chatbots or create one. Creation uses `multipart/form-data`: `name`, optional `custom_instructions`, `knowledge_file`, and a JSON-string `tools` field. | | GET PATCH DELETE | `/chatbots/{chat_bot_id}` | Read, partially update, or soft-delete a chatbot. Updates use `multipart/form-data`; use `remove_knowledge` to remove its knowledge file. | | POST | `/chatbots/{chat_bot_id}/chat` | Send a JSON message history in the Connect parts format and receive `reply_text`, which can be passed to `presenter.present()`. | ### Credit | Method | Path | Purpose | | --- | --- | --- | | GET | `/credit` | Read the organization's current credit usage β€” used, total, remaining, and the current period's start/end. Secret-key only; see [Get Your API Credentials](https://connect.perxona.ai/#credentials) for the capability breakdown. | ## Get Your API Credentials Two things, in this order: a **Perxona account**, then the **two Connect API keys** you create from it. The keys are what your integration actually authenticates with β€” the account only exists so you can sign in to the console and issue them. πŸ”‘ **Any sign-in method works.** Perxona Console and Connect Kit share one account system, and since your integration authenticates with keys rather than a password, **Google Sign-In is fine** β€” you never need a password for the sample. Motion Browser authenticates with a Connect API key instead (see its own section below). Sign up on the **[Perxona console](https://console.perxona.ai/asia/auth/sign-up)** and sign in. That account is what lets you create the two API keys β€” the integration itself never uses your password. ⚠️ **There is no sign-up API.** Connect's `signup`, `confirm-signup`, `forgot-password` and `reset-password` endpoints are deprecated and no longer supported. Create your account on the console instead; password recovery is on its sign-in page. ### Create Your Two API Keys Sign in to the Perxona console with that account, open the avatar menu (top right), then go to **[Management β†’ Integration β†’ Connect API keys](https://console.perxona.ai/asia/organization/integration/connect-api-keys/)**. Create **two** keys β€” they are not interchangeable, and the form shows what each type can do before you create it β€” the same breakdown is below: | Create with type | Put it in | Allowed domains | | --- | --- | --- | | **Secret** | `PERXONA_CONNECT_SECRET_KEY` | **Leave empty.** See the warning below. | | **Publishable** | `PERXONA_CONNECT_PUBLISHABLE_KEY` | Set them once you know where the page is served from. | #### What Each Key Type Can Do | Capability | Secret | Publishable | | --- | --- | --- | | Read assets (avatars, scenes, motions) | βœ“ | βœ“ | | Read voices | βœ“ | βœ“ | | Generate presentation | βœ“ | βœ“ | | Generate TTS token | βœ“ | βœ“ | | Upload assets (VRM upload) | βœ“ | β€” | | Chat with a bot | βœ“ | β€” | | Manage chat bots (create, update, delete) | βœ“ | β€” | | Read credit usage | βœ“ | β€” | ![Perxona Console: Management β†’ Integration β†’ Connect API keys page](https://connect.perxona.ai/assets/images/integration-page.png) ⚠️ **Each key is displayed once and never again.** The console stores only a hash, so copy it into your `.env` before closing the dialog. Lost one? Revoke it and create another β€” there is no way to read it back. ⚠️ **Putting the wrong one in the wrong variable is silent.** Both keys share the same prefix and the upstream accepts either in either slot, so a secret key pasted into `PERXONA_CONNECT_PUBLISHABLE_KEY` runs without error β€” it just means every visitor is now served a key that can manage your chatbots. Check the type shown on the console, not the string shape. 🌐 **Leave the secret key's allowed-domain list empty.** A domain restriction is matched against the browser's `Origin` header, and a server-to-server request never sends one β€” so a secret key with domains configured is refused on *every* call β€” and the error says only that the origin is not allowed, never what it saw, because nothing was sent. Domain restrictions belong on the publishable key, which really is used by a browser. Enter a bare hostname β€” no `https://`, port, or path. A leading `*.` covers subdomains only, not the apex domain itself β€” list both separately if your page can be served from either (e.g. `example.com` and `*.example.com`). βœ“ Done. Put both keys in `.env` and follow [Run the Express Sample](https://connect.perxona.ai/#quickstart), or go straight to the [Presenter component flow](https://connect.perxona.ai/#sdk-reference) to wire them into your own application. ## Motion Browser Motion Browser is a standalone developer tool for customizing avatar motion β€” a wave on a greeting, a bow on "thank you". It solves the part you cannot do by guessing: browse the full motion catalog, preview each one live on a 3D avatar, and compose a script that mixes free speech text with motion cues until it reads and looks right. Then you **export it** to an AI coding assistant, which wires the whole thing into your own project β€” Motion Browser's own code is never part of what you ship; see "Exporting to an AI Coding Assistant" below for how that handoff works. Motion Browser does not send `X-Legacy-Presenter`, so it lists assets for the current Presenter, not the legacy one. For the legacy Presenter, see [Legacy Presenter](https://connect.perxona.ai/#legacy-presenter). The **core idea**: the `` Web Component understands inline motion tags. Drop a `[MOTION id:1]` chip anywhere in your script, and the avatar performs that animation at exactly that point in the speech. ```js // The avatar says "I love", performs the wave motion, then finishes the line await presenter.present("I love [MOTION wave:1] my avatar."); ``` πŸ’‘ The Script Composer has a **Play** button that previews the script live inside Motion Browser. Once it reads and looks right, use the **Export** button in the top header to hand your avatar, scene, voice, and script off to an AI coding assistant working on your own project. ### Demo [](https://connect.perxona.ai/assets/videos/motion-browser-demo.mp4) [β†— Open the live Motion Browser](https://connect.perxona.ai/motion-browser/) ### Features - **Avatar Preview** β€” Full-screen 3D rendering; switch characters instantly from the top selector. - **Motion Library** β€” Browse, search, and filter every available motion. Click any card to preview it live on the avatar. - **Script Composer** β€” Rich-text editor where you mix free speech text with motion chips. Press **Play** to preview it here. - **Export** β€” Header button that copies your current avatar, scene, voice, and script to your clipboard as one prompt, ready to hand to an AI coding assistant. - **Scene & Voice switching** β€” Bottom control bar lets you swap scene and voice style without reloading. ### Getting Started πŸ’‘ A hosted version of Motion Browser is live β€” no local setup needed. Grab a publishable key from the [Getting Credentials](https://connect.perxona.ai/#credentials) section above, then open it from the demo link above. ### Composing a Script with Motion Tags 1. #### Write your speech text Type the words you want the avatar to say in the Script Composer. 2. #### Insert a motion chip Find the motion in the Motion Library panel. Place your cursor at the desired point in the text, then click **+** to insert it as a chip. 3. #### Press Play to preview The avatar speaks the full script and performs each motion at its marked position. The chip serializes to `[MOTION :1]` and is passed directly to `presenter.present()` β€” this is Motion Browser calling it for you, so you can hear and see the result before it goes anywhere near your own code. 4. #### Ready? Export it Once it reads and looks right, use the **Export** button in the header β€” see "Exporting to an AI Coding Assistant" below for what it copies and how to use it. ### Exporting to an AI Coding Assistant The **Export** button, in the top header, is how you get your configuration out of Motion Browser and into your own project β€” Motion Browser's own code is never part of what you ship, so this is the handoff. Click it and Motion Browser copies one prompt to your clipboard β€” your current avatar, scene, and voice (name and id), plus the full script from the Script Composer β€” ready to paste into an AI coding assistant (Claude Code, Cursor, or similar) working on your own Perxona Connect sample project. The assistant reads your project's own code and decides where these values belong; Motion Browser doesn't know your project's structure, so it never guesses for you. The button is disabled until the Script Composer has some content β€” a script, a motion chip, or both. πŸ’‘ **Worked example** β€” say you've composed a greeting: `Hi there! [MOTION wave-1:1]`. Press Export, then paste the copied prompt into your assistant with something like: "Wire this into my chatbot's `custom_instructions` so it uses this greeting." The assistant can point your chatbot's own instructions at this exact line. Keep in mind that's still a chatbot generating a reply β€” it follows instructions, but it isn't guaranteed to reproduce the line verbatim, motion tag included, on every single turn. Try it and see how it reads before relying on it. ## VRM Uploader ![Perxona Connect Kit: VRM 1.0 Character Upload Now Available](https://connect.perxona.ai/assets/images/connect-vrm-support.jpeg) Perxona Connect Kit lets you add your own **VRM** characters to the avatar catalog yourself, with one script and no extra infrastructure. This is the fastest path from a `.vrm` file to a live, speaking avatar β€” whether it's a branded mascot, a digital presenter, or a personal project. πŸͺ† Uploaded avatars are scoped to your Perxona organization account. Any member of the same org can select them from the Connect Kit avatar dropdown immediately after upload β€” no redeploy needed. ### Uploading Your VRM `upload-vrm.sh` checks your file against everything on this page and uploads it when it passes. It needs `bash`, `jq` and `curl`, plus a Connect API key of type **secret** β€” see [Get Your API Credentials](https://connect.perxona.ai/#credentials). Only a secret key may upload an asset. 1. #### Get the script ```bash curl -fsSLO https://raw.githubusercontent.com/XRSPACE-Inc/perxona-connect-kit/main/tools/vrm-uploader/upload-vrm.sh chmod +x upload-vrm.sh ``` 2. #### Check the file ```bash ./upload-vrm.sh --validate-only my-avatar.vrm ``` Every check prints a line. Anything marked `FAIL` stops the upload. The one check that can only warn is about expression data, because a model without it still loads and plays motions. 3. #### Upload it ```bash export PERXONA_CONNECT_SECRET_KEY=pxc_... ./upload-vrm.sh --gender female --heads-tall 8 my-avatar.vrm ``` The script talks to `https://console.perxona.ai/asia` unless you say otherwise. Outside that region, export `PERXONA_API_BASE_URL` with your own base URL first β€” a key issued in one region is not accepted in another, and the refusal never mentions regions. `--gender` (`male` or `female`) and `--heads-tall` (`3`, `6` or `8`, the body's height in heads) together pick the motion set your avatar draws its gestures from. Clips are retargeted onto your own rig, so the wrong choice gives you gestures in the wrong style rather than a playback failure. Add `--avatar-name "My Avatar"` to set the display name; without it the file name is used. The script prints the new avatar's id, and the character appears in the avatar list returned by `GET /assets/avatars`, ready to use in your project. πŸ€– **Working with an AI coding assistant?** Add `--json` to either command and the script prints one JSON object instead of the report, carrying a `pass`/`warn`/`fail` entry per check. Exit codes are fixed: `0` passed, `1` bad usage or a missing tool or key, `2` the checks failed, `3` the upload failed. Something like this is enough to hand over: *"Download upload-vrm.sh from the Connect Kit repo, run it with --validate-only --json on my .vrm, and tell me what to fix before I upload."* ### Supported VRM Specification Check your file against this list β€” every item can be verified in common tools such as VRoid Studio or Blender. No Perxona tooling is needed. - **VRM 1.0 is what this list assumes.** A VRM 0.x file uploads too β€” the uploader reports which version it found rather than refusing one β€” but everything below is written against 1.0, so export 1.0 when you have the choice (for example from VRoid Studio). - **File size up to 50Β MB.** - **Humanoid skeleton with all 15 required bones**: `hips`, `spine`, `head`, plus upper leg / lower leg / foot and upper arm / lower arm / hand on both sides. Other humanoid bones (chest, neck, shoulders, fingers, …) are optional, but once assigned they must follow the VRM 1.0 bone hierarchy. Bone *names* are free β€” we read the VRM humanoid mapping, not node names, so any DCC export works. - **MToon materials recommended.** Non-MToon materials still load, but fall back to basic unlit / PBR shading, so the look may differ from your DCC preview. Avatars are rendered with built-in lighting β€” light sources inside the VRM file have no effect. 🧹 **Export only the character.** When exporting your VRM 1.0 file, include the character itself and nothing else. We try to strip scenes, backgrounds, props, cameras, light sources, and embedded animations automatically during conversion, but leftover extras can still fail the conversion validation and block the upload. πŸ’‡ **No swing physics yet.** Spring-bone settings (`VRMC_springBone`) are not simulated β€” hair, skirts, and accessories will not sway. ### Lip-sync and Expressions A model without expression data still loads and moves, but it will not lip-sync or emote. Provide at least one of: - **VRM 1.0 expression presets** (VRoid Studio exports these by default): mouth shapes `aa`, `ih`, `ou`, `ee`, `oh`; emotions `happy`, `angry`, `sad`, `relaxed`, `surprised`; plus `neutral`, blink and look-at presets. To lip-sync with these presets, the model needs all five mouth shapes. - **ARKit-52 blendshapes**: morph targets named with the standard ARKit names (such as `jawOpen`, `eyeBlinkLeft`), all 52 of them β€” a partial set does not count. Standard names are what to aim for, but a decorated spelling such as `Face.jawOpen` is recognised too β€” names are matched without regard to case or surrounding whitespace, an exact match first and a containing one second. πŸ’‘ **What each kind of data gives you.** With the five mouth-shape presets, the avatar lip-syncs while it speaks. With all 52 ARKit blendshapes, it lip-syncs and also plays the facial animation that comes with its motions. A model with only some of the ARKit names plays no facial animation. If it also lacks any of the five mouth shapes, it does not lip-sync. Whichever data it has, you can set any of its expressions yourself with `setExpressionWeight` (see [Presenter Component Reference](https://connect.perxona.ai/#sdk-set-expression-weight)). Want the full picture of the format itself? See the official [VRM 1.0 documentation](https://vrm.dev/en/vrm1/) (a Chinese-language community guide is also available [here](https://docs.vrcd.org.cn/books/vrm-vrm/page/vrm-10#bkmrk-vrm-1.0-%E4%BB%8B%E7%BB%8D%E2%80%8B)). ### Reference Model: ViviPod42 Not sure what a qualifying file looks like? We verified **ViviPod42** β€” a free model by **softmind** (vTuber ホームセンター) β€” against our pipeline: VRM 1.0, complete humanoid skeleton, all 18 expression presets, and 19 of 20 materials in MToon. Download it from the author's page on [BOOTH](https://booth.pm/en/items/5447425) and compare it with your own file. ©️ **ViviPod42 is not a Perxona asset.** It is provided free of charge by its original author, for reference only. Per the license embedded in the file: redistribution and modification are prohibited, use is limited to personal non-commercial purposes, and credit is required. That is also why we link to the author's page instead of hosting the file ourselves. Use it for local spec comparison only β€” do not upload it to Connect or use it in your own project; either would count as redistribution. ### Where to Find a VRM File - Browse [BOOTH](https://booth.pm/en/) for VRM models β€” many listings are still VRM 0.x, so confirm the version and the license terms before downloading. - Or build your own with [VRoid Studio](https://vroid.com/en/studio) (free) and export it as VRM 1.0. ### Questions or a Failed Upload? Not sure whether your file qualifies, or did an upload fail? Post the file details and the error message in our [Discord channel](https://discord.com/channels/1509062382432026624/1514521511028068374) and we will help you sort it out. Not on our Discord server yet? Join first via [this invite link](https://discord.gg/dywx2nJRE) β€” the channel link above only opens for members. ## Vibe Coder & Beginner Guide Building with an AI coding editor (such as **Cursor**, **Windsurf**, **VS Code + GitHub Copilot**, or **Claude Code**) without a traditional software engineering background? This guide translates every technical term into plain language, shows how to download and configure the project without memorizing terminal commands, and gives you ready-to-copy AI prompts. ### 1. Three Core Concepts in Plain Language | Term you will see | What it actually means | | --- | --- | | **GitHub & `Clone`** | **GitHub** is where the starter code lives online. **Cloning** simply means making a full copy of this project folder on your own computer so you can edit and experiment freely without affecting the original template. | | **Environment Variables & `.env`** | Think of `.env` as your project's **private settings file** that stays only on your computer. Your API keys are like passwords β€” if you paste them directly into webpage code and share your project, anyone can take them. Putting them in `.env` keeps them out of GitHub (`.gitignore` automatically blocks `.env` from being uploaded). **Why is there a `.env.example`?** The repository includes `.env.example` as a blank form template. You duplicate it, rename the copy to `.env`, and fill in your own keys. | | **Two API Keys (`Secret` vs `Publishable`)** | An **API key** is a digital pass that connects the app to your Perxona account. This kit uses **two** keys on opposite sides of the trust boundary: `PERXONA_CONNECT_SECRET_KEY` stays **only on your local server**, while `PERXONA_CONNECT_PUBLISHABLE_KEY` is handed to the **web browser**. See [Get API Credentials](https://connect.perxona.ai/#credentials) above for what each key can do and how to create them. | ### 2. Zero-GitHub Setup Tips 1. #### Install two free tools (one-time setup) 1. **An AI code editor**: Download [Cursor](https://www.cursor.com/) or [VS Code](https://code.visualstudio.com/). 2. **Node.js (version 22 or newer)**: Download the installer from [nodejs.org](https://nodejs.org/). Not sure if you already have it? Ask your AI editor: `"Check if Node.js 22 or newer is installed on my computer."` 2. #### Get the project onto your computer (Pick any 1 of 3 ways) You don't need to memorize terminal commands β€” pick whichever option feels easiest: - **Option A β€” Ask your AI editor to do it for you (Recommended):** Paste this into Cursor, Windsurf, or Claude Code: ```text Please clone https://github.com/XRSPACE-Inc/perxona-connect-kit.git, go into the samples/express directory, copy .env.example to .env, and run npm install for me. ``` - **Option B β€” Use the editor button:** Click **Clone Git Repository...** on the welcome screen of Cursor / VS Code, paste `https://github.com/XRSPACE-Inc/perxona-connect-kit.git`, pick a folder on your computer, and then open the `samples/express` subfolder inside it. - **Option C β€” Download ZIP from GitHub:** On the [GitHub repository page](https://github.com/XRSPACE-Inc/perxona-connect-kit), click the green **<> Code** button β†’ **Download ZIP**, unzip it, and open the `samples/express` folder inside it. πŸ“ **Check your folder:** The runnable web app lives inside `samples/express/`, not the top-level folder. Always open or run commands inside `samples/express/`. 3. #### Find and edit `.env`, then run the sample Follow [Get API Credentials](https://connect.perxona.ai/#credentials) to create your two keys, and [Run the Express Sample](https://connect.perxona.ai/#quickstart) below to fill in `.env` and start the server. πŸ’‘ **Can't see `.env` in Finder or File Explorer?** Files starting with a dot (`.`) are hidden by default on macOS and Windows. Look in the **left file sidebar of Cursor / VS Code** β€” it always shows `.env` files. Make sure there are no spaces around `=`, no quotes, and that the file is named `.env` (not `.env.txt`), then save (`Cmd+S` / `Ctrl+S`). ### 3. How to Vibe Code Your Own App (Ready-to-Copy AI Prompts) This repository ships with built-in AI context files (`AGENTS.md` and `CLAUDE.md`). When you open the project in Cursor, Windsurf, Claude Code, or VS Code Copilot, your AI assistant automatically knows the SDK contract and project structure. 🎯 **The Golden Rule: Build from `demos/embed/`, not from `demos/studio/`.** Use **Studio** in your browser to browse avatars and create your chatbot, but always ask your AI editor to modify `samples/express/public/demos/embed/` (a clean, minimal product-page template) rather than `demos/studio/` (a full developer console with catalog pickers, CRUD forms, and debug tools). Copy and paste any of these prompts straight into your AI editor: **Prompt 1 β€” Redesign the product page around the avatar:** ```text Look at samples/express/public/demos/embed/. Keep the avatar initialization and chat logic in app.js intact, but redesign index.html and style.css into a modern [e.g. AI hotel concierge / virtual language tutor / brand ambassador] website. ``` **Prompt 2 β€” Pin your chosen Avatar, Scene, Voice, and Chatbot in `.env`:** ```text Read the auto-selected Avatar, Scene, Voice, and Chatbot IDs from my local server's startup log (or use the IDs I selected in Studio) and update DEMO_FIXED_AVATAR_ID, DEMO_FIXED_SCENE_ID, DEMO_FIXED_VOICE_ID, and DEMO_FIXED_CHATBOT_ID in samples/express/.env so the Embed demo uses my chosen character. Do not read or output PERXONA_CONNECT_SECRET_KEY, do not expose local /api/* routes as public APIs, and do not hardcode credentials or responses in frontend code. ``` **Prompt 3 β€” Add clickable starter question chips:** ```text In samples/express/public/demos/embed/, add 3 clickable starter question buttons above the chat input box so visitors can click a question to immediately send it to the chatbot and have the avatar speak the answer. ``` ## Run the Express Sample The sample app is a single Node/Express server that serves two runnable browser demos, both built on the same `` integration. They are split by **which side of the work you are looking at**. Both hold a conversation the avatar speaks aloud. **Embed** is what it looks like once it is live: a product page with an avatar answering questions on it, no controls and nothing on the page about its own configuration. **Studio** is the console you build that from: browse the catalog, create and edit chatbots, interrupt mid-sentence, and switch between a Perxona-hosted chatbot and your own API key without losing the conversation. Run the server once, then open either demo. The steps below get you from clone to a talking avatar. ⚑ Get from clone to a talking avatar in **5–15 minutes**. You need **Node `>=22`** and two Connect API keys β€” see [Get Your API Credentials](https://connect.perxona.ai/#credentials). New to GitHub, `.env` files, or terminal commands? Start with the [Vibe Coder Guide](https://connect.perxona.ai/#vibe-coder) above. 1. #### Clone the sample ```bash git clone https://github.com/XRSPACE-Inc/perxona-connect-kit.git cd perxona-connect-kit/samples/express ``` 2. #### Create your local config ```bash cp .env.example .env ``` Open `.env` and fill in the three required values. The two keys are not interchangeable β€” the secret one stays on the server, the publishable one is what the browser is given: ```bash PERXONA_API_BASE_URL=https://console.perxona.ai/asia PERXONA_CONNECT_SECRET_KEY=pxc_... PERXONA_CONNECT_PUBLISHABLE_KEY=pxc_... ``` 3. #### Install dependencies ```bash npm install ``` Requires Node `>=22`. If your Node is too old, `npm install` refuses with a clear upgrade message. 4. #### Start the server ```bash npm run dev # with live reload (node --watch) # or npm start # without watch ``` The terminal prints the local URL, e.g. `http://localhost:8083`. 5. #### Launch the avatar Open the URL in your browser. The landing page offers two demos. In **Studio**, pick an **Avatar**, **Scene**, and **Voice**, then click **Launch Presenter**. In **Embed** there is nothing to pick and nothing to configure β€” the avatar and the chatbot are resolved for you; just type a message. Either way the first line needs a user gesture: browser autoplay policy only lets audio start from one, so no avatar anywhere can speak on page load. In Studio that gesture is the launch click; in Embed it is the message you send. ## Sample Configuration All configuration lives in `.env`. Copy `.env.example` β†’ `.env` and fill in your values. **Never commit `.env`** β€” it is in `.gitignore`. | Variable | Required | Default | Description | | --- | --- | --- | --- | | `PERXONA_API_BASE_URL` | βœ… | β€” | Region-specific Connect API base URL. Ask your Perxona contact. | | `PERXONA_CONNECT_SECRET_KEY` | βœ… | β€” | Secret Connect API key. Authenticates the server on every upstream call; never served to a browser. **Leave its allowed domains empty** β€” a server sends no `Origin`, so any domain restriction refuses every call. | | `PERXONA_CONNECT_PUBLISHABLE_KEY` | βœ… | β€” | Publishable Connect API key. Served to the browser on `GET /api/connect-key` and passed to the presenter. Reads the catalog, generates presentations, and mints speech tokens (the last two bill your organization); it cannot reach the chatbot routes. | | `PORT` | β€” | `8083` | Port the server listens on. | | `PRESENTER_URL` | β€” | `https://cdn.perxona.ai/prod/connect/latest/widget/entry/presenter.js` | Presenter engine CDN URL. The default is region-neutral; set `https://cdn.perxona.ai/{eu,asia}/prod/connect/latest/widget/entry/presenter.js` to pin a region, or a URL your Perxona contact provides. | | `LLM_API_KEY` | β€” | β€” | Set to enable the chat panel. Any OpenAI-compatible key works, including local Ollama via `LLM_BASE_URL`. | | `LLM_BASE_URL` | β€” | `https://api.openai.com/v1` | LLM endpoint URL (override for Ollama or other providers). | | `LLM_MODEL` | β€” | `gpt-4o-mini` | LLM model name passed to the chat endpoint. | ## Presenter Both demos build on the same `` integration β€” the essential pattern every Connect app needs, in vanilla JS. Two building blocks are shared by both: **presenter initialization** (fetch the publishable key from your server and hand it to `initializeWithConnectKey()`) and **driving speech** (send text to `present()`). A third β€” **catalog browsing** (fetch avatars, scenes, and voices) β€” belongs to Studio only; Embed reads its target from `.env` and never touches the catalog. Here is the shared lifecycle β€” each demo's own chapter below covers exactly when it triggers `initializeWithConnectKey()` and `resumeAudioPlayback()`: 1. **Page load:** `app.js` calls `GET /api/config`, dynamically injects the presenter engine `