The reasoning parameter
To enable or disable reasoning, pass a reasoning parameter in the request body
of the chat completions API.
Some models reason by default and don’t require the reasoning parameter. Omit
the reasoning parameter in a request to see if the model returns reasoning by
default or not.
The chat completions API also accepts a
thinking parameter as an
alternative to reasoning. Use whichever format your client or model expects.Send a reasoning request
Here’s an example that shows how to send a request with reasoning enabled. Be sure to create an API key before you run it.Understand the response
When reasoning is enabled, thereasoning response field contains the model’s
chain-of-thought text. When reasoning is disabled or the model doesn’t support
it, reasoning is null. Some models return a reasoning_content field instead;
this is equivalent to reasoning and contains the same information.
The usage field in the response reports reasoning_tokens, which counts the
tokens used for chain-of-thought. This way, you know how many additional tokens
the model uses when reasoning is enabled. When reasoning is disabled or not
supported, the request returns 0 on this field.