-
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
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
- https://platform.openai.com/docs/models/gpt-5-nano
- https://platform.openai.com/docs/models/gpt-5-mini
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.1typescript: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
Labels
No labels