GPT Codex
The Node You Use to Fix the Graph, Not Fill It
- images
- text
- raw_json
- credits_consumed
- usage_json
- credits_left
The odd one out
Every other node in this pack paints pixels or writes prose. GPT Codex is a coding model, reached through KIE's API and exposed under KIE Next/LLM/OpenAI/Codex. It has the same interface as the GPT nodes - prompt, system prompt, images, reasoning effort, web search, tools, history, a token cap - because the pack's LLM adapter treats Codex-style endpoints as reasoning endpoints and gives them the standard control set.
So what's it doing in ComfyUI? Mostly the unglamorous parts of owning a ComfyUI install.
What people actually use it for
Writing or repairing custom node Python - paste an error trace, get a fix. Generating a workflow JSON from a description, or explaining what a workflow you downloaded is doing. Debugging a dependency conflict from the log line that keeps appearing. Drafting a LoRA training config or a captioning script. Explaining a stack trace you don't understand.
The images input is more useful here than it looks on paper. Screenshot the error, or the node graph, and ask about it - that's a vision-capable endpoint doing something a local checkpoint can't. In a generation pipeline, though, Codex has no role. It doesn't write prompts better than the GPT nodes, and it isn't cheaper. This is a node you install because you're doing maintenance, not because you're making images.
Mechanism
Nodes are generated at server startup from KIE's API documentation, so the class name is derived: KIE_Next_GPT_Codex_281af7a9 - slug plus an eight-character hash of the operation and model, which keeps it stable across pack releases.
These are direct-transport nodes - one HTTP call to the documented endpoint, one response - unlike the pack's image and video nodes, which submit a job and poll a status endpoint. One detail worth knowing for Codex specifically: the pack's HTTP client notes that Codex-style chat endpoints can answer with a server-sent event stream rather than a single JSON document, so the client normalises both shapes. That's why raw_json can look like a list of stream events instead of one response, and why a streamed answer can come back with the text split across lines - the extractor collects content chunks and joins them. If you want clean text, keep stream off.
The controls
prompt is required and multiline; for code, that's where the traceback or the file goes. system_prompt is where you scope it - "answer with the diff only" beats a chatty explanation when you're going to copy-paste the result.
reasoning_effort is low, medium, high or xhigh, defaulting to high. This is the one node in the pack where the high default is arguably correct: debugging a weird dependency error genuinely benefits from reasoning, and the failure mode of a shallow answer is another hour lost. Lower it for "explain this six-line function."
max_output_tokens spans 1 to 131072 with a default of 4096. For real code output, raise it - truncation is silent, and a half-file is worse than an error message.
images takes one optional IMAGE socket, uploaded and passed to the endpoint. web_search toggles KIE's web-search tool where supported - surprisingly handy when the answer lives in a forum thread about your exact error. tools_json accepts function definitions; history_json holds prior messages as JSON, and since the node has no memory between runs, multi-turn debugging means carrying the transcript yourself. expert_override_json merges raw JSON into the request for fields the pack doesn't expose.
Outputs
text is the answer - wire it to a text preview or a file writer rather than into an image pipeline. raw_json is the full response and the first thing to open when the text looks mangled. usage_json gives token accounting, and credits_consumed with credits_left reports the spend, both also shown as a receipt on the node after a successful run.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
pip install -r requirements.txt
Restart ComfyUI, then set your key once at Settings → KIE.ai Nodes Next → Connection → Paste / replace KIE.ai API key. The key is validated against KIE before it's saved and only a masked fingerprint is shown afterwards; KIE_API_KEY in the environment takes priority for headless installs. Dependencies are requests, Pillow, numpy, PyYAML. If Manager can't find the pack - the README describes Registry publication as "prepared" rather than done - install from a git clone or a ZIP in dist/.
Two notes
Don't paste secrets into it. A node that ships your text to a server is not where API keys, tokens or client data belong. Same rule you'd apply to any chat box.
It won't touch your files. Whatever fix it writes, you apply. There's a reason for that, and it isn't a limitation of the model.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | User prompt / message. | |
| system_promptopt | STRING | — | |
| streamopt | BOOLEAN | false | — |
| tools_jsonopt | STRING | [] | Optional function/tool definitions supported by this model endpoint. |
| history_jsonopt | STRING | [] | Optional prior message/input array as JSON. |
| imagesopt | IMAGE | — | |
| reasoning_effortopt | COMBO | high | 4 options: low, medium, high, xhigh |
| web_searchopt | BOOLEAN | false | Use KIE's web-search tool where this endpoint supports it. |
| max_output_tokensopt | INT | 40961–131072 | — |
| expert_override_jsonopt | STRING | {} | Expert-only request overrides. Normal use does not require this. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| raw_json | STRING | — |
| credits_consumed | FLOAT | — |
| usage_json | STRING | — |
| credits_left | FLOAT | — |