Step 1
Find every max_tokens call site
Search direct SDK calls, shared request builders, wrappers, tests, and configuration. One hidden default can keep the same error alive after you fix the obvious request.
OpenAI parameter error
OpenAI currently marks max_tokens as deprecated in Chat Completions, recommends max_completion_tokens instead, and documents max_tokens as incompatible with o-series models.
Step 1
Search direct SDK calls, shared request builders, wrappers, tests, and configuration. One hidden default can keep the same error alive after you fix the obvious request.
Step 2
For Chat Completions, OpenAI documents max_completion_tokens as the replacement for the deprecated max_tokens field. Validate the target model and endpoint before changing shared code.
Step 3
A token-limit migration can change how much visible output you receive because newer reasoning models may account for reasoning tokens differently. Test real workloads, not only a successful HTTP response.
Do not apply a blind search-and-replace across every provider. Scope the change to OpenAI request paths and verify the SDK and endpoint you actually use.
Fixing the first error does not prove the rest of the codebase is clear. Sunset scans source text for scheduled OpenAI shutdown risk and shows severity before you pay.