ComfyUI Node

Codex API

An image-aware reasoning model with web search

By felipederosilva·Created 2 months ago·Updated 5 days ago· 3
Codex API
  • images
  • text
  • raw_json
  • credits_consumed
  • usage_json
  • credits_left
◄prompt►
◄system_prompt►
◄streamfalse►
◄tools_json[]►
◄history_json[]►
◄reasoning_efforthigh►
◄web_searchfalse►
◄max_output_tokens4096►
◄expert_override_json{}►

Most LLM nodes in this pack are text in, text out. Codex API is the one you reach for when the text step needs to look at something - it has a real IMAGE socket, a reasoning-effort dial, and an optional web search tool, all mapped onto KIE's OpenAI-compatible responses endpoint. That combination makes it the interesting node in the LLM folder, and also the easiest one to waste money with.

The job it's genuinely good at: you've got a render and you want a caption, a critique, or a prompt that would reproduce it. Or you've got a broken graph and you want a diagnosis. Or you want a JSON object back that a downstream node can parse, with enough reasoning behind it to get the schema right first time.

What's happening under the hood

The node posts to /codex/v1/responses - OpenAI's responses-style API surface rather than chat completions, which matters for what the fields mean. Your prompt is packaged as an input_text content item; anything connected to images is uploaded first (re-encoded to PNG, sent to KIE's file host) and attached as input_image items, alongside your history_json items. system_prompt becomes the request's instructions, reasoning_effort becomes reasoning.effort, max_output_tokens caps the reply, and web_search injects KIE's web-search tool. Then the returned text is scraped out of the response and handed over as text.

Note the practical consequence: your image is not staying local. It goes up to KIE and then to the model. That's the deal with every node in this folder, but it's worth saying out loud when the socket is literally called images.

Inputs that matter

  • prompt - required. State the job and the output shape in the same breath: "Describe this image in one 40-word prompt suitable for an SDXL checkpoint. No preamble."
  • images - the differentiator. One image socket; feed it a batch and it's attached as multiple image inputs.
  • reasoning_effort - low, medium, high (default), xhigh. This is your cost dial. high on a routine caption job is money set on fire; low handles "describe what you see" fine. Save xhigh for schema-heavy output.
  • web_search - off. Turn it on when the answer needs current information; it is mutually exclusive with a custom tools_json payload, since either one claims the tools slot.
  • max_output_tokens - 4096 default, 131072 ceiling. Raise it if structured output gets cut off.
  • system_prompt - goes in as instructions. Same advice as ever: this is where the format contract lives.
  • history_json, tools_json, stream, expert_override_json - plumbing. Streaming buys you nothing here; the node returns one finished string either way.

Outputs: text, raw_json, usage_json, credits_consumed, credits_left.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
cd ComfyUI-KIE-Nodes-Next && pip install -r requirements.txt
# restart ComfyUI

Manager users: search "KIE.ai Nodes Next". Dependencies are requests, Pillow, numpy, PyYAML - no models to download and nothing to run on your GPU. Then paste your key once under Settings → KIE.ai Nodes Next → Connection; the pack verifies it against KIE before saving, keeps it out of workflow JSON, and deliberately does not read environment variables.

Where it bites

The pack validates locally before spending anything: empty prompt, invalid tools_json, invalid history_json, out-of-range token counts, an unknown reasoning level - all rejected before the request goes out. What it can't validate is whether the model will accept your image's dimensions or content; that's provider-side, and the errors come back with the provider's own wording.

If you're getting nothing at all, check that text is wired into something that executes. This node is not an output node, so a floating Codex node is skipped silently - no call, no cost, no clue.

And the taste call: this is a reasoning model, and the KB's read on reasoning models for prompt work is that they're mostly the wrong tool - you want small and obedient, not deep and deliberative. Use Codex when you actually want the thinking: classifying images, writing structured JSON, debugging a pipeline. For "make my prompt prettier", a local 8B is free.

CategoryKIE Next/LLM/OpenAI/Codex

Inputs (10)

NameTypeDefaultDescription
promptSTRINGUser prompt / message.
system_promptoptSTRING—
streamoptBOOLEANfalse—
tools_jsonoptSTRING[]Optional function/tool definitions supported by this model endpoint.
history_jsonoptSTRING[]Optional prior message/input array as JSON.
imagesoptIMAGE—
reasoning_effortoptCOMBOhigh4 options: low, medium, high, xhigh
web_searchoptBOOLEANfalseUse KIE's web-search tool where this endpoint supports it.
max_output_tokensoptINT40961–131072—
expert_override_jsonoptSTRING{}Expert-only request overrides. Normal use does not require this.

Outputs (5)

NameTypeDescription
textSTRING—
raw_jsonSTRING—
credits_consumedFLOAT—
usage_jsonSTRING—
credits_leftFLOAT—