Skip to content

Stream validation fails for gpt-5.x with @ai-sdk/openai-compatible #30580

@RiAnBee

Description

@RiAnBee

When using @ai-sdk/openai-compatible with gpt-5.x, streaming responses fail zod validation:

Type validation failed: object: "chat.completion.chunk"
Expected: "response.output_text.delta" | "response.completed" | ...

Config:

"npm": "@ai-sdk/openai-compatible",
"models": { "gpt-5.4": {} }

Version: 1.15.13

Likely cause: transform.ts injects reasoningEffort / reasoningSummary for all gpt-5* model IDs, regardless of npm. These Responses-only params cause the SDK to internally switch to Responses protocol, while the backend returns Chat Completions format — hence the schema mismatch.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions