Overview

Top-p (nucleus sampling) limits sampling at each step to the smallest set of most likely tokens whose probabilities add up to p, then renormalizes and samples within that set. At top_p=0.9, the long tail of unlikely tokens is cut off; top_p=1.0 disables the filter.

It has the same availability limits as temperature. On Claude models released after Opus 4.6 (Opus 4.7 and later, Sonnet 5 and 5.5, Haiku 5.5, Fable 5 and 5.1), the API accepts top_p only at 0.99 or higher and returns a 400 for lower values; on Haiku 5.5 it must be exactly 0.99, and 1.0 or a request that also sets temperature returns 400. It is still accepted in full on Opus 4.6, Sonnet 4.6, the previous-generation Haiku 4.5, and older models. OpenAI’s GPT-6 guide says to remove it whenever reasoning effort is not none.

Where it is accepted, leave it at the default unless output shows odd rare-word choices, then lower it slightly. Tune either top-p or temperature, not both, so you can tell which change helped. Neither makes output deterministic.