Skip to content

Commit 174e25a

Browse files
erin2722claude
andcommitted
Add sync-openrouter: slug-keyed OpenRouter alternates for carried models
Mirrors the Bedrock/Baseten pattern: OpenRouter serves many models we already carry under a different `<vendor>/<model>` slug (e.g. openrouter `x-ai/grok-4.5` == our `grok-4.5`). Rather than union `openrouter` onto the canonical entry, this creates a SEPARATE entry keyed by the openrouter slug, `format: "openai"`, `available_providers: ["openrouter"]`, with pricing/context/modality/reasoning pulled from OpenRouter's public /api/v1/models directory. - sync_models.ts: OpenRouter schemas + fetch, `openRouterCanonicalId` (strip vendor prefix, reject :variant slugs), `convertOpenRouterToLocalModel`, `applyOpenRouterPricing`, and `syncOpenRouterModelsCommand`. Bounded to models we already carry; openrouter-only models and :free/:nitro variants are skipped. Existing non-openrouter entries that share a slug (e.g. the multi-provider `openai/gpt-oss-120b`) are never touched. - Registered as the `sync-openrouter` yargs command. - sync-models.yaml: daily "Sync OpenRouter alternates" step (public endpoint, OPENROUTER_API_KEY optional). - Tests for the canonical-id strip, converter, and pricing refresh. - Generates 86 slug-keyed alternates (openai, google, mistralai, perplexity, x-ai, cohere, anthropic, microsoft) + their index.ts ["openrouter"] mappings. Routing note: the deployed Rust gateway (lingua) does not yet implement the `openrouter` provider kind (router_builder returns "unsupported provider kind"), so these resolve + find the org secret but cannot invoke until lingua adds it. The catalog entries are correct regardless; routing needs that gateway change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b2760c4 commit 174e25a

5 files changed

Lines changed: 1769 additions & 1 deletion

File tree

.github/workflows/sync-models.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ jobs:
9999
100100
pnpm exec tsx packages/proxy/scripts/sync_models.ts sync-baseten --write
101101
102+
- name: Sync OpenRouter alternates from /api/v1/models
103+
env:
104+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
105+
run: |
106+
set -euo pipefail
107+
108+
# OpenRouter's /api/v1/models is the authoritative source for the
109+
# openrouter slug + pricing/context of models we already carry. This
110+
# creates slug-keyed openrouter alternates (Bedrock-style separate
111+
# entries) and refreshes their pricing; openrouter-only models and
112+
# :variant slugs are skipped. The endpoint is public, so no key is
113+
# required (it is sent when configured).
114+
pnpm exec tsx packages/proxy/scripts/sync_models.ts sync-openrouter --write
115+
102116
- name: Collect changed model ids
103117
id: changed_models
104118
run: |

