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

# Reasoning

Reasoning models (like OpenAI's `o3` and `o4` series) perform internal chain-of-thought processing before generating a final answer. The HasteKit SDK allows you to configure reasoning parameters and access these reasoning steps. Non-reasoning models (such as `gpt-4o`) do not emit reasoning summaries.

## Enabling Reasoning

To use reasoning features, you typically need to use a compatible model and configure the `Reasoning` parameters in your request.

The `ReasoningParam` struct supports the following fields:

* **`Summary`** (`*string`): Reasoning summary level: `"auto"`, `"concise"`, or `"detailed"`.
* **`Effort`** (`*string`): Reasoning effort level: `"none"`, `"low"`, `"medium"`, `"high"`, or `"xhigh"`.
* **`BudgetTokens`** (`*int`): Maximum tokens to allocate for reasoning steps. Used by Anthropic and Gemini; not used for OpenAI.

```go theme={null}
resp, err := model.NewResponses(ctx, &responses.Request{
    Input: responses.InputUnion{
        OfString: utils.Ptr("If 2+4=6, what would be 22+44=?"),
    },
    Parameters: responses.Parameters{
        Reasoning: &responses.ReasoningParam{
            Summary: utils.Ptr("detailed"),
            Effort:  utils.Ptr("medium"),
        },
		Include: []responses.Includable{
            responses.IncludableReasoningEncryptedContent,
        },
    },
})
```

### Reasoning Output

Reasoning steps are returned as distinct output items, separate from the final text response. You can access them like this:

```go theme={null}
resp, err := model.NewResponses(ctx, request)
if err != nil {
    panic(err)
}

for _, output := range resp.Output {
    if output.OfReasoning != nil {
        fmt.Println("Reasoning Steps:")
        for _, s := range output.OfReasoning.Summary {
            fmt.Printf("- %s\n", s.Text)
        }
    }
}
```

### Streaming Reasoning

When streaming, reasoning steps are emitted as chunks. You can detect when a reasoning item is completed.

```go theme={null}
acc := ""
for chunk := range stream {
    if chunk.ChunkType() == "response.reasoning_summary_text.delta" {
		acc += chunk.OfReasoningSummaryTextDelta.Delta
    }
}
```
