Nodes/NInfer API/NInfer - Max Tokens
ComfyUI Node

NInfer - Max Tokens

Why your reply came back empty

By kaerozhi·Created 22 days ago·Updated 22 days ago· 1
NInfer - Max Tokens
  • other_options
  • Options
◄max_tokens2048►

This node has the highest ratio of "trivial widget, real consequences" in the whole pack. It sets an upper bound on generated tokens, and if you get it wrong the Chat node returns an empty Response with no error at all.

The reason is the model. Qwen3.8-27B thinks before it answers - that's a default, not a mode you turn on - and the hidden reasoning tokens come out of the same budget as the visible ones. Set max_tokens small and the whole allowance can disappear into thinking, leaving you nothing but a full Reasoning output and a blank Response. If you take one thing from this page: an empty reply almost always means "raise the budget", not "the node is broken".

You can actually watch it happen. The Chat node prints a usage preview into its own body - prompt tokens, cached tokens, completion tokens, and how many of those were reasoning. Empty reply plus a completion count that equals your ceiling is the signature.

Inputs and output

  • Max Tokens - integer, 1 to 32768, step 64, default 2048.
  • Options - the usual merge, in and out. Drop it into the chain anywhere; the node writes max_tokens and passes everything else through.

That's the whole node.

Picking a number

The pack's default of 2048 is a reasonable starting point for a single thinking turn, and 4096 is where I'd start for anything that has to produce a structured block of text with any length to it. Doubling it costs you nothing when the model stops early on its own - max_tokens is a ceiling, not a target, and there's no penalty for having room you don't use.

The one number you can't ignore: the server this pack drives is started with a 16384-token context, and each 512px reference image on the Chat node eats roughly 256 prompt tokens before the model has said anything. Four images is about a thousand tokens gone. So your ceiling is not really 32768 - it's whatever's left of the context after your prompt and images, and the practical outcome of setting max_tokens to the maximum is "generate until the context runs out", not "generate 32k tokens".

Guidance, briefly: prompt enhancement and simple rewrites, 1024–2048 is plenty. Multi-step reasoning or long structured output, 4096+ and expect to wait. Anything where you find yourself at the top of the range is usually better solved by lowering Reasoning Effort than by raising the ceiling - thinking tokens are bought at the same price as answer tokens, and you're paying in time as well as context.

Where people get burned

Empty Response, full Reasoning. Covered above; this is the pack's most-reported paper cut and it isn't a bug.

Timeouts. A large ceiling on a slow 27B on a shared 24 GB card is minutes of wall clock. The Client node's default timeout is 900 seconds for exactly this reason - lower it and you'll cut long generations off mid-sentence with nothing useful in the error.

The cached-answer trap. All of this only means anything if the Chat node actually calls the model. With Force Regen off, re-running an otherwise-unchanged graph returns the previous result, so you can crank Max Tokens to something huge and see no change whatsoever. Turn Force Regen on while you're tuning, and back off once the settings are good.

Thinking models aren't the tool for everything. If your job is "rewrite this idea into a well-structured prompt", the community's verdict on chain-of-thought models is unkind and correct - the job wants small and obedient, and a reasoner spends your budget deliberating. Here the deliberation is at least channel-split into the Reasoning output rather than leaking into your text, which is more than most nodes manage. Lower the effort, keep the budget, move on.

CategoryNInfer/Options

Inputs (2)

NameTypeDefaultDescription
max_tokensINT20481–32768—
other_optionsoptNINFER_OPTIONSOptions from the previous settings node

Outputs (1)

NameTypeDescription
OptionsNINFER_OPTIONSMerged settings