Learning resourcesReviewed · xAI

Photo to Talking Character

Photo to Talking Character is an xAI tutorial for developers turning character pictures into talking videos, with paid rendering that cannot be cancelled through the API. Its TypeScript example combines pictures, built-in voices and dialogue in a browser app or command-line interface, with voice previews and generation progress.

Researched 15 Nov 2026

In short.

Photo to Talking Character is an xAI tutorial for developers making talking videos from character pictures, with video jobs that remain billable after the user stops waiting. It explains how to assign pictures and built-in voices to characters, assemble dialogue into one request, preview voices and display rendering progress. The example produces short videos at up to 720p; actual output quality, execution behavior and current pricing were not independently assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete documentation page at [https://docs.x.ai/cookbook/examples/photo-to-talking-character.md], including its setup instructions, architecture, examples, reported charges, voice restrictions, resolution limit and cancellation behavior. Linked pages and referenced repository files are excluded. Installation, API calls, generated output, performance and billing were not exercised; behavior beyond the documented claims remains unverified.

The overview

Identity

Photo to Talking Character is a recipe in xAI's cookbook documentation [https://docs.x.ai/cookbook/examples/photo-to-talking-character.md]. It teaches Grok image and video integration through a TypeScript example with a local browser interface and a command-line interface.

Assessment

The tutorial is useful for understanding how pictures, voices and dialogue become one video request. It connects the visible interface to named source files and API methods, and explains practical details such as temporary download URLs, progress polling and continued billing after Stop.

Its evidence supports an implementation guide. Installation success, generated speech accuracy, character consistency, lip movement and application reliability remain unassessed.

Users

The example suits developers prototyping dialogue for illustrated characters, mascots or pets. Beginners can follow the local web interface and inspect the assembled request, although setup assumes familiarity with a terminal, npm and API keys.

Experienced JavaScript and TypeScript developers can use the explanations of indexed media references, asynchronous jobs, server-sent events and browser video delivery when designing similar integrations.

Capabilities

The documented interface supports a character speaking a supplied line and a second character answering in the same video. Users can choose built-in voices, hear text-to-speech previews, inspect the request, watch generation progress and play the resulting video.

The recipe describes videos lasting 5 to 15 seconds, with duration chosen from dialogue length. Both interfaces save scene.mp4 and the accompanying scene.json under output/<the first line>/. The browser server supports seeking through byte-range delivery.

Using it

Requirements

The page requires Node.js 22.13 or later and an xAI API key supplied through a repository-root .env file or the XAI_API_KEY environment variable. Access to the xAI API is required. Your own character pictures are optional, because the page provides sample dog and cat drawings for both the terminal and browser versions.

The instructions assume the repository is already available. The page supplies no repository acquisition command, exact SDK version, dependency lock information or video-model identifier. Account and billing prerequisites are not detailed.

Mechanism

In src/scene.ts, writePrompt() connects each character to indexed inputs: <IMAGE_0> identifies the first picture in reference_images, and <AUDIO_0> identifies the first voice in reference_audios. The prompt places quoted dialogue in sequence and requests no additional speech or music. These are generation instructions; compliance has not been assessed.

makeScene() calls client.videos.generate(). Pictures enter as Blobs that the SDK sends as data URLs, while voice references contain a voice_id. The documented API accepts up to three voice references. sceneLength() estimates duration from word count.

waitForVideo() calls client.videos.get() every three seconds and exposes the returned progress percentage. Once ready, makeScene() downloads the video immediately because its URL is temporary.

The browser uploads pictures to /api/pictures before opening /api/scene through EventSource, which supports GET requests. A Node HTTP server streams progress as server-sent events and serves the saved video. AbortSignal handling can end the local request or wait, but the remote video job continues.

Setup

After configuring the API key, the documented sequence is to enter examples/photo-to-talking-character/typescript, run npm install, then run npm run web. The local interface opens at [http://localhost:3000].

The browser offers a dog-and-cat sample or accepts another picture, voice and line. npm start -- voices lists available voices, while npm start -- ./your-drawing.png eve "Hello! Somebody finally drew me a mouth." demonstrates a single-character command. These instructions were not executed.

Example

The default scene uses sample-dog.jpg speaking in Rex's voice and sample-cat.jpg answering in Luna's voice. The page says those sample pictures were created with grok-imagine-image-2.0; it does not identify that model as the video generator.

A documented two-character command is npm start -- ./dog.png rex "Want to play?" ./cat.png luna "No." This illustrates how picture, voice and line arguments are grouped for each character. The resulting video was not generated or inspected for this report.

Assessment & evidence

Limitations

Reference-to-video output is limited to 720p according to the page. The interface demonstrates one or two characters; the separate API limit of three voice references does not establish a three-character interface.

Although client.voice.list() returns 28 voices, the page says the video model rejects aurora and liora, so the example filters them out. Supplying a personal recording through a reference_audios URL is restricted to trusted partners on request.

A voice preview uses text to speech, while the video performs the line with its own timing. Preview audio therefore cannot establish the final delivery. Video jobs cannot be cancelled through the API, and output fidelity and failure rates are not quantified.

Design reasoning

Showing each picture and voice beside its indexed tag makes the relationship between the interface and the request easier to inspect. This is particularly useful when a scene contains multiple characters whose identities and voices must stay aligned.

Previewing voices provides a cheaper way to choose a voice before commissioning a video. Estimating duration from dialogue length connects pacing to billing, while explicit polling exposes progress to the interface. These design choices are explained by the page; their effectiveness was not measured.

Alternatives

The recipe offers a browser interface for choosing inputs and viewing progress, plus a command-line interface using the same scene code. The browser additionally presents the request visually and caches audio previews.

For job handling, client.videos.wait() can perform polling automatically, but the page says it does not report progress. Competing services, local generation tools and their comparative quality or prices are not assessed.

Evidence

The available evidence is the complete documentation page at [https://docs.x.ai/cookbook/examples/photo-to-talking-character.md], captured on 2026-11-15 at 03:14:41.656 UTC. Its source fingerprint is sha256:909401005d925133d162b396906d3134a030566485eb63bc494c54fdef079415.

Descriptions of source files, API behavior, timing and charges come from that page. The referenced repository contents, generated media, linked documentation and service terms were not supplied. Nothing was executed.

Access & freshness

Costs

The page reports a 10-second sample costing $1.42 and a 5-second single-line video costing $0.71, approximately 14 cents per generated second. It also reports roughly a minute per run, mostly rendering, and a fraction of a cent for a voice preview. These are the author's reported examples; current rates and costs for other requests are unknown.

Duration affects cost because every second is billed. The page says both interfaces display the final video cost. Pressing Stop only stops waiting: the video still finishes and is billed. The browser server caches voice previews so replaying a cached preview avoids another preview charge.

Rights

The supplied page does not state a licence for the recipe, referenced code or sample pictures. It also does not establish redistribution permissions, generated-video ownership or commercial-use rights.

The statement that built-in voices are available to everyone describes API access. Terms governing submitted pictures, voice use, output publication and data retention remain unknown.

Freshness

The supplied page contains no publication date, last-updated date or SDK version. Its capture date establishes when this documentation snapshot was retained, rather than when the example was authored.

Voice availability, API method behavior, resolution limits and charges are documented claims from that snapshot. Subsequent changes and present compatibility are unknown.

Next steps

Before using the example, obtain its referenced repository and confirm current SDK compatibility, supported video voices and API pricing. Establish the applicable rights for input pictures, voices and published output.

For an initial attempt, follow the documented local setup, preview a built-in voice and inspect the assembled request before submitting a short scene. Budget for the complete video job because Stop does not cancel it. Retain the saved video and scene.json to compare the requested scene with the result.

Evidence for this report

selected-page.txtselected · checked 2026-11-15