# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"2": {
"class_type": "TencentTextToModelNode",
"inputs": {
"face_count": 500000,
"generate_type": "Normal",
"generate_type.pbr": False,
"model": "3.0",
"prompt": "A stylized collectible figurine of a desert nomad elder standing whole upon a small, flat sandstone disc base. The character has exaggerated proportions, featuring a wide, hunched upper silhouette, thin limbs, and a weathered, terracotta-skinned face with brass-rimmed goggles rested on the brow. Dressed in voluminous, layered ochre and dust-orange linen robes, cinched by a distressed leather sash equipped with miniature copper canteens and pouches. The figure firmly grasps a tall, notched bronze walking staff with one hand while clutching a small spherical wicker cage in the other. Surface textures feature coarse fabric weave, burnished metal scratches, matte turquoise beaded accents, and scuffed brown leather wrappings around the lower legs and pointed boots.",
"seed": 2127907248
},
"_meta": {
"title": "Hunyuan3D: Text to Model"
}
},
"6": {
"class_type": "Preview3D",
"inputs": {
"model_file": [
"2",
0
]
},
"_meta": {
"title": "Preview 3D & Animation (DEPRECATED)"
}
},
"7": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/hunyuan3d_text2model",
"mesh": [
"2",
1
]
},
"_meta": {
"title": "Save 3D Model"
}
},
"8": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/hunyuan3d_text2model",
"mesh": [
"2",
2
]
},
"_meta": {
"title": "Save 3D Model"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)