# Reasoning
Control how much a model thinks with the same options on every provider.

## Choose a reasoning model
Models that reason list `reasoning` in `supported_parameters`. The catalog's `reasoning` object shows the efforts the model serves (`supported_efforts`, highest first), its default (`default_effort`, `default_enabled`) and whether reasoning can be switched off (`mandatory`).

## Set the effort
`reasoning.effort`, or its shorthand `reasoning_effort`, accepts `none`, `minimal`, `low`, `medium`, `high`, `xhigh` and `max`. Curated routes map these choices to their native controls. If a route does not offer a requested level, the gateway uses the nearest offered level; a tie rounds up. Routes that offer the effort exactly are tried first. `provider.require_parameters: true` does not turn discrete levels into exact token budgets or require an exact match for every nonzero effort. Without a reasoning choice, the curated model default applies. `GET /v1/generation` reports the mapped effort as `reasoning_effort` where available.

### Budget or hard limit?
On routes with a curated effort mapping, `reasoning.max_tokens` is an approximate effort selector, not a hard reasoning-token limit. The selector compares the budget with shares of the effective total-output limit: `xhigh` 95 %, `high` 80 %, `medium` 50 %, `low` 20 %, `minimal` 10 %. It selects the highest share that fits, then maps to the nearest offered level. Even a small positive budget can select the lowest nonzero level. With both valid `max_tokens` and `max_completion_tokens`, the smaller limit is used; otherwise the route's declared output limit is used. Without either, selection uses the nonzero default or the lowest level. A budget of zero without an effort requests off.

For example, with a total-output limit of 1000 and a budget of 800, a route offering only low and high selects high. This does not promise at most 800 reasoning tokens or reserve 200 tokens for visible text. A non-null effort takes precedence over the budget.

Legacy numeric mappings may forward a budget rather than select an effort. Forwarding alone is not evidence that the provider enforces a hard reasoning-token cap. Numeric forwarding requires a declared route output or context bound; a larger numeric budget is rejected. These admission bounds are not an additional reasoning allowance. Use the route's documented contract rather than inferring a guarantee from an accepted request.

### curl

```curl
curl --request POST \
  --url 'https://api.tokenlane.de/v1/chat/completions' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "deepseek/deepseek-v4-flash-0731",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "max_tokens": 400,
  "reasoning": {
    "effort": "low"
  },
  "provider": {
    "require_parameters": true
  }
}'
```

### node

```node
import OpenAI from 'openai';

const client = new OpenAI({ baseURL: "https://api.tokenlane.de/v1", apiKey: process.env.TOKENLANE_API_KEY });
const response = await client.chat.completions.create({
  "model": "deepseek/deepseek-v4-flash-0731",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "max_tokens": 400,
  "reasoning": {
    "effort": "low"
  },
  "provider": {
    "require_parameters": true
  }
}, {});
console.log(response);
```

### python

```python
import os
import json
from openai import OpenAI

client = OpenAI(base_url="https://api.tokenlane.de/v1", api_key=os.environ["TOKENLANE_API_KEY"])
body = json.loads(r'''{
  "model": "deepseek/deepseek-v4-flash-0731",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "max_tokens": 400,
  "reasoning": {
    "effort": "low"
  },
  "provider": {
    "require_parameters": true
  }
}''')
response = client.chat.completions.create(
    model=body["model"],
    messages=body["messages"],
    max_tokens=body["max_tokens"],
    extra_body=json.loads(r'''{
  "reasoning": {
    "effort": "low"
  },
  "provider": {
    "require_parameters": true
  }
}''')
)
print(response)
```

### vercel

```vercel
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { generateText } from 'ai';

const tokenlane = createOpenAICompatible({ name: 'tokenlane', baseURL: "https://api.tokenlane.de/v1", apiKey: process.env.TOKENLANE_API_KEY, includeUsage: true });
const result = await generateText({
  model: tokenlane("deepseek/deepseek-v4-flash-0731"),
  messages: [
  {
    "role": "user",
    "content": "Hello"
  }
],
  maxOutputTokens: 400,
  providerOptions: { tokenlane: {
  "reasoning": {
    "effort": "low"
  },
  "provider": {
    "require_parameters": true
  }
} },
});
console.log(result.text);
```

## Switch reasoning off
`reasoning.effort: "none"` or `reasoning.enabled: false` requests that reasoning computation stop. To require this rather than accept a best effort, also set `provider.require_parameters: true`:

```json
{
  "reasoning": { "enabled": false },
  "provider": { "require_parameters": true }
}
```

The gateway then excludes routes without a curated off mapping, or whose effective adapter parameters do not preserve it, before calling a provider. A different suitable route may be used, but organization, workspace, key, data-protection and price restrictions still apply. If no route fits, the response is `404 no_endpoint` without an upstream call. The catalog's model-level efforts combine routes; they do not prove that a pinned provider can switch off. Plain forwarding of `enabled: false` is not an off guarantee.

Without strict parameter requirements, existing best-effort behavior remains: mandatory-reasoning routes use their lowest level and hide reasoning from the response. `x-ignored-params` names the unfulfilled off control. Hidden reasoning can still be computed and billed, including when `reasoning_tokens` is missing. This is not equivalent to a strict off request.

To hide reasoning while allowing computation, use `reasoning.exclude: true` (or the legacy `include_reasoning: false`). This is a response-only setting, also with strict parameter requirements. It does not prevent reasoning costs. Confirmed usage and accounting are not reduced merely because reasoning is hidden.

Contradictory options (`enabled: false` with a non-none effort, `enabled: true` with `none`, or different effort aliases) are rejected with 400 and the field path.

## Efforts per model
| Model | Efforts served | Default | Can be switched off |
|---|---|---|---|
| `deepseek/deepseek-v4-pro-0813` | max, xhigh (Lyceum), high, medium, low | low | yes, on Lyceum; TensorX always reasons |
| `deepseek/deepseek-v4.1-flash-1017` | max, high, medium (Lyceum), low | low | yes, on Lyceum; TensorX always reasons |
| `minimax/minimax-m3` | on or off only | on | yes |
| `mistralai/mistral-large-4-0` | off only for now | off | always off |
| `moonshotai/kimi-k2.7-code` | always on, no levels | on | no |
| `openai/gpt-oss-120b` | high, medium, low | low | no |
| `qwen/qwen3.5-397b-a17b`, `qwen/qwen3.5-9b` | on or off only | off | yes |
| `qwen/qwen3.8-27b`, `qwen/qwen3.8-flash-next` | xhigh, medium, low | low | yes |
| `z-ai/glm-5.3`, `z-ai/glm-5.3-flash` | max (Grunden), high, low | low | no |

## Read only what is returned
Providers can return reasoning separately from the final answer, omit it, or report only its tokens. `reasoning.exclude` removes reasoning from the response; it does not stop computation or billing. Visible reasoning is not a complete account of the model's internal process.

## Avoid answers without content
Reasoning counts towards `max_tokens`. If it uses the whole limit, the answer ends with `finish_reason: length` and no content. Choose a suitable total-output limit and a lower effort, or use strict off on a supporting route. An approximate `reasoning.max_tokens` mapping cannot guarantee room for the answer. Unsetting the limit is not a spending cap.