Skip to content

Bug: gpt-5-nano and gpt-5-mini missing OpenAIReasoningOptions in type definitions #92

@Mark-Life

Description

@Mark-Life

TanStack AI version

v0.0.1

Framework/Library version

typescript v5.9.3

Describe the bug and the steps to reproduce it

The gpt-5-nano and gpt-5-mini models support reasoning tokens according to OpenAI's documentation, but @tanstack/ai-openai type definitions don't include OpenAIReasoningOptions for these models, causing TypeScript errors.

OpenAI Documentation

Steps to Reproduce

import { chat, toStreamResponse } from "@tanstack/ai";
import { openai } from "@tanstack/ai-openai";

const stream = chat({
  adapter: openai(),
  messages: [{ role: "user", content: "Hello" }],
  model: "gpt-5-nano", // or "gpt-5-mini"
  providerOptions: {
    reasoning: {
      effort: "medium", // ❌ Type error here
    },
  },
});

Expected Behavior

No type error - reasoning option should be allowed for gpt-5-nano and gpt-5-mini.

Actual Behavior

TypeScript error: reasoning property doesn't exist on the providerOptions type for these models.

Root Cause

In model-meta.d.ts, the type mapping excludes OpenAIReasoningOptions:

// Current (incorrect)
[GPT5_MINI.name]: OpenAIBaseOptions & OpenAIStructuredOutputOptions & OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions;
[GPT5_NANO.name]: OpenAIBaseOptions & OpenAIStructuredOutputOptions & OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions;

// Expected (should include OpenAIReasoningOptions)
[GPT5_MINI.name]: OpenAIBaseOptions & OpenAIReasoningOptions & OpenAIStructuredOutputOptions & OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions;
[GPT5_NANO.name]: OpenAIBaseOptions & OpenAIReasoningOptions & OpenAIStructuredOutputOptions & OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions;

Environment

  • @tanstack/ai: 0.0.1
  • @tanstack/ai-openai: 0.0.1
  • typescript: 5.9.3

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/tanstack-ai-openai-reasoning-open-ai-issue

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Yes, I am also opening a PR that solves the problem along side this issue

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions