Repository navigation
Description
Summary
Add a TextToVideo agent tool that renders a video clip through the gateway's unified video API and, when given a portrait and an audio clip, a lip-synced talking clip. It is the face half of the desktop's Content project workflow; TextToSpeech is the voice half and, together with TextToSFX and TextToMusic, the template for this tool. Text-only prompts, a first-frame image, and audio-driven avatar renders are all one request shape on the gateway, so the CLI exposes one tool with the avatar inputs optional rather than an avatar-only tool.
The render runs behind POST /v1/videos, GET /v1/videos/{id} and GET /v1/videos/{id}/content, shipped in gateway v0.54.0 (inference-gateway/inference-gateway#672, current release v0.54.1), reached through the SDK's CreateVideo, RetrieveVideo and DownloadVideoContent. The CLI is already on sdk v1.38.0 (#1260 done), so nothing blocks this. First model elevenlabs/creatify-aurora. The CLI never talks to ElevenLabs directly and holds no provider key. Avatar renders send the user's face and voice to a third party, so the tool stays off by default and the docs say so plainly.
Schema facts this tool must follow
Checked against openapi.yaml in inference-gateway/schemas and the gateway's ElevenLabs transformer (internal/elevenlabs/elevenlabs.go):
sizeiswidthxheight(e.g.720x1280), not480p/720p. The gateway derives the ElevenLabs resolution from the shorter side (480, 720 or 1080) and the aspect ratio from the reduced ratio (16:9,9:16,1:1), and rejects anything else. The CLI passes the string through untouched; it does not map or validate resolutions itself.audioacceptsaudio/wavoraudio/mpegand is forwarded to the provider as-is with its mime type (base64 inline). WAV is a valid input; the ElevenLabs WAV restriction only applies to the text-to-speech output format, which is irrelevant here. The tool accepts.wavand.mp3so bothTextToSpeechoutput (WAV) and any MP3 clip work.audiorequiresinput_reference; the gateway returns 400 otherwise.secondsandpromptare ignored for avatar renders (creatify-aurora takes image plus audio and no prompt).- The rendered content is served as raw bytes with the provider's content type (
video/mp4for creatify-aurora); the tool writes.mp4. - The gateway's default request body limit is 10 MiB (
SERVER_MAX_REQUEST_BODY_SIZE), and the portrait and audio go in one multipart body. The tool rejects a combined upload over 10 MiB before sending, with a one-line error that suggests a shorter clip or MP3. WAV fromTextToSpeechat 24 kHz mono is roughly 3 MB per minute, so typical clips fit. - Status values are
queued,in_progress,completed,failed; a failed job carrieserror.message.
Decisions
- No local engine. Every local lip-sync option benchmarked on an Apple M4 Pro (MuseTalk, LatentSync, LongCat-Video-Avatar) was far too slow or CUDA-only, so there is no
uv, no embedded Python, no weights download and no platform gate. The tool works on every OS the CLI does. - Models are configurable.
text_to_video.modelis a gatewayprovider/modelid, defaultelevenlabs/creatify-aurora; other video models the gateway exposes later (veo, seedance) need no CLI change. - Avatars are plain image files.
~/.infer/models/avatars/<name>.png|.jpg|.jpeg|.webp, a flat library like voice samples. No metadata file. - Async job, hidden from the agent. The tool creates the job, polls until it completes, downloads the content to the output path and returns once.
Executeblocks; there is no tool progress callback in the CLI and this issue does not add one. Timeout and cancellation come fromtext_to_video.timeoutand the context.
The tool
- Inputs:
prompt(required unlessaudiois given; for avatar renders it describes framing only, never the dialogue),seconds(optional string passthrough, ignored whenaudiois present),size(optionalwidthxheightpassthrough, e.g.720x1280or1280x720; omitted means provider default),avatar(optional bare image name: working dir, then~/.infer/models/avatars/),audio(optional bare.wavor.mp3name: working dir, then theTextToSpeechoutput dir; requiresavatar),output_path(bare name confined totext_to_video.output_dir,.mp4). Rejects directories, absolute paths and..throughresolveMediaOutputPathand the sample lookup pattern shared withTextToSpeech. - Config, top-level
text_to_video::enabled(default false, tool hidden when false),model,size(default empty),output_dir(default~/.infer/tmp/video),timeout(900),poll_interval(5),require_approval.INFER_TEXT_TO_VIDEO_*overrides come free from the reflective env loader. Read by the desktop withinfer config get text_to_video --format json. - Domain: a
VideoServiceport ininternal/agent/domain/media.gonext toSpeechService,MusicServiceandSoundEffectService, taking a smallVideoRequestvalue (Prompt,Seconds,Size,AvatarPath,AudioPath) and an output path, returning only an error. Gateway implementationinternal/agent/infrastructure/video_service.go, modelled onsfx_service.go: build the multipart files withopenapi_types.File.InitFromBytes, create the job, pollRetrieveVideoeverypoll_intervaluntilcompletedorfailedor the context ends, download the content, write the file. Wired ininternal/container/container.goandinternal/agent/tools/registry.go; counterfeiter line added tomocks:generate. - A combined upload over 10 MiB is rejected before the request with a one-line error; a failed or moderated job returns the provider's
error.message; a failed render, timeout or download leaves no partial file. - Result:
path,model,seconds,size,avatar(name or empty),audio(name or empty).
Follow-up in inference-gateway/desktop once the tool exists: inference-gateway/desktop#311.
Out of v1
Video-driven dubbing of the user's own footage (sync-lipsync, veed-lipsync style models), a local engine, a direct (gateway-less) ElevenLabs client, webhooks instead of polling, progress reporting to the agent, client-side mapping of 480p/720p shorthands to widthxheight.
Acceptance Criteria
-
TextToVideois registered withprompt,seconds,size,avatar,audioandoutput_pathinputs and is hidden unlesstext_to_video.enabledis true;audiowithoutavatar, a request with neitherpromptnoraudio, and anaudioname that is not.wavor.mp3are rejected inValidate. -
sizeis passed through verbatim aswidthxheight; the tool description documents the720x1280form and the 480/720/1080 shorter-side rule for creatify-aurora. - The tool calls the gateway through the
VideoServiceport; the infrastructure implementation usesCreateVideo,RetrieveVideoandDownloadVideoContent, honourstimeoutandpoll_interval, and writes an.mp4intotext_to_video.output_dir. -
avatar,audioandoutput_pathreject directories, absolute paths and..through the helpers shared withTextToSpeech; a combined avatar plus audio upload over 10 MiB fails before the request. - A failed job returns the provider's
error.messagenaming the model; failure, timeout and download errors leave no partial file. - Unit tests with a fake service cover a text-only render, an avatar plus WAV render, an avatar plus MP3 render, validation, the result shape and cleanup on failure; an infrastructure test with
sdkmocks.FakeClientcovers the poll loop (queued to completed, failed job, timeout). - One integration test in
tests/integrationruns the tool against tokenless, which already serves the three video routes (gateway/gateway.gohandlesPOST /v1/videos,GET /v1/videos/{id}and/content), followingtext_to_sfx_test.go. -
docs/text-to-video.md(modelled ondocs/text-to-speech.md, with the third-party data note and the size and upload-limit rules),docs/tools-reference.md,docs/configuration-reference.mdanddocs/directory-structure.md; a[DOCS]ticket is filed against inference-gateway/docs with the PR.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
refactor(platform): extract model-file downloads from internal/audio (#…
[-][FEATURE] AvatarGeneration tool: render a lip-synced avatar clip from a video asset and a WAV[/-][+][FEATURE] GenerateAvatar tool: render a lip-synced avatar clip from a photo and a WAV through the gateway[/+][-][FEATURE] GenerateAvatar tool: render a lip-synced avatar clip from a photo and a WAV through the gateway[/-][+][FEATURE] TextToVideo tool: generate a video clip, optionally lip-synced from a portrait and a WAV, through the gateway[/+]chore(deps): bump inference-gateway/sdk to v1.38.0 (#1262)
[-][FEATURE] TextToVideo tool: generate a video clip, optionally lip-synced from a portrait and a WAV, through the gateway[/-][+][FEATURE] TextToVideo tool: generate a video clip, optionally lip-synced from a portrait and an audio clip, through the gateway[/+]edenreich commentedon Sep 22, 2026
@infer Can you implement this? use /ponytail:ponytail /go /go-concurrency /domain-driven-design /tokenless
inference-gateway-maintainer commentedon Sep 22, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1270
The agent hit the job's time limit before finishing, so it was stopped to salvage its work. Its committed changes were pushed; the draft pull request is linked above.
The CI gate passes. Let me run the relevant Go tests once more to be thorough, then commit and push:
Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 23m 34sTokens: 16,433,766 in · 103,882 out · 16,537,648 total (128 requests)
Tool calls: 183 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
fix: resolve #1257
inference-gateway-releaser commentedon Sep 23, 2026
🎉 This issue has been resolved in version 0.206.0 🎉
The release is available on:
Your semantic-release bot 📦🚀