mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(ai): use dashed Claude model IDs for Cloudflare AI Gateway
The gateway's /anthropic passthrough forwards the model ID to Anthropic unchanged. models.dev lists the gateway's Claude models with dotted versions (claude-opus-5.5), which Anthropic rejects with a 404. Convert dots to dashes (claude-opus-5-5) when generating the catalog.
This commit is contained in:
parent
1499466d85
commit
c10bfb0d79
3 changed files with 7 additions and 3 deletions
|
|
@ -1966,7 +1966,10 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
|||
} else if (upstream === "anthropic") {
|
||||
api = "anthropic-messages";
|
||||
baseUrl = CLOUDFLARE_AI_GATEWAY_ANTHROPIC_BASE_URL;
|
||||
id = nativeId;
|
||||
// The /anthropic passthrough forwards the model ID to Anthropic unchanged.
|
||||
// models.dev lists dotted versions (claude-opus-5.5), but Anthropic only
|
||||
// accepts dashed IDs (claude-opus-5-5).
|
||||
id = nativeId.replaceAll(".", "-");
|
||||
} else if (upstream === "workers-ai") {
|
||||
api = "openai-completions";
|
||||
baseUrl = CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue