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
Do not report issues when pass-through is enabled; pass-through sends content as-is and does not go through new-api processing logic.
State facts and evidence concisely. Do not paste unfiltered AI-generated text in the issue body or in later comments.
Relay reports must first establish that the issue occurs in the new-api layer. Use equivalent redacted requests to compare the direct upstream result with the result through new-api, including response status, error body, and server logs. Reports that skip this comparison or only show an upstream error are not accepted.
Reports about Coding Plan services, reverse-engineered channels, third-party API wrappers, or compatibility issues caused by exposing a Codex endpoint through a reverse proxy as a general-purpose API are not accepted. Protocols or behavior specific to the Codex API should not be treated as standard OpenAI API behavior; confirm such issues with the channel or API provider first.
This project does not operate an official hosted service or provide technical support for third-party hosting sites, relay services, or API services. Contact the relevant operator for those issues.
Warning: issues with this template removed, section headings deleted, or content cleared may be closed directly. Repeated submissions of unfiltered AI-generated text, or repeated abusive submissions, may result in a block.
Deployment source
Repository release / official image (self-hosted)
Your current newapi version
实际接口复现:v1.0.0-rc.39 - 源码审计:v1.0.0-rc.37、v1.0.0-rc.39、v1.0.0-rc.40 - rc.40 未在实际部署接口上运行;结论来自官方 tag 源码和版本差异核对。
Submission Checks
Non-duplicate issue: I have searched existing Issues and confirmed there are no similar issues.
Read this first: I have fully read the section above, reviewed the docs at https://docs.newapi.ai/ and the project README, and asked AI first, confirming this is not a usage, configuration, or integration question.
Supported version: I have provided an exact version, commit, or image tag (not latest or unknown) and confirmed that the issue reproduces on an unmodified, supported version from this repository.
Not a third-party service: I confirm that this issue is not exclusive to a third-party hosting site, relay, API service, or fork that has not been verified against the unmodified repository. Third-party instance issues must be reported to their operator.
Not pass-through: I confirm that pass-through is not enabled on the relevant channel. Pass-through sends content as-is and does not go through new-api processing logic; such reports are not accepted.
Issue attribution: I have provided evidence that distinguishes the client, new-api, and upstream layers. For relay issues, I compared equivalent redacted requests sent directly upstream and through new-api, confirming that new-api introduces or changes the error rather than merely forwarding the upstream error unchanged.
Channel and protocol boundary: I confirm that the issue is not caused by a Coding Plan service, reverse-engineered channel, third-party API wrapper, Codex reverse-proxy endpoint, or behavior specific to the Codex API. If first observed through such an interface, I have reproduced it using a standard API protocol supported by this repository.
Maintainer time: I understand that maintainers have limited time. Do not paste unfiltered AI-generated text in the issue body or in later comments; extract the points needed for review first. Submissions that do not follow this template, or that omit the necessary points and cannot be reviewed, may be ignored or closed. Repeated submissions of this kind may result in a block.
{
"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"
}
}
Read This First
Deployment source
Repository release / official image (self-hosted)
Your current newapi version
实际接口复现:
v1.0.0-rc.39- 源码审计:v1.0.0-rc.37、v1.0.0-rc.39、v1.0.0-rc.40-rc.40未在实际部署接口上运行;结论来自官方 tag 源码和版本差异核对。Submission Checks
latestorunknown) and confirmed that the issue reproduces on an unmodified, supported version from this repository.Issue Description
在 OpenAI 兼容的 Chat Completions 请求中,模型为
gpt-6-sol或gpt-6-luna时,客户端发送max_tokens,new-api 没有将其转换为max_completion_tokens,上游返回 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" } }该问题在流式和非流式请求中均出现。
源码定位:Chat token 字段
三个版本的
GetOpenAIChatCapabilities()都使用以下判断:gpt-6-sol、gpt-6-luna以及对应日期快照不满足上述条件,因此UseMaxCompletionTokens保持 Go 布尔零值false。后续转换逻辑只有在该标志为true时才执行:因此,正常适配器路径收到只包含
max_tokens的gpt-6-sol/gpt-6-luna请求时,发送给上游的请求仍可能包含旧字段。源码位置:
rc.37:openai_request.go:313,adaptor.go:406rc.39:openai_request.go:332,adaptor.go:419rc.40:openai_request.go:332,adaptor.go:419三个版本该能力函数规范化后的 SHA-256 完全相同:
Steps to Reproduce
Chat Completions /
max_tokens发送非流式请求:
预期复现:HTTP 400,错误参数为
max_tokens。把请求唯一相关字段改为
max_completion_tokens:{ "model": "gpt-6-sol", "messages": [{"role": "user", "content": "Reply OK only."}], "max_completion_tokens": 16, "stream": false }预期结果:HTTP 200,返回
OK。将两个请求的
stream都改为true,可以得到相同的失败/成功差异;失败流式请求返回 400 和 SSE 错误事件,不会收到正常的完成事件。对
gpt-6-luna重复上述步骤,结果相同。Expected Result
max_completion_tokens的 Chat 模型,new-api 应在正常适配器路径中把客户端的max_tokens转换为max_completion_tokens,并删除旧字段。gpt-6-sol、gpt-6-luna及其日期快照,而不是只覆盖 GPT-5 和gpt-6-astra。Related Screenshots