# 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({
"211": {
"class_type": "ElevenLabsVoiceSelector",
"inputs": {
"voice": "Roger (male, american)"
},
"_meta": {
"title": "ElevenLabs Voice Selector"
}
},
"215": {
"class_type": "SaveAudioMP3",
"inputs": {
"audio": [
"218",
0
],
"filename_prefix": "audio/ComfyUI",
"quality": "V0"
},
"_meta": {
"title": "Save Audio (MP3) (DEPRECATED)"
}
},
"218": {
"class_type": "ElevenLabsTextToDialogue",
"inputs": {
"apply_text_normalization": "auto",
"inputs": "2",
"inputs.text1": "Now, you can use ElevenLabs node to generate multi-dialogue audio.",
"inputs.text2": "Yes, you can use voice cloning too",
"inputs.voice1": [
"211",
0
],
"inputs.voice2": [
"219",
0
],
"language_code": "",
"model": "eleven_v3",
"output_format": "mp3_44100_192",
"seed": 2061518140,
"stability": 0.5
},
"_meta": {
"title": "ElevenLabs Text to Dialogue"
}
},
"219": {
"class_type": "ElevenLabsVoiceSelector",
"inputs": {
"voice": "Laura (female, american)"
},
"_meta": {
"title": "ElevenLabs Voice Selector"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)