> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/guardrails/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/guardrails/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/guardrails/_mcp/server.

# nemoguardrails.llm.openai_reasoning

## Module Contents

### Functions

| Name                                                                                                        | Description                                                                |
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`apply_openai_reasoning_overrides`](#nemoguardrails-llm-openai_reasoning-apply_openai_reasoning_overrides) | Drop unsupported params and remap max\_tokens for OpenAI reasoning models. |
| [`is_openai_reasoning_model`](#nemoguardrails-llm-openai_reasoning-is_openai_reasoning_model)               | True for OpenAI reasoning models (o1/o3/o4 series, gpt-5+).                |

### Data

[`_REASONING_DROP_PARAMS`](#nemoguardrails-llm-openai_reasoning-_REASONING_DROP_PARAMS)

### API

```python
nemoguardrails.llm.openai_reasoning.apply_openai_reasoning_overrides(
    params: typing.Dict[str, typing.Any]
) -> typing.Dict[str, typing.Any]
```

Drop unsupported params and remap max\_tokens for OpenAI reasoning models.

OpenAI reasoning models (o-series, gpt-5+) require `max_completion_tokens`
instead of `max_tokens` and reject `temperature` / `stop` on most
members of the family. This helper applies the rename and the drop list
in one place so the DefaultFramework OpenAI client and the LangChain
adapter cannot drift on what they strip.

The drop list is deliberately limited to the params OpenAI's API itself
is documented to reject (verified by the live probe in
tests/integrations/langchain/test\_openai\_param\_filter.py); other
sometimes-rejected params (top\_p, presence\_penalty, etc.) are accepted
by some reasoning models in the family and are left to the caller.

Returns a new dict; does not mutate the input.

Drops: `temperature`, `stop`.

Renames: `max_tokens` -> `max_completion_tokens` (only if
`max_tokens` carries a non-None value and `max_completion_tokens`
is not already present, so an explicit `max_completion_tokens`
always wins and an unset `max_tokens` is not promoted to a null
wire field).

```python
nemoguardrails.llm.openai_reasoning.is_openai_reasoning_model(
    model_name: str
) -> bool
```

True for OpenAI reasoning models (o1/o3/o4 series, gpt-5+).

Used to decide whether to strip parameters that OpenAI rejects on these
models (temperature, stop, etc.) and how to remap others
(max\_tokens -> max\_completion\_tokens). Shared by the DefaultFramework
OpenAI client and the LangChain adapter so the two paths cannot drift.

```python
nemoguardrails.llm.openai_reasoning._REASONING_DROP_PARAMS = frozenset({'temperature', 'stop'})
```