Skip to content
Docs

Guides

Reasoning

Every model on Libremodel thinks before it answers. You can read the thinking and choose how much of it to spend.

Thinking and effort

The thinking comes back in choices[0].message.reasoning_content and the answer in choices[0].message.content. Set reasoning_effort to one of the model's levels: low, high or max, and off on the models that can stop thinking. Without an effort, every model runs at high. Any OpenAI or Anthropic level works too and is matched to the closest level the model has: minimal runs as low, medium as high and xhigh as max. none (or off) turns thinking off on the models that list off; on the others it runs at the lowest level.

Python
response = client.chat.completions.create(
    model="deepseek-v4.1-flash-1017",
    messages=[{"role": "user", "content": "Plan a 3-day trip to Kyoto."}],
    reasoning_effort="high",  # "low", "high", "max" (or "off" where the model has it)
)

message = response.choices[0].message
print(getattr(message, "reasoning_content", None))  # the model's thinking
print(message.content)                              # the final answer

Leave room in max_tokens

Thinking counts toward max_tokens. If it runs out, the reply has no text and finish_reason is length. Set the limit well above the answer you expect, and more so at max.

With tool calls

Send the assistant message back unchanged, including reasoning_content and tool_calls, followed by the tool results. See Tool calling.

Every API format

APISet effortThinking comes back in
Chat Completionsreasoning_effortmessage.reasoning_content
Responsesreasoning.effortA reasoning output item
Anthropic Messagesoutput_config.effortthinking blocks

Without an effort, Chat Completions and Responses run at high. In Anthropic Messages, turn thinking on and set output_config.effort (low, medium, high, xhigh or max, matched to the model's levels); with thinking on and neither output_config.effort nor budget_tokens, it runs at high. thinking with type: "disabled" turns it off on the models that list off.

It works the same in the three API formats. See Anthropic and Responses APIs.