mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
fix(translator): remove unsupported token limit fields for Codex Responses API
The OpenAI Codex Responses API (chatgpt.com/backend-api/codex/responses) rejects requests containing max_output_tokens and max_completion_tokens fields, causing Factory CLI to fail with "Unsupported parameter" errors. This fix strips these incompatible fields during request translation, allowing Factory CLI to work properly with CLIProxyAPI when using ChatGPT Plus/Pro OAuth. Fixes compatibility issue where Factory sends token limit parameters that aren't supported by the Codex Responses endpoint.
This commit is contained in:
@@ -17,6 +17,9 @@ func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte,
|
||||
rawJSON, _ = sjson.SetBytes(rawJSON, "store", false)
|
||||
rawJSON, _ = sjson.SetBytes(rawJSON, "parallel_tool_calls", true)
|
||||
rawJSON, _ = sjson.SetBytes(rawJSON, "include", []string{"reasoning.encrypted_content"})
|
||||
// Codex Responses rejects token limit fields, so strip them out before forwarding.
|
||||
rawJSON, _ = sjson.DeleteBytes(rawJSON, "max_output_tokens")
|
||||
rawJSON, _ = sjson.DeleteBytes(rawJSON, "max_completion_tokens")
|
||||
rawJSON, _ = sjson.DeleteBytes(rawJSON, "temperature")
|
||||
rawJSON, _ = sjson.DeleteBytes(rawJSON, "top_p")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user