> ## Documentation Index
> Fetch the complete documentation index at: https://docs.naga.ac/llms.txt
> Use this file to discover all available pages before exploring further.

# Reasoning

> Compare reasoning-related output across Responses, Chat Completions, and Messages.

Reasoning refers to model behaviors that spend extra budget on problem solving and may expose that work through typed output. The exact request controls and visible output depend on the public API and model.

## Support Matrix

| API                | Request controls                       | Visible output                                                              | Notes                             |
| ------------------ | -------------------------------------- | --------------------------------------------------------------------------- | --------------------------------- |
| `Responses`        | `reasoning.effort`                     | `reasoning` items in `output[]` and reasoning stream events                 | Best starting point for new work  |
| `Chat Completions` | `reasoning_effort` on supported models | assistant message fields such as `reasoning_details` or `reasoning_content` | Use for OpenAI chat compatibility |
| `Messages`         | `thinking` and `output_config.effort`  | Anthropic thinking blocks and thinking events                               | Use for Anthropic compatibility   |

## Reasoning Effort

When reasoning effort is supported, the normalized values used in the docs are:

* `none`
* `minimal`
* `low`
* `medium`
* `high`
* `xhigh`

Higher effort usually increases latency and cost. Start low, then raise it only when the extra quality is worth it.

<Note>
  In `Messages`, `output_config` is a reasoning control, not a generic
  structured-output feature.
</Note>

## When To Use It

* hard planning or decomposition tasks
* agent workflows that need stronger tool selection and longer deliberation
* tasks where quality matters more than minimal latency

## Recommended Example

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.naga.ac/v1",
      api_key="YOUR_API_KEY",
  )

  response = client.responses.create(
      model="gpt-5",
      input="Explain the likely root cause of a slow PostgreSQL query and suggest the first two checks.",
      reasoning={"effort": "medium"},
  )

  print(response.output)
  ```

  ```javascript Node.js theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    baseURL: 'https://api.naga.ac/v1',
    apiKey: 'YOUR_API_KEY',
  });

  const response = await client.responses.create({
    model: 'gpt-5',
    input: 'Explain the likely root cause of a slow PostgreSQL query and suggest the first two checks.',
    reasoning: { effort: 'medium' },
  });

  console.log(response.output);
  ```

  ```bash cURL theme={null}
  curl https://api.naga.ac/v1/responses \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5",
      "input": "Explain the likely root cause of a slow PostgreSQL query and suggest the first two checks.",
      "reasoning": {
        "effort": "medium"
      }
    }'
  ```
</CodeGroup>

On `Responses`, visible reasoning can arrive as `reasoning` items before or alongside message items. On `Chat Completions` and `Messages`, it appears in protocol-specific fields and blocks instead.

## Preserving Reasoning Across Turns

If a model pauses for tool use and you continue the conversation in another request, preserve any reasoning payload from that assistant turn unchanged.

* `Responses`: replay the prior `reasoning` item unchanged in the next `input[]` turn if you want to preserve reasoning continuity
* `Chat Completions`: if an assistant turn includes `reasoning_details`, send those details back unchanged with that assistant message when you append the later `role: tool` result
* `Messages`: if an assistant turn includes `thinking` blocks, replay those blocks unchanged, including any `signature`, before the later `tool_result` block

Changing or dropping encrypted reasoning/signature data can break reasoning continuity across turns.

## Related Docs

* [Responses Reasoning](/api/responses/reasoning)
* [Chat Completions Reasoning](/api/chat-completions/reasoning)
* [Messages Thinking Blocks](/api/messages/thinking-blocks)
* [Tool Calling](/build/tool-calling)
