Summary
The OpenAI-compatible provider fails its connection test with newer OpenAI models because the request body sends the deprecated max_tokens parameter.
OpenAI returns:
API error (400): {
"error": {
"message": "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.",
"type": "invalid_request_error",
"param": "max_tokens",
"code": "unsupported_parameter"
}
}
Environment
- Easy-Translater extension version:
1.0.0
- Upstream commit tested:
8d0378258c255dcde8c479e7da0d91aee9cefa3f
- Provider: OpenAI compatible
- API base URL:
https://api.openai.com/v1/
- Model:
gpt-5.4-mini
- Browser: Google Chrome on macOS
Steps to reproduce
- Open the extension settings.
- Select OpenAI compatible as the API provider.
- Set the API URL to
https://api.openai.com/v1/.
- Enter a valid OpenAI API key.
- Set the model to
gpt-5.4-mini.
- Run the connection test.
Actual behavior
The connection test fails with HTTP 400 and reports that max_tokens is unsupported.
Expected behavior
The connection test and translations should succeed with newer OpenAI models that require max_completion_tokens.
Root cause
lib/translator.js hardcodes max_tokens: 4096 in the OpenAI request body (around line 84). The same parameter is also hardcoded in other OpenAI-compatible request paths (around lines 103 and 152).
OpenAI's current Chat Completions API reference marks max_tokens as deprecated in favor of max_completion_tokens, and notes that parameter support differs by model:
https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create
Suggested fix
Please consider:
- Using
max_completion_tokens for native OpenAI requests and models that require it.
- Preserving compatibility with third-party OpenAI-compatible endpoints that may still expect
max_tokens, for example through provider/model-aware parameter selection or a targeted retry when the API returns unsupported_parameter.
- Centralizing construction of the token-limit parameter instead of hardcoding it in multiple request paths.
- Adding a regression test covering both parameter variants.
No API key or other credential is included in this report.
Summary
The OpenAI-compatible provider fails its connection test with newer OpenAI models because the request body sends the deprecated
max_tokensparameter.OpenAI returns:
Environment
1.0.08d0378258c255dcde8c479e7da0d91aee9cefa3fhttps://api.openai.com/v1/gpt-5.4-miniSteps to reproduce
https://api.openai.com/v1/.gpt-5.4-mini.Actual behavior
The connection test fails with HTTP 400 and reports that
max_tokensis unsupported.Expected behavior
The connection test and translations should succeed with newer OpenAI models that require
max_completion_tokens.Root cause
lib/translator.jshardcodesmax_tokens: 4096in the OpenAI request body (around line 84). The same parameter is also hardcoded in other OpenAI-compatible request paths (around lines 103 and 152).OpenAI's current Chat Completions API reference marks
max_tokensas deprecated in favor ofmax_completion_tokens, and notes that parameter support differs by model:https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create
Suggested fix
Please consider:
max_completion_tokensfor native OpenAI requests and models that require it.max_tokens, for example through provider/model-aware parameter selection or a targeted retry when the API returnsunsupported_parameter.No API key or other credential is included in this report.