Skip to main content

Step by Step, Built In

In the last lesson, you asked the AI to think step by step, and it got better answers by working through the problem out loud. Many newer models do this on their own. Before they write a single word of the answer, they work through the problem: breaking it into parts, trying an approach, checking it, and sometimes starting over. This is called reasoning, or thinking; they’re the same idea. You don’t ask for it in your prompt; you choose how much effort the model puts in, from a quick answer to a long, careful one.

Core Concepts

What Reasoning Is

Think of reasoning as a scratch pad the model fills in before it speaks. You control the size of that scratch pad with an effort setting. Low effort means a short think and a fast answer. High effort means the model takes longer, considers more, and checks its work more carefully. Many models also let you see a summary of their reasoning, so you can follow how they reached the answer.

Built In vs. Asked For

Here’s how reasoning compares with the “think step by step” technique from Lesson 7: Use step-by-step prompting when you want the steps in the answer (so a reader can follow a calculation) or want the model to follow a structure you’ve laid out. Use reasoning when you want the model to think hard but give you a clean, finished answer. They combine well. The effort controls how much the model thinks; your prompt still guides what it thinks about, so everything from earlier lessons about context and clear instructions still applies.

When More Effort Is Worth It

Turn effort up for:
  • Multi-step problems where one early mistake ruins the answer
  • Math, scheduling, and anything with numbers that must add up
  • Planning, where the model needs to weigh options and trade-offs
  • Writing or reviewing code
Keep effort low (or off) for:
  • Simple lookups and factual questions
  • Friendly back-and-forth chat
  • Anything where speed matters most, like a live chat window
There’s a trade-off. Reasoning is billed as output tokens (the small pieces of text a model writes, covered in Lesson 2), the same as the words in the answer, whether or not you see the reasoning. More effort means more tokens, a higher cost per request, and a longer wait. Match the effort to the task, just as you learned to match the technique to the task in Lesson 7. Controlling Cost shows how to keep reasoning tokens in check.

Reasoning and Thinking on Gloo

Gloo’s Chat Completions and Responses endpoints call it reasoning. The same settings, reasoning_effort and the reasoning object, work across model families, including Claude 5, Gemini, OpenAI and open-weight models, so you ask for reasoning the same way whichever model you call. The Anthropic Messages endpoint is for code written for the Anthropic SDK. It uses Claude’s own thinking settings, thinking and output_config.effort, instead.

Get Started

You’ll need a Gloo API key. Get one from the API Keys page in Gloo AI Studio and set it as GLOO_API_KEY.

Set the effort

Add reasoning_effort to a Chat Completions request. Effort levels run from none (no reasoning, on models that can turn it off) through minimal, low, medium and high up to xhigh and max. Each model accepts some of these levels; the model catalog lists which. A level the model doesn’t list may not be applied as asked; the Reasoning guide explains what happens. Claude Sonnet 5.5, used below, takes low to max.

Read the reasoning

The reasoning comes back in choices[0].message.reasoning_content, next to the answer in content:
On the Responses endpoint, add "summary": "auto" to the reasoning object to get the reasoning back. It arrives as a reasoning item in output[], before the answer, and usage.output_tokens_details.reasoning_tokens shows how many of the output tokens were reasoning, where the model reports it:
On Chat Completions, the same count is in usage.completion_tokens_details.reasoning_tokens, where the model reports it.

Using the Anthropic SDK

On Anthropic Messages, use Claude’s thinking settings. Set display: "summarized" to see the thinking, and output_config.effort to set how much Claude puts in:
The thinking comes back as thinking blocks before the text block.

Good to know

  • Reasoning is optional in the response. Some models, including Claude 5 models, decide how much each request needs and can skip reasoning on easy questions. Read the reasoning if it’s there, and don’t depend on it.
  • Leave room in your output limit. Reasoning counts toward max_tokens (max_output_tokens on Responses), and both are billed as output. A high effort with a small limit can use up the limit before the answer starts. For a short answer, 8,192 tokens is a good start; Set your output limit for reasoning models has a sizing table and the fix for a cut-off answer.
  • Many models reason by default. With no setting, each model does what it normally does, and some reason anyway. The reasoning guide lists the defaults.

Key Takeaway

Reasoning models do their “step by step” thinking before they answer, and you decide how much. Match the effort to the task, combine it with clear prompts, and remember that every bit of thinking is billed as output tokens.

Learn more

  • Reasoning: every setting, effort level and response field on the Chat Completions and Responses endpoints
  • Anthropic Messages: Thinking: Claude’s thinking and output_config.effort settings for the Anthropic SDKs
  • Supported Models: which models reason, and the effort levels each one takes

What’s next

When you’re ready to continue the course, you’ll learn to build on AI’s responses and turn good prompts into great outcomes. To build with reasoning models, try the Control reasoning effort tutorial and read Reasoning Models in Production.

Lesson 9: The Art of Iteration

Refine, clarify and redirect with follow-up prompts, and know when to iterate and when to start fresh.