A single ComfyUI custom node that uses either a local GGUF model or an OpenAI-compatible API to generate editable procedural Three.js scenes and render them to video.
- One node for LLM prompting, Three.js scene generation, browser validation, and video rendering.
- Local GGUF mode scans
ComfyUI/models/llm/Qwen3.8and can optionally use anmmprojprojector for visual review. - API mode supports OpenAI-compatible Chat Completions endpoints and does not require local GGUF files.
- API requests do not automatically include
max_tokens; the provider controls the output limit unless a provider-specific option is supplied throughapi_options. - Browser validation failures and incomplete code can be sent through configurable repair attempts.
- Outputs include a video, first frame, contact sheet, editable scene directory, and generated JavaScript.
Copy this repository into:
ComfyUI/custom_nodes/ComfyUI-CodeVideo-ThreeJS
The renderer requires Python packages listed in requirements-render.txt, a local Chromium/Edge browser, and ffmpeg / ffprobe:
python -m pip install -r requirements-render.txt
python -m playwright install chromiumIf you already have a separate renderer environment, set its paths in a local, untracked runtime_config.json. Use runtime_config.example.json as a template. The example contains no model files or credentials.
Restart ComfyUI after installing or updating the node.
The node scans:
ComfyUI/models/llm/Qwen3.8/*.gguf
Set:
backend: local
llm_model: your GGUF model
vision_model: None or an mmproj file
The node starts and stops its own llama.cpp process. You do not need to connect a separate Llama-cpp loader node and you do not need Ollama. context_size, gpu_layers, and max_tokens are used by local mode.
A local runtime_config.json can point to an external llama.cpp runtime:
{
"python": "",
"browser_executable": "",
"llama_executable": "runtime/llama/llama-server.exe"
}The repository intentionally does not include CUDA DLLs, llama.cpp binaries, or model weights.
Set:
backend: api
api_base_url: https://provider.example/v1
api_model: provider-model-id
api_key: env:CODEVIDEO_API_KEY
Using an environment variable for the key is recommended:
$env:CODEVIDEO_API_KEY = "your-key"Leave api_key empty for an endpoint that does not require authentication. The base URL may end at /v1, or it may be a complete /chat/completions URL.
By default, the node omits max_tokens in API mode. If a provider requires a different output-limit parameter, use api_options, for example:
{"max_completion_tokens":12000}Enable api_vision_review only when the selected API model accepts image inputs. Do not put a real API key into a workflow that will be shared; the included examples use env:CODEVIDEO_API_KEY.
workflows/本地Qwen_三维场景_单节点.json— local GGUF example.workflows/API_三维场景_单节点.json— API example with placeholder endpoint/model values.workflows/api_prompt.json— API-format prompt graph with placeholder values.
video— ComfyUIVIDEO, compatible with the built-in Save Video node.first_frame— the first rendered frame asIMAGE.contact_sheet— five sampled frames arranged horizontally asIMAGE.scene_directory— an editable directory containingcase/scene.js, preview images, camera trajectory data, and the MP4.scene_code— the generated Three.js JavaScript source.
Jobs are written under:
ComfyUI/output/codevideo_threejs/
This project adapts the Three.js proxy-scene stage of CodeVideoModel for ComfyUI. It does not run the later MiniMax-H3 video generation stage. The output is intended as a procedural structural reference; visual quality depends on the selected model and prompt.
The renderer, viewer, and Three.js assets are adapted from code-video-model/CodeVideoModel at commit 404e03d67c2977b441622ce94411470bb84984a8. See LICENSE, vendor/LICENSE.threejs, and THIRD_PARTY_NOTICES.md.