zai-org / zai-org/feedback

[Bug] [v3.7.3] OpenAI API parameter incompatibility (GPT-5.x / o-series / GPT-4.1)

Open
#233 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P1 status: 待评估 type: Bug
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

模型设置 / 切换 · Model config

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

阻塞使用 · Blocking (无法使用核心功能 / core function unusable)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

Environment:

ZCode Version: 3.7.3
OS: Windows
OpenAI Account Tier: Tier 3 ($100+ purchased, $120 balance)
Providers configured: Z.ai (works correctly), OpenAI (issues with most models)
Problem Summary:ZCode v3.7.3 sends incorrect API parameters that OpenAI models reject. There are 4 distinct client-side bugs preventing the use of GPT-5.x, o-series, and GPT-4.1 models:

Sends deprecated max_tokens instead of max_completion_tokens for GPT-5.x/o-series.
Hardcodes max_output_tokens: 1 regardless of UI input when using Responses API.
Duplicates /responses in the URL path construction.
Sends unsupported reasoning_effort parameter to non-reasoning models (e.g., GPT-4.1).
Errors Encountered:

Chat Completions (gpt-5.6-luna): 400 - Unsupported parameter: 'max_tokens' is not supported...
Responses API (gpt-5.6-luna): 400 - Invalid 'max_output_tokens': integer below minimum value. Expected >= 16, but got 1.
Full Endpoint URL (/v1/responses): POST /v1/responses/responses must be made with a session key... (Duplicate path bug)
Chat Completions (gpt-4.1): 400 - Unrecognized request argument supplied: reasoning_effort
Impact:I'm blocked from using GPT-5.6 Luna/Terra for my multi-agent systems. Only gpt-4.1-mini works correctly.

复现步骤 · Steps to reproduce

Preconditions: Configure OpenAI provider with Base URL: https://api.openai.com/v1

Step 1 (Test max_tokens bug):

Select API Format: Chat completions (/chat/completions)
Select Model: gpt-5.6-luna (or gpt-5.5, o3)
Set Max Output Tokens: 128000
Send a message.Result: 400 Error - Unsupported parameter 'max_tokens'. ZCode should send max_completion_tokens.
Step 2 (Test max_output_tokens=1 bug):

Select API Format: Responses (/responses)
Select Model: gpt-5.6-luna
Set Max Output Tokens to any valid number (e.g., 128000, 32, 16) or leave empty.
Send a message.Result: 400 Error - Invalid 'max_output_tokens': got 1. ZCode ignores the UI input and sends 1.
Step 3 (Test URL duplication bug):

Change Base URL to: https://api.openai.com/v1/responses
Keep API Format: Responses (/responses)
Send a message.Result: Error - POST /v1/responses/responses. ZCode appends /responses automatically, creating a duplicate path.
Step 4 (Test reasoning_effort bug):

Revert Base URL to: https://api.openai.com/v1
Select API Format: Chat completions (/chat/completions)
Select Model:

Image

(non-reasoning model)
Send a message.Result: 400 Error - Unrecognized request argument: 'reasoning_effort'. ZCode should not send this parameter to non-reasoning models.

期望表现 · Expected behavior

ZCode should construct API requests that strictly comply with OpenAI's API specifications. Specifically:

Chat Completions API: For GPT-5.x and o-series models, ZCode must send max_completion_tokens instead of the deprecated max_tokens.
Responses API: ZCode must correctly pass the user-defined value from the "Max Output Tokens" UI field to the API request (or omit the parameter if left empty), instead of hardcoding the integer 1.
URL Construction: ZCode must not blindly append /responses to the Base URL if it already ends with /responses. The final endpoint must be exactly https://api.openai.com/v1/responses.
Model Compatibility: ZCode must not send the reasoning_effort parameter to non-reasoning models (like GPT-4.1). This parameter should only be sent for o-series reasoning models.
Overall: Successful API calls (Status 200) without 400 errors for unsupported or invalid parameters, allowing the use of GPT-5.6 Luna, GPT-5.6 Terra, and GPT-4.1 models.

实际表现 · Actual behavior

ZCode throws 400 Bad Request errors and completely fails to connect to the targeted OpenAI models. The actual buggy behaviors are:

Chat Completions API (GPT-5.x, o3): Request fails with 400 - Unsupported parameter: 'max_tokens' is not supported with this model.
Responses API (GPT-5.x): Request fails with 400 - Invalid 'max_output_tokens': integer below minimum value. Expected >= 16, but got 1. (The value set in the UI is ignored).
URL Construction Bug: When using the full URL https://api.openai.com/v1/responses, ZCode duplicates the endpoint, sending requests to /v1/responses/responses, causing a session key error.
Chat Completions API (GPT-4.1): Request fails with 400 - Unrecognized request argument supplied: reasoning_effort (parameter sent to a non-reasoning model).
Because of these 4 bugs, GPT-5.6 Luna, GPT-5.6 Terra, and GPT-4.1 are completely unusable. Only gpt-4.1-mini works.

ZCode 版本 · ZCode version

v3.7.3

设备 / 系统 / 浏览器 · Device / OS / Browser

Windows

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
Image Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the four listed scenarios against the OpenAI base URL and compare the outgoing requests with the reported errors. Done means Chat Completions, Responses, URL construction, and reasoning-parameter handling produce valid requests for the specified GPT-5.x, o-series, and GPT-4.1 cases without 400 errors.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.