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
Using OpenAI via Cloudflare AI Gateway results in Unsupported parameter error. #22374
When using /models to pick a GPT model like GPT-5.4 or some other modern OpenAI model you get the following result from any prompt: Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.
If you use an older GPT model like GPT-4o does work. I think this has to do with "OpenAI officially switched to max_completion_tokens in September 2024 to coincide with the release of the o1 series models"
Curious if there is a plan to fix or a best workaround.
Plugins
No response
OpenCode version
1.3.10
Steps to reproduce
After making sure you set up Cloudflare AI Gateway and a model like Claude Opus 4.6 works
This issue might be a duplicate of existing issues. Please check:
@ai-sdk/openai-compatible max_tokens error for GPT 5.x #5421: Same error (Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.) when using OpenAI-compatible providers with GPT 5.x models
Activity
github-actions commentedon Apr 14, 2026
This issue might be a duplicate of existing issues. Please check:
Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.) when using OpenAI-compatible providers with GPT 5.x modelslorenjphillips commentedon Apr 15, 2026
+1 Good Issue
I had this issue as well, would be great to have it addressed!
kobicovaldev commentedon Apr 16, 2026
#22864 @rekram1-node maybe this will work or something similar?