mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 04:10:51 +08:00
fix(amp): rewrite model name in response.model for Responses API SSE events
The ResponseRewriter's modelFieldPaths was missing 'response.model', causing the mapped model name to leak through SSE streaming events (response.created, response.in_progress, response.completed) in the OpenAI Responses API (/v1/responses). This caused Amp CLI to report 'Unknown OpenAI model' errors when model mapping was active (e.g., gpt-5.2-codex -> gpt-5.3-codex), because the mapped name reached Amp's backend via telemetry. Also sorted modelFieldPaths alphabetically per review feedback and added regression tests for all rewrite paths. Fixes #1463
This commit is contained in:
@@ -66,7 +66,7 @@ func (rw *ResponseRewriter) Flush() {
|
||||
}
|
||||
|
||||
// modelFieldPaths lists all JSON paths where model name may appear
|
||||
var modelFieldPaths = []string{"model", "modelVersion", "response.modelVersion", "message.model"}
|
||||
var modelFieldPaths = []string{"message.model", "model", "modelVersion", "response.model", "response.modelVersion"}
|
||||
|
||||
// rewriteModelInResponse replaces all occurrences of the mapped model with the original model in JSON
|
||||
// It also suppresses "thinking" blocks if "tool_use" is present to ensure Amp client compatibility
|
||||
|
||||
Reference in New Issue
Block a user