AI Dictionary › Prompting
The max tokens parameter caps how many tokens the model can generate in a single response. It is a technical ceiling that guards against overly long output, controls cost and ensures predictable latency. Example: you set max_tokens = 150 for a short summary task; the model stops when it hits the limit, even mid-sentence if it has not finished. Note: max tokens does NOT instruct the model to be concise, it only truncates. For genuinely short answers you must also say so in the prompt ("summarise in at most 3 sentences").
Use it to make an application safe: avoid oversized responses, cap per-call spend, respect interface limits. Remember the limit adds to input tokens within the context window: a very long input leaves less room for output.
Il parametro max tokens fissa il numero massimo di token che il modello può generare in una singola risposta. È un tetto tecnico che protegge da output troppo lunghi, controlla i costi e garantisce tempi di risposta prevedibili. Esempio: imposti max_tokens = 150 per un compito di riassunto breve; il modello si ferma al raggiungimento del limite, anche a metà frase se non ha concluso prima. Attenzione: max tokens NON istruisce il modello a essere conciso, lo tronca soltanto. Per ottenere risposte davvero brevi devi anche dirlo nel prompt ("riassumi in massimo 3 frasi").
Usalo per mettere in sicurezza un'applicazione: evitare risposte fuori misura, contenere la spesa per chiamata, rispettare limiti di interfaccia. Ricorda che il limite si somma ai token dell'input dentro la finestra di contesto: input molto lungo lascia meno spazio all'output.
From our network
INDACO TMS — Transport Management for European Logistics
Shipment tracking, multi-carrier EDI and automated invoicing in one cloud platform. Invoices generated in under 10 seconds.
Visit indacotms.com →From the Agora Intelligence blog
📱 Download the Android app (beta) iOS coming soon
Say what you mean. Get what you need.
Grace Certified — the AI coach that trains and certifies your prompt engineering — by Agora Intelligence.