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
Azure GPT-5 model: "max_tokens" parameter not supported, need "max_completion_tokens" instead #22623
Using Azure GPT-5 model with opencode fails with error:
"Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead."
Environment
opencode version: 1.4.5
Model: gpt-5.4 (Azure deployment)
Provider: Azure OpenAI
Expected Behavior
Should be compatible with Azure GPT-5 API which requires max_completion_tokens instead of max_tokens
Possible Fix
Replace all occurrences of max_tokens with max_completion_tokens in the Azure OpenAI SDK integration, similar to how newer OpenAI API versions handle this parameter.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Reacted by Ulrich Goldmann, Alexandru Puiu Albu, Oliver Jahren, Guo-ziwei, Yifeng Chen and Geir O. Grønmo
Activity
github-actions commentedon Apr 15, 2026
This issue might be a duplicate of existing issues. Please check:
@ai-sdk/openai-compatibleand GPT 5.x models requiringmax_completion_tokensPlease review these issues to see if your problem is already tracked, and if so, consider adding any additional context there.
kobicovaldev commentedon Apr 15, 2026
Similar to what I am seeing here #22374
refex commentedon Apr 28, 2026
I solved it using this config
{ "$schema": "https://opencode.ai/config.json", "model": "azure-foundry/gpt-5.4-2", "theme": "opencode", "autoupdate": true, "provider": { "azure-foundry": { "type": "openai-compatible", "options": { "apiKey": "<api-key>", "baseURL": "https://myfoundry.services.ai.azure.com/api/projects/myfoundryproject/openai/v1" }, "models": { "gpt-5.4-2": { "name": "gpt-5.4-2", "limit": { "context": 128000, "output": 16000 } } } } } }and a custom opencode plugin
feat(provider): add Chat Completions API mode for gateway/proxy provi…
ArchiTecCTT commentedon Jun 18, 2026
Related: filed a cloudflare-ai-gateway-specific report in #32776 (built-in provider + pi-ai detectCompat forces max_tokens for all gateway traffic; opencode.jsonc compat overrides ignored).
github-actions commentedon Aug 18, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.