mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-09 01:03:05 +08:00
- Detect native responses-lite requests via headers and client metadata. - Skip instructions normalization and synthetic session cloaking for native requests. - Preserve upstream completion output during websocket response forwarding. Closes: #5780
18 lines
606 B
Go
18 lines
606 B
Go
package util
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"github.com/tidwall/gjson"
|
|
)
|
|
|
|
// IsCodexResponsesLiteRequest recognizes the native header and its websocket metadata mirror.
|
|
func IsCodexResponsesLiteRequest(body []byte, headers http.Header) bool {
|
|
if strings.EqualFold(strings.TrimSpace(headers.Get("X-OpenAI-Internal-Codex-Responses-Lite")), "true") {
|
|
return true
|
|
}
|
|
value := gjson.GetBytes(body, "client_metadata.ws_request_header_x_openai_internal_codex_responses_lite")
|
|
return value.Type == gjson.True || value.Type == gjson.String && strings.EqualFold(strings.TrimSpace(value.String()), "true")
|
|
}
|