Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
# Hunyuan3D-2.1 PBR worker, RTX PRO 6000 (Blackwell) build.
#
# Same application as Dockerfile.hunyuan21 (app21.py), rebuilt for the
# NVIDIA RTX PRO 6000 lane on Cloud Run: Blackwell is compute capability 12.0,
# which the cu124 stack in the L4 image cannot target (CUDA gained sm_120 in
# 12.8). This variant moves the base to CUDA 12.8 and torch to 2.7.1/cu128,
# whose wheels ship native sm_120 kernels. TORCH_CUDA_ARCH_LIST compiles the
# in-tree extensions for BOTH 8.9 (L4) and 12.0 (RTX PRO 6000) so one image
# can serve either GPU type.
FROM nvidia/cuda:12.8.1-devel-ubuntu22.04
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
DEBIAN_FRONTEND=noninteractive \
TORCH_CUDA_ARCH_LIST="8.9;12.0+PTX" \
CUDA_NVCC_FLAGS="-allow-unsupported-compiler" \
CUDA_HOME=/usr/local/cuda \
PYOPENGL_PLATFORM=egl
# System libs: build toolchain for the extensions, plus the GL/EGL/X stack that
# headless Blender (bpy, imported by DifferentiableRenderer.mesh_utils) and the
# EGL rasterizer link against at import/runtime.
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 python3.10-dev python3-pip \
git curl wget build-essential ninja-build cmake pkg-config \
libeigen3-dev \
libgl1 libglib2.0-0 libegl1 libgles2 libglvnd0 libglvnd-dev \
libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev \
libxrender1 libxi6 libsm6 libxext6 libxkbcommon0 libxfixes3 \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3.10 /usr/bin/python3 \
&& ln -sf /usr/bin/python3.10 /usr/bin/python \
&& pip install --upgrade pip setuptools wheel
# torch first (cached layer), from the CUDA 12.8 wheel index to match the base.
# 2.7.1/cu128 is the first stable torch line with native sm_120 (Blackwell).
RUN pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 \
--index-url https://download.pytorch.org/whl/cu128
COPY requirements.hunyuan21.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
# Blender's `bpy` has no cp310 PyPI wheel and is only reached through the unused
# save_glb OBJ->GLB exporter in DifferentiableRenderer.mesh_utils. Drop a tiny
# stub module so the top-level `import bpy` in that file resolves; this worker
# assembles the PBR GLB with pygltflib and never calls a bpy function.
RUN DEST=$(python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])")/bpy.py \
&& printf '%s\n' "# stub: real Blender bpy is only needed for the unused save_glb OBJ->GLB exporter. This worker builds the PBR GLB with pygltflib." > "$DEST" \
&& echo "wrote bpy stub to $DEST"
# compile_mesh_painter.sh names its output with `python3-config
# --extension-suffix`, but only python3.10-config exists in this image; the
# empty substitution produced an un-importable `mesh_inpaint_processor` (no
# .so suffix) and the paint pass then failed at uv_inpaint with a NameError.
# Link the unversioned name so the extension gets its real suffix. Kept as its
# own layer (after the big pip installs) so cache reuse survives the fix.
RUN ln -sf /usr/bin/python3.10-config /usr/bin/python3-config
# The 2.1 code (hy3dshape + hy3dpaint packages) is cloned in-tree from a pinned
# Tencent-Hunyuan/Hunyuan3D-2.1 commit: the texgen extensions must be compiled
# from this tree, and a moving `main` breaks the reproducibility bar. Build the
# CUDA rasterizer (editable, so its .so lives in-tree) and the pybind11 mesh
# inpaint processor, then fetch the RealESRGAN super-res checkpoint the paint
# pass upscales its PBR views with.
RUN git clone https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1.git /opt/hunyuan3d21 \
&& cd /opt/hunyuan3d21 \
&& git checkout 82920d643c0dc2f7bfd7255f45f62d386edfe60c \
&& cd hy3dpaint/custom_rasterizer \
&& pip install --no-build-isolation -e . \
&& cd ../DifferentiableRenderer \
&& bash compile_mesh_painter.sh \
&& cd /opt/hunyuan3d21/hy3dpaint \
&& mkdir -p ckpt \
&& wget -q https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P ckpt
# Fail the BUILD (not a live deploy) if the dependency stack drifts: every
# import the loader pulls before it touches the GPU must resolve. CUDA is not
# initialised here (no GPU at build), so the smoke test stays to pure-python +
# .so loads and skips modules that init CUDA on import.
RUN cd /opt/hunyuan3d21 && python -c "\
import sys; sys.path.insert(0,'.'); sys.path.insert(0,'hy3dshape'); sys.path.insert(0,'hy3dpaint'); \
import torch, torchvision, transformers, diffusers, trimesh, bpy, cv2, pygltflib, custom_rasterizer; \
from torchvision_fix import apply_fix; apply_fix(); \
from hy3dshape.pipelines import Hunyuan3DDiTFlowMatchingPipeline; \
from hy3dpaint.convert_utils import create_glb_with_pbr_materials; \
from DifferentiableRenderer.mesh_inpaint_processor import meshVerticeInpaint; \
print('deps ok:', torch.__version__, torchvision.__version__, transformers.__version__, diffusers.__version__)"
# The worker runs from the repo root: the paint config references cfg/ckpt files
# by repo-relative path, so cwd must be /opt/hunyuan3d21.
WORKDIR /opt/hunyuan3d21
COPY worker_security.py /opt/hunyuan3d21/worker_security.py
COPY image_source.py /opt/hunyuan3d21/image_source.py
COPY app21.py /opt/hunyuan3d21/app21.py
EXPOSE 8080
CMD ["uvicorn", "app21:app", \
"--host", "0.0.0.0", \
"--port", "8080", \
"--workers", "1", \
"--timeout-keep-alive", "300"]