OpenAI API - Extra Body
Send any API parameter, no new node required
- other_options
- Options
The pack ships dedicated nodes for the common knobs - temperature, top_p, penalties, max tokens - but the OpenAI API has more parameters than any node pack could reasonably keep up with, and every OpenAI-compatible server adds its own extras. OAIAPI_ExtraBody is the escape hatch: paste any JSON key/value pairs you want, and they get merged into the request. It's the node that keeps this pack small (KISS is the author's explicit design goal), because instead of shipping one node per parameter, it ships one node for all the parameters you didn't think of.
How it works
You type JSON into a multiline box, the node validates that it's a proper JSON object (a dictionary, not an array or a bare number - it'll refuse otherwise), and packs it into the OAIAPI_OPTIONS payload. When the Chat Completion node gets the request ready, anything you put here that isn't one of the standard named parameters (seed, temperature, max_tokens, top_p, the penalties, the developer flag) gets passed through as the request's extra_body. That's how you reach server-specific settings the pack has no opinion about - repetition_penalty for Ollama, min_p, stop sequences, whatever your server documents.
The default content is {"repetition_penalty": 0.5, "seed": 42}, which doubles as a template and a decent starting point for Ollama. One subtlety worth knowing: because seed is a standard parameter, the seed inside your extra body gets extracted and applied as the real seed - it's not blindly forwarded. The rest sails through as extra body.
The inputs and output
- extra_body - a multiline JSON object. That's the entire interface. Keep it valid JSON or the node refuses to run, which is a kindness.
- other_options (optional) - chain point for other option nodes; values here override whatever came in on the merge chain.
- Output: Options (
OAIAPI_OPTIONS), feeding the next option node or Chat Completion'soptionsinput.
Installing it
One of the ten nodes in comfyui-openai-api, so the usual: ComfyUI Manager → search "OpenAI API" → install, or
cd ComfyUI/custom_nodes
git clone https://github.com/hekmon/comfyui-openai-api
restart. Only openai as a new dependency; no downloads.
Where people get burned
Invalid JSON is the #1 failure - trailing commas, unquoted keys, a stray quote, and the node just refuses with a JSON decode error. The second is expecting keys to be honored verbatim: standard parameters get pulled out and applied as named arguments, so if your server treats them differently, that's not this node's doing. And the classic gotcha with anything that mentions seed - if you put seed in extra body and wire a Seed node in, whichever option node is last in the chain wins, since later nodes overwrite earlier keys. For the one-off parameter you need once and never again, this is the node you reach for instead of filing a feature request.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| extra_body | STRING | { "repetition_penalty": 0.5, "seed": 42 } | Extra body content to include in the request |
| other_optionsopt | OAIAPI_OPTIONS | Others options to merge with |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Options | OAIAPI_OPTIONS | Merged options to forward |