fix: effort-proxy mapping max→xhigh for GPT, add EFFORT_MAPPING.md
- Fix effort-proxy direction: GPT-5.5 natively supports xhigh but not max, so map max→xhigh (was incorrectly xhigh→max) - Add EFFORT_MAPPING.md with full mapping table for all providers: Anthropic, GPT-5.5, DeepSeek V4, Kimi K2.6, Gemini 3.x - Update proxy docstring and comments
This commit is contained in:
@@ -105,11 +105,16 @@ else
|
||||
install_proxy
|
||||
fi
|
||||
|
||||
# ── 4b. effort-proxy wrapper (патч xhigh->max для claude-code-proxy) ─────────
|
||||
# ── 4b. effort-proxy wrapper (маппинг effort для GPT: max->xhigh) ─────────
|
||||
EFFORT_PROXY_BIN="$BIN_DIR/claude-gpt-effort-proxy.py"
|
||||
cat > "$EFFORT_PROXY_BIN" << 'PYEOF'
|
||||
#!/usr/bin/env python3
|
||||
"""Reverse proxy: rewrites "xhigh" effort -> "max" for claude-code-proxy (bug in <=0.0.13)."""
|
||||
"""Effort mapping proxy for GPT backend.
|
||||
|
||||
GPT-5.5 natively supports: low, medium, high, xhigh (no "max").
|
||||
Claude Code may send "max" effort — we map it to "xhigh" (highest GPT level).
|
||||
See EFFORT_MAPPING.md for the full mapping table across all providers.
|
||||
"""
|
||||
import http.client, http.server, sys
|
||||
|
||||
UPSTREAM_PORT = int(sys.argv[1]) if len(sys.argv) > 1 else 18766
|
||||
@@ -120,7 +125,7 @@ class _Proxy(http.server.BaseHTTPRequestHandler):
|
||||
body = b""
|
||||
if cl := self.headers.get("Content-Length"):
|
||||
body = self.rfile.read(int(cl))
|
||||
body = body.replace(b'"xhigh"', b'"max"')
|
||||
body = body.replace(b'"max"', b'"xhigh"')
|
||||
try:
|
||||
conn = http.client.HTTPConnection("localhost", UPSTREAM_PORT, timeout=300)
|
||||
hdrs = dict(self.headers)
|
||||
|
||||
Reference in New Issue
Block a user