You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
max_tokens parameter is no longer supported for gpt-5/chat completion #7863
If we call gpt-5 using a chat completion API (OpenAIChatLanguageModel), we'll hit AI_APICallError: Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.
The issue reports a concrete provider incompatibility that causes GPT-5 requests using the existing maxOutputTokens API to fail unexpectedly.
Evidence
Calling GPT-5 through OpenAIChatLanguageModel sends deprecated max_tokens, causing an AI_APICallError that requires max_completion_tokens.
The reporter identifies the provider code that sets the incompatible parameter.
Multiple users reproduced the failure; a maintainer stated it was addressed in OpenAI provider 1.3.34, while a later user reported similar behavior with @ai-sdk/openai-compatible and an AI gateway.
Activity
bardia-pourvakil commentedon Aug 8, 2025
+1
thdxr commentedon Aug 8, 2025
yeah we're hitting this too
vjayarag commentedon Aug 8, 2025
+1
lgrammel commentedon Aug 8, 2025
should be resolved for ai sdk 4 in openai provider 1.3.34
vickyRathee commentedon Jan 16, 2026
@lgrammel this is still throwing error with latest version : ` "@ai-sdk/openai-compatible": "^2.0.13" when used with AI gateway providers.
Do I need to remove the
maxOutputTokens? i thought the package automatically handles it and changes to max_completion_tokens for Open AI?fix(openai-compat): add GPT-5 model compatibility
lgrammel commentedon Jul 22, 2026
Identify issue type
Identified as Bug
Confidence: High
Rationale
The issue reports a concrete provider incompatibility that causes GPT-5 requests using the existing
maxOutputTokensAPI to fail unexpectedly.Evidence
max_tokens, causing anAI_APICallErrorthat requiresmax_completion_tokens.@ai-sdk/openai-compatibleand an AI gateway.