Stepthrough Start free

What does max tokens mean in AI?

Quick answer

Max tokens is a setting that limits how many tokens, roughly pieces of words, a model may write in one answer. It is a hard stop: when the limit is reached, the answer simply ends, even mid-sentence. It is mainly used in APIs and automation tools to control length and cost.

Last updated

Take the free module →Module 11 of the free n8n Jump Start course, about 11 minutes. No account needed.

Updated · By Robert Breen

Why it matters for a small business

Output tokens are usually the most expensive part of an AI call, so a cap protects you from a runaway answer in an automation that runs hundreds of times a day. It also keeps replies to a predictable size for a text message or a sheet cell.

The catch is that the model doesn't plan around the cap. If you need a short answer, say so in the prompt ("under 80 words"); use max tokens as a safety limit above that, not as the way to make answers short. Reasoning models may also count their thinking toward the limit, so a tight cap can leave no room for the answer.

In a real lesson: n8n AI Agent with Tools: Check Google Calendar, Book It and Log It

In n8n AI Agent with Tools, the Maple Street Dog Grooming booking agent already has an OpenAI Chat Model attached. The lesson doesn't change its options, but that node is where max tokens lives in n8n: under its options you can add Maximum Number of Tokens.

For a booking confirmation, a cap well above the expected reply keeps a stray long answer from costing more, while the system message does the real work of keeping replies short. The lesson's closing checklist reminds you that each test message uses AI credits, which is the cost the cap protects.

n8n AI Agent node with a system message for a dog grooming booking assistant and opening hours
n8n AI Agent node with a system message for a dog grooming booking assistant and opening hours

Try this lesson free or read the step-by-step guide.

Common confusions

Max tokens vs context window

The context window is the total the model can handle, input plus output. Max tokens limits only the output of one answer.

Max tokens vs a word limit in the prompt

A word limit in the prompt asks the model to plan a short answer. Max tokens cuts it off without warning.

Tips

  • Ask for the length you want in the prompt; set max tokens as a ceiling above it.
  • If answers end mid-sentence, the cap is too low.
  • Leave extra room when you use a reasoning model.

More AI basics terms

Where you use it: free lessons

Frequently asked questions

How many words is 1,000 tokens?
For English text, OpenAI's rule of thumb is that one token is about three quarters of a word, so 1,000 tokens is roughly 750 words.
Can I set max tokens in ChatGPT?
Not in the normal chat app. It is a setting in the API and in tools that call it, like n8n, Make or Zapier.
What happens if max tokens is too high?
Usually nothing bad: the model stops when the answer is done. A high cap only matters if a prompt invites a very long answer.

All AI glossary terms, A to Z · Free prompt templates