Solution skill
Semantic Kernel Python + Azure OpenAI o3: Unsupported parameter max_tokens, use max_completion_tokens
Complete solution
Shows how to fix semantic Kernel Python + Azure OpenAI o3: Unsupported parameter max_tokens, use max_completion_tokens. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Use 'maxcompletiontokens' instead." Semantic Kernel automatically passed max\_tokens, which o3 models reject.
Steps
- Invoking Semantic Kernel Python's AzureChatCompletion against an o3-series reasoning model failed with "Unsupported parameter: 'maxtokens' is not supported with this model. Use 'maxcompletiontokens' instead." Semantic Kernel automatically passed `maxtokens`, which o3 models reject. The user expected the standard prompt execution settings to just work with reasoning models.
- Configure
max_completion_tokensinstead ofmax_tokens: in SK Python,OpenAIChatPromptExecutionSettings(the base class for OpenAI prompt execution settings) has amax_completion_tokensattribute, and the childAzureChatPromptExecutionSettingsaddsextra_bodyif needed. Setting that value works fine with reasoning models, per maintainer moonbox3 in the thread.
When to use
You are seeing this: Invoking Semantic Kernel Python's AzureChatCompletion against an o3-series reasoning model failed with "Unsupported parameter: 'maxtokens' is not supported with this model. Use this skill when you run into "Semantic Kernel Python + Azure OpenAI o3: Unsupported parameter maxtokens, use maxcompletiontokens".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Question asked in the thread: Invoking Semantic Kernel Python's AzureChatCompletion against an o3-series reasoning model failed with "Unsupported parameter: 'maxtokens' is not supported with this model. Use 'maxcompletiontokens' instead." Semantic Kernel automatically passed `maxtokens`, which o3 models reject. The user expected the standard prompt execution settings to just work with reasoning models.
Verified answer: Configure max_completion_tokens instead of max_tokens: in SK Python, OpenAIChatPromptExecutionSettings (the base class for OpenAI prompt execution settings) has a max_completion_tokens attribute, and the child AzureChatPromptExecutionSettings adds extra_body if needed. Setting that value works fine with reasoning models, per maintainer moonbox3 in the thread. Source: https://github.com/microsoft/semantic-kernel/issues/12865
Thread: https://vectle.com/threads/thr_ALZMb0ORS9uDsQ0qgvmc3g
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_JGjP-Wf92ze9U3ygCcJ85A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Semantic Kernel Python + Azure OpenAI o3: Unsupported parameter max_tokens, use max_completion_tokens <span>— Vectle</span></a>