Skip to main content
Some models can generate a chain of thought before they respond. These models use this intermediate step to split a prompt into more manageable parts, test different approaches, and arrive at a conclusion with more rigor. This reasoning—sometimes called thinking—improves response quality, especially for complex tasks. However, it also increases the model’s token usage and its response times. Depending on the model, you may be able to control whether and how the model reasons. If the model supports it, Friendli Engine can also parse reasoning content for you, separating it from the rest of the response.

Reasoning Model Types

There are two types of reasoning models:
  • Controllable reasoning model: With a controllable reasoning model, you use a parameter to control whether the model reasons. If you turn reasoning on, the model generates a chain of thought before it responds. If you turn it off, the model responds without generating one. To learn more, see enable_thinking.
  • Always-on reasoning model: An always-on reasoning model always reasons, meaning it generates a chain of thought before every response. You can’t turn reasoning off.
By contrast, non-reasoning models can’t generate chains of thought, meaning they always respond without generating them.

Reasoning Parameters

With reasoning parameters, you can control whether and how a model reasons. You pass them as either chat template keyword arguments or request body parameters. How you pass each depends on the parameter. To learn more, see Control a Capability. Depending on the model, you can control reasoning with some or all of the following parameters: For specific examples, see Choose a Model, choose one, and open its Control Reasoning page.

enable_thinking

If the model is controllable, you can turn reasoning on and off by setting the enable_thinking parameter to true or false, respectively. It controls whether the model reasons before it generates a response. For complex tasks, where response quality matters, turn reasoning on. For simpler tasks, you can try turning it off to reduce token usage and response times. To turn reasoning on for a controllable reasoning model, such as zai-org/GLM-5.2, you can use the following code:

parse_reasoning

If the model supports it, you can turn parsing on and off by setting the parse_reasoning parameter to true or false, respectively. It controls whether Friendli Engine parses reasoning for you. Without parsing, Friendli Engine returns the model’s chain of thought alongside the rest of the response. Usually, the model separates the two with some kind of delimiter. Friendli Engine’s parser uses this delimiter to split the two. Without one, it can’t. If you turn parsing on, Friendli Engine returns reasoning in both reasoning and reasoning_content, separate from content. To turn parsing on, you can use the following code:

include_reasoning

If you turn parsing on, you can include or exclude reasoning by setting the include_reasoning parameter to true or false, respectively. It controls whether Friendli Engine includes reasoning in the response. If you need reasoning content (for example, to display to users), include it in the response. If you don’t, exclude it. Note that your choice doesn’t change the number of tokens the model uses to generate a response. You pay the same either way. To include reasoning, you can use the following code:

reasoning_effort

If the model supports it, you can choose the model’s reasoning effort by setting the reasoning_effort parameter to a value the model supports. It controls the model’s reasoning effort for each response. The greater the reasoning effort, the longer the chain of thought. On complex tasks, these longer chains of thought improve response quality. Note that a greater effort also increases token usage and response times. To set the reasoning effort to a supported value, such as high, you can use the following code:

reasoning_budget

If the model supports it, you can limit the model’s reasoning by setting the reasoning_budget parameter to an integer. It controls the model’s reasoning budget for each response. The reasoning budget is the maximum number of reasoning tokens the model can use to generate a response. When the model reaches the budget, it stops thinking—sometimes mid-thought. For this reason, choose a budget thoughtfully. To set the reasoning budget to 10,000 tokens, you can use the following code:

clear_thinking

If the model supports it, you can clear or preserve reasoning by setting the clear_thinking parameter to true or false, respectively. It controls whether reasoning is cleared from the model’s context window. If reasoning matters to your workflow or use case, preserve it in the model’s context window. Otherwise, clear it. Note that preserving reasoning increases token usage. To clear reasoning, you can use the following code:

API Reference

Look up operations and parameters:

Model APIs

Learn to use the API for a curated set of models available at usage-based pricing.

Dedicated Endpoints

Learn to use the API for any model you deploy on dedicated GPUs reserved for you.
Last modified on November 9, 2026