# 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({
"5": {
"class_type": "MeshyTextToModelNode",
"inputs": {
"model": "latest",
"pose_mode": "T-pose",
"prompt": "Death Knight",
"seed": 410207901,
"should_remesh": "true",
"should_remesh.target_polycount": 300000,
"should_remesh.topology": "triangle",
"style": "realistic",
"symmetry_mode": "auto",
"ultra_mode": False,
"ultra_resolution": "2k"
},
"_meta": {
"title": "Meshy: Text to Model"
}
},
"6": {
"class_type": "Preview3D",
"inputs": {
"model_file": [
"5",
0
]
},
"_meta": {
"title": "Preview 3D & Animation (DEPRECATED)"
}
},
"7": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/meshy_text2model",
"mesh": [
"5",
2
]
},
"_meta": {
"title": "Save 3D Model"
}
},
"8": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/meshy_text2model",
"mesh": [
"5",
3
]
},
"_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)