fix: add Claude model ID normalization to AIUI proxy in ISO build
Sync MODEL_MAP from deploy script to ISO build's inline claude-api-proxy. Maps short model names (claude-sonnet-4) to full API IDs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1690f67acf
commit
c6b9097f3d
@ -2123,6 +2123,17 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
|||||||
except: data = {}
|
except: data = {}
|
||||||
if "max_tokens" not in data: data["max_tokens"] = 8096
|
if "max_tokens" not in data: data["max_tokens"] = 8096
|
||||||
for f in ["webSearch","web_search"]: data.pop(f, None)
|
for f in ["webSearch","web_search"]: data.pop(f, None)
|
||||||
|
# Normalize model IDs — map short/dotted names to full API model IDs
|
||||||
|
MODEL_MAP = {
|
||||||
|
"claude-haiku-4.5": "claude-haiku-4-5-20251001",
|
||||||
|
"claude-haiku-4-5": "claude-haiku-4-5-20251001",
|
||||||
|
"claude-sonnet-4": "claude-sonnet-4-20250514",
|
||||||
|
"claude-sonnet-4.5": "claude-sonnet-4-5-20250514",
|
||||||
|
"claude-sonnet-4-5": "claude-sonnet-4-5-20250514",
|
||||||
|
"claude-opus-4": "claude-opus-4-20250514",
|
||||||
|
}
|
||||||
|
m = data.get("model", "")
|
||||||
|
if m in MODEL_MAP: data["model"] = MODEL_MAP[m]
|
||||||
body = json.dumps(data).encode()
|
body = json.dumps(data).encode()
|
||||||
headers = {"Content-Type":"application/json","x-api-key":API_KEY,"anthropic-version":"2023-06-01","anthropic-dangerous-direct-browser-access":"true"}
|
headers = {"Content-Type":"application/json","x-api-key":API_KEY,"anthropic-version":"2023-06-01","anthropic-dangerous-direct-browser-access":"true"}
|
||||||
for h in ["anthropic-version","anthropic-beta"]:
|
for h in ["anthropic-version","anthropic-beta"]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user