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

# Reasoning

> Use extended thinking models for hard problems that require deeper deliberation.

Reasoning models spend additional compute "thinking through" a problem before producing a response. This extended deliberation makes them significantly better at complex tasks like multi-step math, code debugging, strategic planning, and hard classification problems where a direct answer is often wrong.

> [!NOTE]
>
> Reasoning models supported through Routeway include **GPT 5.4**, **Claude Opus 4.8**, **DeepSeek V4**, and more. Check the [Models](https://docs.routeway.ai/getting-started/models.md) page for the current list.

***

## Enabling Reasoning

By default, Routeway **disables reasoning** for models. There are two ways to enable it:

### Option 1: Model Suffix

Append `:thinking` to the end of the model ID to enable reasoning with the default effort level.

```python theme={null}
response = client.chat.completions.create(
    model="claude-opus-4-5:thinking",
    messages=[{"role": "user", "content": "Solve this step by step..."}]
)
```

You can also specify the effort level directly in the suffix using `:high`, `:medium`, or `:low`:

```python theme={null}
# High effort reasoning
response = client.chat.completions.create(
    model="o4-mini:thinking:high",
    messages=[{"role": "user", "content": "Prove that there are infinitely many primes."}]
)

# Low effort reasoning
response = client.chat.completions.create(
    model="o4-mini:thinking:low",
    messages=[{"role": "user", "content": "What is 2 + 2?"}]
)
```

### Option 2: `reasoning_effort` Parameter

Pass the `reasoning_effort` parameter in the request body to enable reasoning and control the effort level:

```python theme={null}
response = client.chat.completions.create(
    model="o4-mini",
    messages=[{"role": "user", "content": "Explain the Riemann hypothesis."}],
    reasoning_effort="high"
)
```

> [!TIP]
>
> Both approaches achieve the same result. The model suffix is convenient for quick testing or when there is no way to change reasoning level via UI, while `reasoning_effort` gives you programmatic control without changing the model ID.

***

## When to Use Reasoning Models

> [card] Use reasoning for
>
> * Multi-step math or logic puzzles
> * Debugging complex code
> * Long-horizon planning and strategy
> * Hard classification with many edge cases
> * Tasks where chain-of-thought improves accuracy

> [card] Skip reasoning for
>
> * Simple Q\&A or retrieval
> * Short creative tasks
> * High-throughput, latency-sensitive pipelines
> * Tasks where standard models already perform well

***

## Controlling Reasoning Effort

You can control reasoning effort using the `reasoning_effort` parameter.

| Value | Behavior | Best for |
| - | - | - |
| `"low"` | Minimal reasoning, fastest | Simple tasks, cost-sensitive |
| `"medium"` | Balanced (default) | Most production use cases |
| `"high"` | Deep reasoning, slowest | Hard math, complex code, critical decisions |
| `"none"` | No reasoning, fastest | Simple Q\&A or retrieval |

> [tab] Python
>
> ```python theme={null}
> import os
> from openai import OpenAI
>
> client = OpenAI(
>     base_url="https://api.routeway.ai/v1",
>     api_key=os.getenv("ROUTEWAY_API_KEY")
> )
>
> response = client.chat.completions.create(
>     model="o4-mini",
>     messages=[
>         {
>             "role": "user",
>             "content": "A farmer has 17 sheep. All but 9 run away. How many sheep does the farmer have left? Show your reasoning."
>         }
>     ],
>     reasoning_effort="medium",
> )
>
> print(response.choices[0].message.content)
> ```

> [tab] Node.js
>
> ```javascript theme={null}
> import OpenAI from "openai";
>
> const client = new OpenAI({
>   baseURL: "https://api.routeway.ai/v1",
>   apiKey: process.env.ROUTEWAY_API_KEY,
> });
>
> async function main() {
>   const response = await client.chat.completions.create({
>     model: "o4-mini",
>     messages: [
>       {
>         role: "user",
>         content:
>           "A farmer has 17 sheep. All but 9 run away. How many sheep does the farmer have left? Show your reasoning.",
>       },
>     ],
>     reasoning_effort: "medium",
>   });
>
>   console.log(response.choices[0].message.content);
> }
>
> main().catch(console.error);
> ```

> [tab] cURL
>
> ```bash theme={null}
> curl https://api.routeway.ai/v1/chat/completions \
>   -H "Authorization: Bearer $ROUTEWAY_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "model": "o4-mini",
>     "messages": [
>       {
>         "role": "user",
>         "content": "A farmer has 17 sheep. All but 9 run away. How many does he have left?"
>       }
>     ],
>     "reasoning_effort": "medium"
>   }'
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.