# 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({
"8": {
"class_type": "LoadImage",
"inputs": {
"image": "marble_robot_bust.png"
},
"_meta": {
"title": "Load Image"
}
},
"13": {
"class_type": "MeshyImageToModelNode",
"inputs": {
"image": [
"8",
0
],
"model": "meshy-7.1",
"pose_mode": "",
"seed": 10793226,
"should_remesh": "true",
"should_remesh.target_polycount": 300000,
"should_remesh.topology": "triangle",
"should_texture": "true",
"should_texture.enable_pbr": False,
"should_texture.texture_prompt": "",
"should_texture.texture_resolution": "2k",
"symmetry_mode": "auto",
"ultra_mode": False,
"ultra_resolution": "2k"
},
"_meta": {
"title": "Meshy: Image to Model"
}
},
"15": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/meshy_image2model",
"mesh": [
"13",
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)