Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee Submit To Oobabooga API With Key With THinkParse
ComfyUI Node

EmAySee Submit To Oobabooga API With Key With THinkParse

Chat API call that splits the model's reasoning out of its answer

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee Submit To Oobabooga API With Key With THinkParse
    • clean_text
    • thinking_content
    text
    api_urlhttp://10.0.0.71:5000/v1/chat/completions
    api_keysupersecretkey
    max_tokens500
    temperature0.70
    top_p0.90
    seed0
    system_promptYou are a helpful assistant.

    Modern reasoning models - the R1-style and QwQ-style families - don't just answer you; they think out loud first, typically inside <think>...</think> tags, then give the actual answer. If you're feeding that output into a CLIP Text Encode, the thinking trace is garbage. It's meta-commentary about solving the problem, not the answer. That's exactly what this node is built around: it makes a chat-style call to your local text-generation-webui, and it hands you the thinking and the answer as two separate string outputs, with the tags stripped out of the answer.

    The "Thinker" node is the lightweight member of this family. It does the chat/completions call (system prompt + user message), parses <think> blocks, and returns clean_text plus thinking_content. It deliberately skips the sampler kitchen sink - just max_tokens, temperature, top_p, and seed are exposed. If you want the full parameter panel (DRY repetition control, min_p, guidance scale, reasoning effort), that's the _WithThinkParse sibling; this one is the "just make the call and split it" version.

    How it works

    It POSTs to /v1/chat/completions with mode: "instruct", stream: false, and the standard OpenAI-style message array. On the way back it grabs choices[0].message.content, then:

    • finds <think>...</think> with a regex and pulls the contents into thinking_content;
    • removes the tags entirely from the reply, producing clean_text for your prompt.

    If the model emits no thinking tags, thinking_content comes back empty and clean_text is just the reply - so it degrades gracefully with non-reasoning models.

    The inputs that matter

    • text - your user message, force-input, usually wired from upstream.
    • api_url - change this. Default http://10.0.0.71:5000/v1/chat/completions is the author's LAN address.
    • api_key - default "supersecretkey", which is the author's placeholder, not a real secret. Put your actual key here.
    • system_prompt (optional) - default "You are a helpful assistant."; for prompt-expansion work you'll want something like "Expand this into a detailed image prompt."
    • max_tokens (default 500), temperature (0.7), top_p (0.9), seed (default 0) - the only sampling knobs.

    Outputs: clean_text → your prompt encoder; thinking_content → a text preview/display node if you're curious what the model was mulling.

    Installing it

    Pack standard: ComfyUI_EmAySee_CustomNodes via Manager, or git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes into custom_nodes/, restart. No extra dependencies; requests ships with ComfyUI.

    Where people get burned

    The default api_key of supersecretkey is a tell - it's the author's test box, not a configuration anyone else should run. If your server expects a real key, the call 401s and you get an error string back in clean_text. Also worth knowing: this node needs a text-generation-webui server running the chat/completions endpoint with a reasoning-capable model loaded for the thinking output to be meaningful. And if you see the model's entire reply (thinking included) dumped into clean_text, your server version may be returning reasoning in a field this node doesn't parse - the tag-splitting only works on models that actually emit <think> tags inline.

    CategoryEmAySee/API

    Inputs (8)

    NameTypeDefaultDescription
    textSTRING
    api_urlSTRINGhttp://10.0.0.71:5000/v1/chat/completions
    api_keySTRINGsupersecretkey
    max_tokensINT5001–8192
    temperatureFLOAT0.700.1–2
    top_pFLOAT0.900–1
    seedINT00–18446744073709550000
    system_promptoptSTRINGYou are a helpful assistant.

    Outputs (2)

    NameTypeDescription
    clean_textSTRING
    thinking_contentSTRING