packages/proxy/schema/index.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,92 @@ export const AvailableEndpointTypes: { [name: string]: ModelEndpointType[] } = {
393393
"mixtral-8x7b": ["lepton"],
394394
"wizardlm-2-7b": ["lepton"],
395395
"wizardlm-2-8x22b": ["lepton", "openrouter"],
396+
"anthropic/claude-opus-5": ["openrouter"],
397+
"google/gemini-3.6-flash": ["openrouter"],
398+
"google/gemini-3.5-flash-lite": ["openrouter"],
399+
"openai/gpt-5.6-luna": ["openrouter"],
400+
"openai/gpt-5.6-terra": ["openrouter"],
401+
"openai/gpt-5.6-sol": ["openrouter"],
402+
"x-ai/grok-4.5": ["openrouter"],
403+
"anthropic/claude-sonnet-5": ["openrouter"],
404+
"google/gemini-3.1-flash-lite-image": ["openrouter"],
405+
"google/gemini-3.1-flash-image": ["openrouter"],
406+
"google/gemini-3-pro-image": ["openrouter"],
407+
"anthropic/claude-fable-5": ["openrouter"],
408+
"x-ai/grok-build-0.1": ["openrouter"],
409+
"google/gemini-3.5-flash": ["openrouter"],
410+
"google/gemini-3.1-flash-lite": ["openrouter"],
411+
"x-ai/grok-4.3": ["openrouter"],
412+
"openai/gpt-5.5-pro": ["openrouter"],
413+
"openai/gpt-5.5": ["openrouter"],
414+
"openai/gpt-5.4-nano": ["openrouter"],
415+
"openai/gpt-5.4-mini": ["openrouter"],
416+
"mistralai/mistral-small-2603": ["openrouter"],
417+
"openai/gpt-5.4-pro": ["openrouter"],
418+
"openai/gpt-5.4": ["openrouter"],
419+
"google/gemini-3.1-flash-lite-preview": ["openrouter"],
420+
"google/gemini-3.1-flash-image-preview": ["openrouter"],
421+
"google/gemini-3.1-pro-preview-customtools": ["openrouter"],
422+
"openai/gpt-5.3-codex": ["openrouter"],
423+
"google/gemini-3.1-pro-preview": ["openrouter"],
424+
"openai/gpt-audio": ["openrouter"],
425+
"openai/gpt-audio-mini": ["openrouter"],
426+
"openai/gpt-5.2-codex": ["openrouter"],
427+
"google/gemini-3-flash-preview": ["openrouter"],
428+
"openai/gpt-5.2-pro": ["openrouter"],
429+
"openai/gpt-5.2": ["openrouter"],
430+
"mistralai/devstral-2512": ["openrouter"],
431+
"openai/gpt-5.1-codex-max": ["openrouter"],
432+
"mistralai/ministral-14b-2512": ["openrouter"],
433+
"mistralai/ministral-8b-2512": ["openrouter"],
434+
"mistralai/ministral-3b-2512": ["openrouter"],
435+
"mistralai/mistral-large-2512": ["openrouter"],
436+
"google/gemini-3-pro-image-preview": ["openrouter"],
437+
"openai/gpt-5.1": ["openrouter"],
438+
"openai/gpt-5.1-codex": ["openrouter"],
439+
"openai/gpt-5.1-codex-mini": ["openrouter"],
440+
"openai/o3-deep-research": ["openrouter"],
441+
"openai/o4-mini-deep-research": ["openrouter"],
442+
"google/gemini-2.5-flash-image": ["openrouter"],
443+
"openai/gpt-5-pro": ["openrouter"],
444+
"openai/gpt-5-codex": ["openrouter"],
445+
"openai/gpt-5": ["openrouter"],
446+
"openai/gpt-5-mini": ["openrouter"],
447+
"openai/gpt-5-nano": ["openrouter"],
448+
"mistralai/codestral-2508": ["openrouter"],
449+
"google/gemini-2.5-flash-lite": ["openrouter"],
450+
"google/gemini-2.5-flash": ["openrouter"],
451+
"google/gemini-2.5-pro": ["openrouter"],
452+
"openai/o3-pro": ["openrouter"],
453+
"mistralai/mistral-medium-3": ["openrouter"],
454+
"google/gemini-2.5-pro-preview-05-06": ["openrouter"],
455+
"openai/o3": ["openrouter"],
456+
"openai/o4-mini": ["openrouter"],
457+
"openai/gpt-4.1": ["openrouter"],
458+
"openai/gpt-4.1-mini": ["openrouter"],
459+
"openai/gpt-4.1-nano": ["openrouter"],
460+
"openai/o1-pro": ["openrouter"],
461+
"perplexity/sonar-reasoning-pro": ["openrouter"],
462+
"perplexity/sonar-pro": ["openrouter"],
463+
"perplexity/sonar-deep-research": ["openrouter"],
464+
"openai/o3-mini": ["openrouter"],
465+
"perplexity/sonar": ["openrouter"],
466+
"openai/o1": ["openrouter"],
467+
"cohere/command-r7b-12-2024": ["openrouter"],
468+
"openai/gpt-4o-2024-11-20": ["openrouter"],
469+
"cohere/command-r-08-2024": ["openrouter"],
470+
"cohere/command-r-plus-08-2024": ["openrouter"],
471+
"openai/gpt-4o-2024-08-06": ["openrouter"],
472+
"openai/gpt-4o-mini": ["openrouter"],
473+
"openai/gpt-4o-mini-2024-07-18": ["openrouter"],
474+
"openai/gpt-4o": ["openrouter"],
475+
"openai/gpt-4o-2024-05-13": ["openrouter"],
476+
"microsoft/wizardlm-2-8x22b": ["openrouter"],
477+
"openai/gpt-4-turbo": ["openrouter"],
478+
"openai/gpt-3.5-turbo-instruct": ["openrouter"],
479+
"openai/gpt-3.5-turbo-16k": ["openrouter"],
480+
"openai/gpt-3.5-turbo": ["openrouter"],
481+
"openai/gpt-4": ["openrouter"],
396482
"nous-hermes-llama2-13b": ["lepton"],
397483
"accounts/fireworks/models/nous-hermes-2-mixtral-8x7b-dpo": ["fireworks"],
398484
"dolphin-mixtral-8x7b": ["lepton"],

0 commit comments

Comments
 (0)