Compare commits

...
Author SHA1 Message Date
Aiden Cline 89b834086a refactor: move sync implementation into core src 2026-05-21 18:06:25 -05:00
Aiden Cline 1ab2ff8163 Merge pull request #1826 from smakosh/add-llmgateway-models
feat: add new LLM Gateway text models
2026-05-21 17:58:29 -05:00
Frank 9468676683 update zen models 2026-05-21 18:42:36 -04:00
Claude 6cdd2f054b Merge upstream/dev into add-llmgateway-models; resolve gemini-3.5-flash conflict
# Conflicts:
#	providers/google/models/gemini-3.5-flash.toml
2026-05-21 21:48:48 +00:00
Aiden Cline b13abc9141 Merge pull request #1827 from anomalyco/update-xai-pricing
fix xAI long-context pricing
2026-05-21 16:45:43 -05:00
Aiden Cline e5ba264751 fix xAI long-context pricing 2026-05-21 16:41:36 -05:00
smakoshandClaude Opus 4.7 a7811fb522 refactor: use extends for gemini and qwen models
Add canonical google/gemini-3.5-flash and alibaba/qwen3.7-max defs and
have the llmgateway entries extend them, per PR review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 23:38:57 +02:00
smakoshandClaude Opus 4.7 605fae75d9 feat: add new LLM Gateway text models
Add Grok 4.20 (reasoning/non-reasoning), Gemini 3.5 Flash, and Qwen3.7 Max to the llmgateway provider.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 23:04:47 +02:00
Aiden Cline 26b05268ae Merge pull request #1824 from anomalyco/fix/vercel-gemini-35-flash
Add new Vercel AI Gateway models
2026-05-21 15:30:35 -05:00
Aiden Cline 1aee13d2e5 Add new Vercel AI Gateway models 2026-05-21 13:21:25 -05:00
Aiden Cline 0a924e6bb2 Merge pull request #1822 from anomalyco/automation/sync-models-xai
chore(sync): update xAI model catalog
2026-05-21 13:05:20 -05:00
Aiden Cline 9769b2b11d Merge pull request #1823 from anomalyco/automation/sync-models-openrouter
chore(sync): update OpenRouter model catalog
2026-05-21 13:05:13 -05:00
github-actions[bot] 1b0db099cf chore(sync): update OpenRouter model catalog 2026-05-21 17:56:13 +00:00
github-actions[bot] 16ed78587c chore(sync): update xAI model catalog 2026-05-21 17:56:11 +00:00
Frank 0b88965165 update zen models 2026-05-21 13:41:55 -04:00
Aiden Cline acc704ce39 Merge pull request #1797 from arnavchachra/add-crof-provider
add crof.ai provider with 21 models
2026-05-21 11:43:02 -05:00
Aiden Cline 51ad3b264e Merge pull request #1821 from anomalyco/sync-provider-ci
chore: automate provider sync jobs
2026-05-21 11:23:49 -05:00
Aiden Cline 146b6c7084 Merge pull request #1819 from Inceptron-Software/add_inceptron_provider
Add Inceptron provider
2026-05-21 11:21:27 -05:00
Aiden Cline 0e3cbe3c64 chore: automate provider sync jobs 2026-05-21 11:21:12 -05:00
Aiden Cline 604d4d66a4 Merge pull request #1820 from Suat-B/codex/xpersona-image-input-20260521
Add image input modality to Xpersona model
2026-05-21 11:00:49 -05:00
SuatB f5090028b8 Add image input modality to Xpersona model 2026-05-21 09:46:28 -05:00
Frank 4bad8faf29 update zen models 2026-05-21 09:05:13 -04:00
Oskar Gustafsson 0df2ccf586 Add Inceptron provider 2026-05-21 09:24:43 +02:00
Aiden Cline bafdc00b45 Merge pull request #1812 from anomalyco/openrouter-extends-sync
Sync OpenRouter models with extends
2026-05-20 21:07:21 -05:00
Aiden Cline 49840c013b Merge pull request #1814 from neonn0d/feat/stepfun-ai
feat(stepfun-ai): add international StepFun platform
2026-05-20 20:58:37 -05:00
Aiden Cline eccae0b54e sync openrouter models with extends 2026-05-20 20:32:11 -05:00
Aiden Cline 4cca29405f Merge pull request #1817 from dpuyosa/dev
Venice: Remove Grok 4.1 Fast and add Grok Build 0.1
2026-05-20 20:26:45 -05:00
Aiden Cline e40d9dd338 Merge pull request #1818 from anomalyco/cloudflare-sync-env
chore(sync): isolate cloudflare credentials
2026-05-20 20:26:22 -05:00
Aiden Cline 6a74991397 chore(sync): isolate cloudflare credentials 2026-05-20 20:19:47 -05:00
dpuyosa 035999cb58 [venice] Replace Grok 4.1 Fast with Grok Build 0.1
- Remove deprecated grok-41-fast model entry
- Add grok-build-0-1 with 200K token tiered pricing
- Update context to 256K and output limit to 65,536
2026-05-21 02:36:19 +02:00
Frank cec56bf1bc update zen models 2026-05-20 19:43:25 -04:00
Aiden Cline 85f0cdcb2f Merge pull request #1816 from anomalyco/xai-sync
Add PDF input modality to Grok models
2026-05-20 18:12:47 -05:00
Aiden Cline ef80d4df4e Infer PDF modality for xAI image models 2026-05-20 18:12:11 -05:00
Aiden Cline af0ef00109 Update xAI Grok PDF modalities 2026-05-20 18:06:33 -05:00
Aiden Cline 5fdcea6b36 Merge pull request #1815 from anomalyco/cloudflare-ai-gateway
chore(sync): add cloudflare workers ai sync
2026-05-20 18:02:28 -05:00
Aiden Cline 31e56480b4 chore(sync): add cloudflare workers ai sync 2026-05-20 16:55:29 -05:00
Aiden Cline 92a621594e Merge pull request #1813 from anomalyco/sync-xai
chore(sync): add xai model sync
2026-05-20 16:02:38 -05:00
Aiden Cline d2db353ceb chore: ignore sync reports 2026-05-20 16:01:51 -05:00
Aiden Cline 900ae509d2 Merge pull request #1808 from ajussak/scaleway
Added Mistral Medium 3.5 128B from Scaleway
2026-05-20 15:58:00 -05:00
neo 9d60164243 feat(stepfun-ai): add international StepFun platform
StepFun runs two separate platforms with distinct accounts/keys:
platform.stepfun.com (China, already covered by providers/stepfun) and
platform.stepfun.ai (international). Keys are not interchangeable
across the two — .ai keys are rejected by api.stepfun.com as
invalid_api_key.

Stepfun's own opencode integration guide instructs users to point at
https://api.stepfun.ai/step_plan/v1. This adds providers/stepfun-ai
for that endpoint, symlinking the shared chat models. Follows the
moonshotai / moonshotai-cn pattern.
2026-05-20 20:43:47 +02:00
Adrien Jussak cd3e99025f Update Mistral Medium 3.5 128B model configuration to extend from mistral-medium-2604 and adjust context window size. 2026-05-20 20:43:45 +02:00
Aiden Cline 1098981eb6 chore(sync): add xai model sync 2026-05-20 13:23:02 -05:00
Aiden Cline 27a151cf53 Merge pull request #1811 from anomalyco/xai-grok-build-model
Add xAI Grok Build model
2026-05-20 13:05:06 -05:00
Aiden Cline 41ff42ab7f Merge pull request #1810 from fhennerkes/dev
poe: add Gemini-3.5-Flash model
2026-05-20 13:04:47 -05:00
Aiden Cline adf1cbdecd add xai grok build model 2026-05-20 13:04:13 -05:00
Frank 10ddc78ce0 update zen models 2026-05-20 14:02:01 -04:00
fhennerkesandClaude Opus 4.7 7ae897e440 poe: add Gemini-3.5-Flash model
Add new Google model from Poe API (released 2026-05-19).
Uses extends format inheriting from google/gemini-3.5-flash with
Poe-specific overrides (name format, no temperature, markup pricing,
limited input modalities).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 10:52:15 -07:00
Aiden Cline 02e452c2e8 Merge pull request #1805 from anomalyco/sync-google
sync google models
2026-05-20 10:53:57 -05:00
Aiden Cline f05b63fff5 Merge pull request #1807 from anomalyco/automation/sync-models-aggregators
chore(sync): update aggregator model catalogs
2026-05-20 10:34:30 -05:00
Adrien Jussak e277d60236 Add Mistral Medium 3.5 128B to Scaleway 2026-05-20 16:14:37 +02:00
github-actions[bot] b01277a737 chore(sync): update aggregator model catalogs 2026-05-20 09:25:37 +00:00
Frank a5da5aa429 update zen models 2026-05-20 04:14:28 -04:00
Aiden Cline 5ceac8a58b updates 2026-05-19 23:43:01 -05:00
Aiden Cline 11e1d5623a Merge pull request #1806 from Cahl-Dee/grid-model-updates-2026-05
Grid model updates 2026-05
2026-05-19 23:42:26 -05:00
Aiden Cline f107afc57c sync 2026-05-19 22:56:50 -05:00
Carl DiClementi e789d7c1f2 Merge branch 'anomalyco:dev' into grid-model-updates-2026-05 2026-05-19 16:06:23 -05:00
Cahl-Dee 899668ad49 added new code and agent models and updated existing text models 2026-05-19 16:04:58 -05:00
Aiden Cline 8c677f0134 sync google models 2026-05-19 15:58:06 -05:00
Aiden Cline 462c7877d9 add gemini 3.5 flash 2026-05-19 15:43:38 -05:00
Aiden Cline 55871f9dca Merge pull request #1804 from Adanlink/dev
feat: add deepseek-v4-flash to the fireworks-ai provider
2026-05-19 15:29:33 -05:00
Aiden Cline 4f7194a3c8 test 2026-05-19 15:09:11 -05:00
Aiden Cline f65f0148da add sync guide 2026-05-19 15:08:44 -05:00
Adán 14952f8855 Rename deepseek-v4-flash to deepseek-v4-flash.toml 2026-05-19 18:56:43 +02:00
Adán d7c6d3ad12 Add deepseek-v4-flash model configuration 2026-05-19 18:53:48 +02:00
Aiden Cline 356bc79d08 Merge pull request #1637 from elvexai/fix/amazon-bedrock-kimi-token-limits
fix: Token limits for Amazon Bedrock Kimi K2 models
2026-05-19 09:42:30 -05:00
Aiden Cline a89b1ed726 Merge pull request #1801 from bas3line/sync-routing-run-models
Sync routing.run model catalog
2026-05-19 09:41:38 -05:00
bas3line a998576773 fix(routing-run): match live model metadata 2026-05-19 10:38:58 +05:30
bas3line fbe842bbea fix(routing-run): expose reasoning metadata 2026-05-19 08:39:51 +05:30
bas3line 6c0c3d1b10 fix(routing-run): sync model catalog 2026-05-19 07:37:53 +05:30
Aiden Cline db0a7cf611 Merge pull request #1798 from anomalyco/rework-sync-logic
sync: centralize aggregator model updates
2026-05-18 20:12:50 -05:00
Aiden Cline d775e37e3b Merge pull request #1800 from jerome-benoit/feat/sap-ai-core-gpt-5.4
feat(sap-ai-core): add GPT-5.4
2026-05-18 20:12:21 -05:00
Jérôme Benoit 36753063d9 feat(sap-ai-core): add GPT-5.4
Add gpt-5.4 with availability date from official SAP source.

Drop [[cost.tiers]] from gemini-2.5-pro pending SAP-side tiered
pricing confirmation; sap-ai-core now declares no per-model tiers
(SAP Note 3437766 is login-gated and authoritative for capacity
unit conversion rates).
2026-05-19 02:58:29 +02:00
Aiden Cline 5ee955297a sync: drop vercel catalog updates 2026-05-18 19:07:14 -05:00
Aiden Cline 1b77511903 Merge pull request #1799 from vglafirov/add-gitlab-gpt-5-5
feat(gitlab): add Agentic Chat (GPT-5.5) model
2026-05-18 15:24:18 -05:00
Aiden Cline 8896ead7bf sync: fix vercel pricing tiers 2026-05-18 14:52:40 -05:00
Vladimir Glafirov eb96594d47 feat(gitlab): add Agentic Chat (GPT-5.5) model
Adds duo-chat-gpt-5-5 to the GitLab provider. The GitLab AI Gateway
proxies this model to OpenAI's gpt-5.5-2026-04-23 backend with a
1.05M token context window (922k input + 128k output).

Source: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist
models.yml (gpt_5_5 entry with proxy_provider: openai).

The gitlab-ai-provider npm package exposes this model id starting in
v6.7.0.
2026-05-18 20:44:34 +02:00
Aiden Cline 327332efe3 Merge pull request #1794 from bas3line/add-routing-run-provider
Add routing.run provider
2026-05-18 12:32:34 -05:00
Aiden Cline 5020951745 sync: refresh openrouter after dev merge 2026-05-18 12:30:29 -05:00
Aiden Cline cb6f97774e Merge remote-tracking branch 'origin/dev' into rework-sync-logic 2026-05-18 12:29:28 -05:00
Aiden Cline 7f8b493b0c Merge pull request #1795 from delafthi/delafthi/lxxqxzktnozv
fix(providers/novita-ai): use lowercase model names
2026-05-18 12:28:32 -05:00
Aiden Cline d65a862533 sync: centralize aggregator model updates 2026-05-18 12:12:15 -05:00
arnavchachra 9420048dfe fix crof model limits and reasoning flag to match Crof API 2026-05-18 21:51:19 +05:30
arnavchachra 8db6c27634 add crof provider with 21 models 2026-05-18 21:40:11 +05:30
Victor Navarro 8e710e19ea bring back old bick-pickle
Added interleaved section with reasoning_content field and removed provider section.
2026-05-18 11:44:14 +02:00
Frank 36c6896e97 update zen models 2026-05-17 22:58:06 -04:00
Aiden Cline a8be548a5d Merge pull request #1416 from Luew2/add-lilac-provider
Add Lilac provider
2026-05-17 19:23:07 -05:00
Luew2 8c2fae4ab0 Keep exact Lilac Gemma model name 2026-05-17 17:19:53 -07:00
Luew2 5e7fad350d Align Lilac Gemma display name 2026-05-17 17:19:04 -07:00
Luew2 feb85ef2c9 Align Lilac provider with registry conventions 2026-05-17 17:15:40 -07:00
Luew2 d4161ebf24 Follow models.dev conventions for Lilac provider 2026-05-17 17:11:03 -07:00
Luew2 b91ab02e2b Add Lilac MiniMax M2.7 model 2026-05-17 17:07:44 -07:00
Luew2 dd09d07f75 Update Lilac Kimi model to K2.6 2026-05-17 17:07:44 -07:00
Luew2 4515f85d47 Add Lilac cache pricing 2026-05-17 17:07:44 -07:00
Luew2andClaude Opus 4.7 97572240e1 Add Gemma 4 31B IT model
Adds google/gemma-4-31b-it to the Lilac provider ($0.11/M input,
$0.35/M output, 262K context, native multimodal with image/video).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 17:07:44 -07:00
Luew2 80cc04e9e5 Fix Kimi K2.5 output limit to 262,144 tokens 2026-05-17 17:07:44 -07:00
Luew2 d532ebb89b Use purple gradient for Lilac logo (brand colors #6451dc → #b6a6f9) 2026-05-17 17:07:44 -07:00
Luew2 9bae3e887f Replace placeholder logo with Lilac icon mark (currentColor) 2026-05-17 17:07:44 -07:00
Luew2 0be69bf872 Add Lilac provider
Add Lilac as an OpenAI-compatible provider serving:
- z-ai/glm-5.1: Z.ai's flagship agentic model (754B MoE, 202.8K context)
- moonshotai/kimi-k2.5: Moonshot AI's multimodal reasoning model (1T MoE, 262K context)

API: https://api.getlilac.com/v1
Docs: https://docs.getlilac.com
2026-05-17 17:07:44 -07:00
Thierry Delafontaine 0ed38cbecf fix(providers/novita-ai): use lowercase model names
Mixed case naming causes conflicts on case-insensitive filesystems like macOS.
2026-05-17 21:17:46 +02:00
bas3line e65703382a feat: add routing.run provider 2026-05-17 20:27:56 +05:30
Aiden Cline 748754c99b Merge pull request #1792 from monotykamary/fix/neuralwatt-context-limits
fix(neuralwatt): sync context window and output limits with upstream API
2026-05-16 13:14:05 -05:00
Tom X Nguyen ec9c12d0fc fix(neuralwatt): sync context window and output limits with upstream API
Updates all 14 neuralwatt model TOML files with corrected context window
and max output token values as reported by the Neuralwatt API:

- Devstral-Small-2-24B-Instruct-2512: 262,144 -> 262,128
- GLM-5/GLM-5.1 variants: 200,000 -> 202,736
- GPT-OSS-20B: 16,384 -> 16,368
- Kimi-K2.5/K2.6 variants: 262,144 -> 262,128
- MiniMax-M2.5: 196,608 -> 196,592
- Qwen3.5-397B variants: 262,144 -> 262,128
- Qwen3.6-35B variants: 131,072 -> 131,056

Also fixes the README: moves kimi-k2.6-fast from 'Reasoning Models' to
'Fast Variants' and removes incorrect claim that fast variants support
reasoning.
2026-05-16 23:16:34 +07:00
Aiden Cline ac81822c89 Merge pull request #1777 from berget-ai/feat/berget-kimi-k2.6
feat: add Kimi K2.6 to berget.ai
2026-05-16 06:09:00 -05:00
Aiden Cline d32ed764bd Merge pull request #1791 from anomalyco/automation/sync-openrouter-models
Sync OpenRouter models
2026-05-16 06:08:09 -05:00
Christian Landgren 45fb951c42 feat: add Kimi K2.6 to berget.ai
Add Moonshot AI Kimi K2.6 model to berget.ai provider catalog.

- 262K context window
- 16K output tokens
- Text input/output
- Supports: reasoning, structured output, tool calling
- Pricing: /bin/zsh.83/M input, .85/M output (EUR-based)
- Open weights
2026-05-16 12:46:35 +02:00
github-actions[bot] 260d79b2d5 Sync OpenRouter models 2026-05-16 08:54:41 +00:00
Aiden Cline 746b9caf79 Merge pull request #1785 from jerome-benoit/feat/sap-ai-core-opus-4-7
feat(sap-ai-core): add Claude Opus 4.7 and sync model specs
2026-05-15 23:24:47 -05:00
Aiden Cline 8362b55503 Merge pull request #1786 from Ardakilic/chore/kilo-sync-20260516
providers(kilo): sync upstream
2026-05-15 23:24:34 -05:00
Aiden Cline dde3953a9f Merge pull request #1787 from Suat-B/codex/xpersona-www-api-url
Fix Xpersona API base URL
2026-05-15 23:24:06 -05:00
Aiden Cline 0a1695212c Merge pull request #1788 from Jaaneek/xai-may-15-2026-retirement
xai: drop models retired May 15, 2026 + add Grok Imagine models
2026-05-15 23:23:52 -05:00
Jaaneek 89fbb6bb69 xai: drop models retired May 15, 2026 + add Grok Imagine models 2026-05-16 01:57:15 +01:00
SuatB 005fe0fb5a Fix Xpersona provider API URL 2026-05-15 18:37:41 -05:00
Frank e283875ce7 update zen models 2026-05-15 17:24:53 -04:00
Arda Kilicdagi 3598019251 providers(kilo): sync upstream 2026-05-16 01:11:25 +04:00
Jérôme Benoit e9ad8b0a3f feat(sap-ai-core): add Claude Opus 4.7 and sync model specs 2026-05-15 22:16:07 +02:00
Aiden Cline 0ee78eeda5 sync: openrouter models 2026-05-15 10:20:36 -05:00
Aiden Cline 0a5b33e518 Merge pull request #1778 from zhenjunchen-png/add-orcarouter
feat: add OrcaRouter as a new provider
2026-05-15 10:16:29 -05:00
Aiden Cline 22416dda64 Merge pull request #1783 from anomalyco/sync-openrouter
add sync script for openrouter, sync openrouter models
2026-05-15 10:12:02 -05:00
zhenjun.chen 022b1b9946 feat(orcarouter): expand to 80 chat models and add brand logo
Adds 55 additional upstream-mirrored models alongside the existing 25,
covering the full OrcaRouter chat catalog as exposed by
https://www.orcarouter.ai/api/pricing (text-only chat — TTS, embeddings,
video, and image generation are filtered out).

Per-namespace upstream mappings used by [extends]:

  OrcaRouter ns  -> models.dev provider
  ---------------- + ---------------
  openai         -> openai
  anthropic      -> anthropic   (dot version -> dash, e.g. opus-4.7 -> opus-4-7)
  google         -> google
  deepseek       -> deepseek
  qwen           -> alibaba
  grok           -> xai
  kimi           -> moonshotai
  minimax        -> minimax     (minimax-m2.7 -> MiniMax-M2.7)
  z-ai           -> zai

OrcaRouter-specific aliases (dated snapshots like gpt-5-2025-08-07,
search-preview variants, qwen3-vl-* visual variants) are excluded from
v1 because their upstream canonical files do not yet exist in models.dev.

Also adds providers/orcarouter/logo.svg.
2026-05-15 14:48:31 +08:00
zhenjun.chen 699284ce91 chore(orcarouter): drop oversize logo, fall back to models.dev default
The previously committed logo is ~100KB; existing wrapper-provider logos
(openrouter, llmgateway, kilo, aihubmix, ambient) are all 0.3-6KB and use
`currentColor`. Falling back to the default logo per README:

  > If we don't have a provider's logo, a default logo is served instead.

A properly-sized currentColor logo will follow in a separate PR.
2026-05-14 21:37:48 +08:00
zhenjun.chen 7102978cb4 feat: add OrcaRouter provider
OrcaRouter is an OpenAI-compatible meta-router aggregating 150+ LLMs
(OpenAI, Anthropic, Google, xAI, DeepSeek, Qwen, Kimi, MiniMax, ...)
behind a single API key, with a virtual orcarouter/auto smart-routing
entry that picks an upstream per request.

This initial scope covers 26 models (1 AUTO router + 25 upstream mirrors
using [extends]). Pricing computed from https://www.orcarouter.ai/api/pricing
on 2026-05-14: input = model_ratio * $2, output = model_ratio *
completion_ratio * $2 (USD per 1M tokens).

Disclosure: I'm an engineer on the OrcaRouter team.
2026-05-14 20:55:47 +08:00
Mike Sukmanowsky 2cb5a99b98 fix: add model card links for Kimi K2 and Kimi K2.5 2026-04-29 09:29:36 -04:00
Mike Sukmanowsky 0c2e47e8ba Fix token limits for Amazon Bedrock Kimi K2 models
Correct context and output limits for moonshot.kimi-k2-thinking and
moonshotai.kimi-k2.5 on Amazon Bedrock:
- context: 256_000 → 262_143
- output: 256_000 → 16_000
2026-04-28 17:45:59 -04:00
503 changed files with 4735 additions and 2853 deletions

No files matched your search

+1
View File
@@ -35,3 +35,4 @@ jobs:
- run: bun sst deploy --stage=dev
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_DEFAULT_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_DEFAULT_ACCOUNT_ID }}
+107
View File
@@ -0,0 +1,107 @@
name: Sync Model Catalogs
on:
schedule:
- cron: "17 * * * *"
workflow_dispatch:
permissions:
contents: write
issues: write
pull-requests: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
providers:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.providers.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
ref: dev
- name: Setup Bun
uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: List sync providers
id: providers
run: echo "matrix=$(bun models:sync --list-providers)" >> "$GITHUB_OUTPUT"
sync:
needs: providers
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.providers.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
ref: dev
- name: Setup Bun
uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Sync model catalogs
run: bun models:sync ${{ matrix.provider }}
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID }}
CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN }}
- name: Validate models
run: bun validate
- name: Create pull request
env:
GH_TOKEN: ${{ github.token }}
BRANCH: automation/sync-models-${{ matrix.provider }}
LABELS: automation,model-sync,provider:${{ matrix.provider }}
TITLE: "chore(sync): update ${{ matrix.name }} model catalog"
run: |
if [ -z "$(git status --porcelain -- providers)" ]; then
echo "No model catalog changes found."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$BRANCH"
git add providers
git commit -m "$TITLE"
git push --force-with-lease origin "$BRANCH"
label_args=()
IFS=',' read -ra labels <<< "$LABELS"
for label in "${labels[@]}"; do
gh label create "$label" --color "0E8A16" --description "Automated model catalog sync" >/dev/null 2>&1 || true
label_args+=(--label "$label")
done
pr_number="$(gh pr list --head "$BRANCH" --base dev --json number --jq '.[0].number')"
if [ -n "$pr_number" ]; then
gh pr edit "$pr_number" --title "$TITLE" --body-file .sync/model-sync-report.md
for label in "${labels[@]}"; do
gh pr edit "$pr_number" --add-label "$label"
done
else
gh pr create --base dev --head "$BRANCH" --title "$TITLE" --body-file .sync/model-sync-report.md "${label_args[@]}"
fi
+1
View File
@@ -3,6 +3,7 @@
.idea
dist
.DS_Store
.sync/
node_modules
data/tokenspeed-monitor.sqlite
data/tokenspeed-monitor.sqlite-shm
+2 -1
View File
@@ -17,6 +17,7 @@
"scripts": {
"validate": "bun ./packages/core/script/validate.ts",
"compare:migrations": "bun ./packages/core/script/compare-model-migrations.ts",
"cloudflare:sync": "bun ./packages/core/script/sync-models.ts cloudflare-workers-ai",
"chutes:generate": "bun ./packages/core/script/generate-chutes.ts",
"databricks:generate": "bun ./packages/core/script/generate-databricks.ts",
"helicone:generate": "bun ./packages/core/script/generate-helicone.ts",
@@ -25,7 +26,7 @@
"wandb:generate": "bun ./packages/core/script/generate-wandb.ts",
"digitalocean:generate": "bun ./packages/core/script/generate-digitalocean.ts",
"ambient:generate": "bun ./packages/core/script/generate-ambient.ts",
"openrouter:sync": "bun ./packages/core/script/sync-openrouter.ts"
"models:sync": "bun ./packages/core/script/sync-models.ts"
},
"dependencies": {
"@cloudflare/workers-types": "^4.20260424.1",
+1 -1
View File
@@ -138,7 +138,7 @@ function humanizeModelName(modelId: string): string {
return modelPart.replace(/-/g, " ");
}
// ── Family inference (same approach as generate-vercel.ts) ───────────
// ── Family inference ───────────
function isSubstring(target: string, family: string): boolean {
return target.toLowerCase().includes(family.toLowerCase());
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bun
import { main } from "../src/sync/index.js";
await main();
-318
View File
@@ -1,318 +0,0 @@
#!/usr/bin/env bun
import path from "node:path";
import { mkdir, rm } from "node:fs/promises";
import { z } from "zod";
import { ModelFamilyValues } from "../src/family.js";
import { AuthoredModel, AuthoredModelShape } from "../src/schema.js";
const API_ENDPOINT = "https://openrouter.ai/api/v1/models";
const OpenRouterModel = z
.object({
id: z.string(),
name: z.string(),
created: z.number(),
hugging_face_id: z.string().nullable(),
knowledge_cutoff: z.string().nullable(),
context_length: z.number(),
architecture: z.object({
input_modalities: z.array(z.string()),
output_modalities: z.array(z.string()),
}),
pricing: z
.object({
prompt: z.string(),
completion: z.string(),
internal_reasoning: z.string().optional(),
input_cache_read: z.string().optional(),
input_cache_write: z.string().optional(),
}),
top_provider: z.object({
context_length: z.number().nullable(),
max_completion_tokens: z.number().nullable(),
}),
supported_parameters: z.array(z.string()),
});
const OpenRouterResponse = z
.object({
data: z.array(OpenRouterModel),
})
.passthrough();
const ExistingModel = AuthoredModelShape.partial()
.extend({
extends: z
.object({
from: z.string(),
omit: z.array(z.string()).optional(),
})
.strict()
.optional(),
})
.strict();
type OpenRouterModel = z.infer<typeof OpenRouterModel>;
type ExistingModel = z.infer<typeof ExistingModel>;
function dateFromTimestamp(timestamp: number | undefined) {
if (timestamp === undefined) return new Date().toISOString().slice(0, 10);
return new Date(timestamp * 1000).toISOString().slice(0, 10);
}
function formatInteger(n: number) {
return String(n).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
}
function quote(value: string) {
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
}
function price(value: string | undefined) {
if (value === undefined) return undefined;
const number = Number(value);
return Number.isFinite(number) && number >= 0
? Math.round(number * 1_000_000_000_000) / 1_000_000
: undefined;
}
function modality(value: string) {
return value === "file" ? "pdf" : value;
}
function modalities(values: string[] | undefined, fallback: string[]) {
const allowed = new Set(["text", "audio", "image", "video", "pdf"]);
const result = (values ?? fallback)
.map((value) => modality(value.toLowerCase()))
.filter((value) => allowed.has(value));
return [...new Set(result.length > 0 ? result : fallback)];
}
function inferFamily(model: OpenRouterModel, name: string) {
const target = `${model.id} ${name}`.toLowerCase();
return [...ModelFamilyValues]
.sort((a, b) => b.length - a.length)
.find((family) => {
const value = family.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
if (family === "o") {
return new RegExp(`(^|[^a-z0-9])${value}(?=\\d|$|[^a-z0-9])`).test(target);
}
return new RegExp(`(^|[^a-z0-9])${value}(?=$|[^a-z0-9])`).test(target);
});
}
function buildModel(model: OpenRouterModel, existing: ExistingModel | undefined) {
const params = new Set(model.supported_parameters ?? []);
const name = model.name.replace(/^[^:]+:\s+/, "");
const input = modalities(model.architecture?.input_modalities, ["text"]);
const output = modalities(model.architecture?.output_modalities, ["text"]);
const prompt = price(model.pricing?.prompt);
const completion = price(model.pricing?.completion);
const reasoning = params.has("reasoning") || params.has("include_reasoning");
const context = model.top_provider?.context_length ?? model.context_length ?? 0;
const maxOutput = model.top_provider?.max_completion_tokens ?? existing?.limit?.output ?? context;
const family = inferFamily(model, name);
return {
name,
family: existing?.family === "o" && family !== "o"
? family
: (existing?.family ?? family),
release_date: dateFromTimestamp(model.created),
last_updated: dateFromTimestamp(model.created),
attachment: input.some((value) => value !== "text"),
reasoning,
temperature: params.has("temperature"),
tool_call: params.has("tools") || params.has("tool_choice"),
structured_output:
params.has("structured_outputs") || params.has("response_format"),
knowledge: model.knowledge_cutoff?.slice(0, 10) ?? existing?.knowledge,
open_weights: Boolean(model.hugging_face_id),
status: existing?.status,
interleaved: existing?.interleaved,
cost:
prompt !== undefined && completion !== undefined
? {
input: prompt,
output: completion,
reasoning: reasoning ? price(model.pricing?.internal_reasoning) : undefined,
cache_read: price(model.pricing?.input_cache_read),
cache_write: price(model.pricing?.input_cache_write),
tiers: existing?.cost?.tiers,
}
: existing?.cost,
limit: {
context,
input: existing?.limit?.input,
output: maxOutput,
},
modalities: { input, output },
};
}
function formatToml(model: ReturnType<typeof buildModel>) {
const lines: string[] = [];
lines.push(`name = ${quote(model.name)}`);
if (model.family) lines.push(`family = ${quote(model.family)}`);
lines.push(`release_date = ${quote(model.release_date)}`);
lines.push(`last_updated = ${quote(model.last_updated)}`);
lines.push(`attachment = ${model.attachment}`);
lines.push(`reasoning = ${model.reasoning}`);
lines.push(`temperature = ${model.temperature}`);
lines.push(`tool_call = ${model.tool_call}`);
lines.push(`structured_output = ${model.structured_output}`);
if (model.knowledge) lines.push(`knowledge = ${quote(model.knowledge)}`);
lines.push(`open_weights = ${model.open_weights}`);
if (model.status) lines.push(`status = ${quote(model.status)}`);
if (model.interleaved !== undefined) {
lines.push("");
if (model.interleaved === true) {
lines.push("interleaved = true");
} else {
lines.push("[interleaved]");
lines.push(`field = ${quote(model.interleaved.field)}`);
}
}
if (model.cost) {
lines.push("");
lines.push("[cost]");
if (model.cost.input !== undefined) lines.push(`input = ${model.cost.input}`);
if (model.cost.output !== undefined) lines.push(`output = ${model.cost.output}`);
if (model.cost.reasoning !== undefined) {
lines.push(`reasoning = ${model.cost.reasoning}`);
}
if (model.cost.cache_read !== undefined) {
lines.push(`cache_read = ${model.cost.cache_read}`);
}
if (model.cost.cache_write !== undefined) {
lines.push(`cache_write = ${model.cost.cache_write}`);
}
for (const tier of model.cost.tiers ?? []) {
lines.push("");
lines.push("[[cost.tiers]]");
lines.push(`tier = { size = ${formatInteger(tier.tier.size)} }`);
if (tier.input !== undefined) lines.push(`input = ${tier.input}`);
if (tier.output !== undefined) lines.push(`output = ${tier.output}`);
if (tier.cache_read !== undefined) lines.push(`cache_read = ${tier.cache_read}`);
if (tier.cache_write !== undefined) lines.push(`cache_write = ${tier.cache_write}`);
}
}
lines.push("");
lines.push("[limit]");
lines.push(`context = ${formatInteger(model.limit.context)}`);
if (model.limit.input !== undefined) {
lines.push(`input = ${formatInteger(model.limit.input)}`);
}
lines.push(`output = ${formatInteger(model.limit.output)}`);
lines.push("");
lines.push("[modalities]");
lines.push(`input = [${model.modalities.input.map(quote).join(", ")}]`);
lines.push(`output = [${model.modalities.output.map(quote).join(", ")}]`);
return `${lines.join("\n")}\n`;
}
async function main() {
const dryRun = process.argv.includes("--dry-run");
const modelsDir = path.join(
import.meta.dirname,
"..",
"..",
"..",
"providers",
"openrouter",
"models",
);
const headers = process.env.OPENROUTER_API_KEY
? { Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}` }
: undefined;
const response = await fetch(API_ENDPOINT, { headers });
if (!response.ok) {
throw new Error(`OpenRouter request failed: ${response.status} ${response.statusText}`);
}
const parsed = OpenRouterResponse.safeParse(await response.json());
if (!parsed.success) throw parsed.error;
const existingFiles = new Set<string>();
for await (const file of new Bun.Glob("**/*.toml").scan({ cwd: modelsDir })) {
existingFiles.add(file);
}
let created = 0;
let updated = 0;
let removed = 0;
let unchanged = 0;
const apiFiles = new Set<string>();
for (const apiModel of parsed.data.data) {
const relativePath = `${apiModel.id}.toml`;
const filePath = path.join(modelsDir, relativePath);
const file = Bun.file(filePath);
const current = await file.exists() ? await file.text() : undefined;
const existing = current === undefined
? undefined
: ExistingModel.parse(Bun.TOML.parse(current));
const model = buildModel(apiModel, existing);
const next = formatToml(model);
const valid = AuthoredModel.safeParse({
id: relativePath.slice(0, -5),
...Bun.TOML.parse(next),
});
if (!valid.success) {
valid.error.cause = { relativePath };
throw valid.error;
}
apiFiles.add(relativePath);
if (current === undefined) {
created++;
if (dryRun) {
console.log(`Would create ${relativePath}`);
} else {
await mkdir(path.dirname(filePath), { recursive: true });
await Bun.write(filePath, next);
}
continue;
}
if (current !== next) {
updated++;
if (dryRun) {
console.log(`Would update ${relativePath}`);
} else {
await Bun.write(filePath, next);
}
} else {
unchanged++;
}
}
for (const relativePath of existingFiles) {
if (apiFiles.has(relativePath)) continue;
removed++;
if (dryRun) {
console.log(`Would remove ${relativePath}`);
} else {
await rm(path.join(modelsDir, relativePath));
}
}
console.log(
`${dryRun ? "Dry run: " : ""}${created} created, ${updated} updated, ${removed} removed, ${unchanged} unchanged`,
);
}
await main();
+1
View File
@@ -82,6 +82,7 @@ export const ModelFamilyValues = [
// xAI Grok
"grok",
"grok-build",
"grok-vision",
"grok-beta",
+481
View File
@@ -0,0 +1,481 @@
import path from "node:path";
import { mkdir, readdir, rm } from "node:fs/promises";
import { z } from "zod";
import { AuthoredModel, AuthoredModelShape } from "../schema.js";
import { cloudflareWorkersAi } from "./providers/cloudflare-workers-ai.js";
import { google } from "./providers/google.js";
import { openrouter } from "./providers/openrouter.js";
import { xai } from "./providers/xai.js";
const ExtendsConfig = z
.object({
from: z.string(),
omit: z.array(z.string()).optional(),
})
.strict();
const ExistingExtendsConfig = z
.object({
from: z.string(),
omit: z.array(z.string()).optional(),
})
.passthrough();
const ExistingModel = AuthoredModelShape.partial()
.extend({
extends: ExistingExtendsConfig.optional(),
})
.strict();
const SyncedExtendsModel = AuthoredModelShape.partial()
.extend({
id: z.string(),
extends: ExtendsConfig,
})
.strict();
const SyncedAuthoredModel = z.union([AuthoredModel, SyncedExtendsModel]);
export type ExistingModel = z.infer<typeof ExistingModel>;
export type SyncedFullModel = Omit<z.infer<typeof AuthoredModelShape>, "id">;
export type SyncedExtendsModel = Omit<z.infer<typeof SyncedExtendsModel>, "id">;
export type SyncedModel = SyncedFullModel | SyncedExtendsModel;
export interface SyncProvider<SourceModel> {
id: string;
name: string;
modelsDir: string;
skipCreates?: boolean;
sourceID?(model: SourceModel): string;
skippedNotice?(ids: string[]): string[];
fetchModels(): Promise<unknown>;
parseModels(raw: unknown): SourceModel[];
translateModel(
model: SourceModel,
context: { existing(id: string): ExistingModel | undefined },
): { id: string; model: SyncedModel } | undefined;
}
export interface SyncResult {
id: string;
name: string;
status: "changed" | "unchanged";
created: number;
updated: number;
deleted: number;
unchanged: number;
notices: string[];
files: Array<{ status: "created" | "updated" | "deleted"; path: string }>;
}
export const providers: {
"cloudflare-workers-ai": SyncProvider<any>;
google: SyncProvider<any>;
openrouter: SyncProvider<any>;
xai: SyncProvider<any>;
} = {
"cloudflare-workers-ai": cloudflareWorkersAi,
google,
openrouter,
xai,
};
export const groups = {
aggregators: ["openrouter"],
cloudflare: ["cloudflare-workers-ai"],
direct: ["google", "xai"],
} as const;
type ProviderID = keyof typeof providers;
interface SyncOptions {
dryRun?: boolean;
newOnly?: boolean;
}
export async function syncProviderByID(id: ProviderID, options: SyncOptions = {}) {
return syncProvider(providers[id], options);
}
export async function syncProvider<SourceModel>(
provider: SyncProvider<SourceModel>,
options: SyncOptions = {},
): Promise<SyncResult> {
console.log(`\nSyncing ${provider.name}...`);
const existing = await readExisting(provider.modelsDir);
const sourceModels = provider.parseModels(await provider.fetchModels());
const desired = new Map<string, { model: z.infer<typeof SyncedAuthoredModel>; content: string }>();
const skippedRemote: string[] = [];
for (const sourceModel of sourceModels) {
const translated = provider.translateModel(sourceModel, {
existing(id) {
return existing.get(`${id}.toml`)?.toml;
},
});
if (translated === undefined) {
if (provider.skipCreates) skippedRemote.push(provider.sourceID?.(sourceModel) ?? "unknown");
continue;
}
const relativePath = `${translated.id}.toml`;
if (provider.skipCreates && !existing.has(relativePath)) {
skippedRemote.push(translated.id);
continue;
}
if (desired.has(relativePath)) {
throw new Error(`Duplicate synced model path: ${provider.id}/${relativePath}`);
}
const parsed = SyncedAuthoredModel.safeParse({
id: translated.id,
...translated.model,
});
if (!parsed.success) {
parsed.error.cause = { provider: provider.id, path: relativePath };
throw parsed.error;
}
desired.set(relativePath, {
model: parsed.data,
content: formatToml(parsed.data),
});
}
const files: SyncResult["files"] = [];
let unchanged = 0;
for (const [relativePath, file] of desired) {
const filePath = path.join(provider.modelsDir, relativePath);
const current = existing.get(relativePath);
if (current === undefined) {
files.push({ status: "created", path: filePath });
if (options.dryRun) {
console.log(`Would create ${relativePath}`);
} else {
await mkdir(path.dirname(filePath), { recursive: true });
await Bun.write(filePath, file.content);
}
continue;
}
if (!sameModel(relativePath, current.toml, file.model)) {
if (options.newOnly) {
unchanged++;
continue;
}
files.push({ status: "updated", path: filePath });
if (options.dryRun) {
console.log(`Would update ${relativePath}`);
} else {
if (current.symlink) await rm(filePath, { force: true });
await Bun.write(filePath, file.content);
}
} else {
unchanged++;
}
}
for (const relativePath of existing.keys()) {
if (desired.has(relativePath)) continue;
if (options.newOnly) {
console.log(`Skipping removal in new-only mode: ${relativePath}`);
unchanged++;
continue;
}
const filePath = path.join(provider.modelsDir, relativePath);
files.push({ status: "deleted", path: filePath });
if (options.dryRun) {
console.log(`Would remove ${relativePath}`);
} else {
await rm(filePath, { force: true });
}
}
const result = summarize(provider, files, unchanged, provider.skippedNotice?.(skippedRemote) ?? []);
console.log(
`${options.dryRun ? "Dry run: " : ""}${result.created} created, ${result.updated} updated, ${result.deleted} removed, ${result.unchanged} unchanged`,
);
return result;
}
export async function syncTargets(target: string, options: SyncOptions = {}) {
const ids = target in groups
? groups[target as keyof typeof groups]
: target in providers
? [target as ProviderID]
: undefined;
if (ids === undefined) {
throw new Error(`Unknown sync target: ${target}`);
}
const results: SyncResult[] = [];
for (const id of ids) {
results.push(await syncProviderByID(id as ProviderID, options));
}
return results;
}
export function syncProviderMatrix() {
return {
include: Object.values(providers).map((provider) => ({
provider: provider.id,
name: provider.name,
})),
};
}
async function readExisting(modelsDir: string) {
const existing = new Map<string, { text: string; toml: ExistingModel; symlink: boolean }>();
for (const { file, symlink } of await tomlFiles(modelsDir)) {
const text = await Bun.file(path.join(modelsDir, file)).text();
const parsed = ExistingModel.safeParse(Bun.TOML.parse(text));
if (!parsed.success) {
parsed.error.cause = { path: path.join(modelsDir, file) };
throw parsed.error;
}
existing.set(file, { text, toml: parsed.data, symlink });
}
return existing;
}
async function tomlFiles(root: string, dir = "") {
const result: Array<{ file: string; symlink: boolean }> = [];
for (const entry of await readdir(path.join(root, dir), { withFileTypes: true })) {
const file = path.join(dir, entry.name);
if (entry.isDirectory()) {
result.push(...await tomlFiles(root, file));
} else if (entry.name.endsWith(".toml") && (entry.isFile() || entry.isSymbolicLink())) {
result.push({ file, symlink: entry.isSymbolicLink() });
}
}
return result;
}
function summarize(
provider: { id: string; name: string },
files: SyncResult["files"],
unchanged: number,
notices: string[],
): SyncResult {
return {
id: provider.id,
name: provider.name,
status: files.length > 0 ? "changed" : "unchanged",
created: files.filter((file) => file.status === "created").length,
updated: files.filter((file) => file.status === "updated").length,
deleted: files.filter((file) => file.status === "deleted").length,
unchanged,
notices,
files,
};
}
function sameModel(
relativePath: string,
current: ExistingModel,
desired: z.infer<typeof SyncedAuthoredModel>,
) {
const parsed = SyncedAuthoredModel.safeParse({
id: relativePath.slice(0, -5),
...current,
});
return parsed.success && stable(parsed.data) === stable(desired);
}
function stable(value: unknown): string {
if (Array.isArray(value)) {
const items = value.map(stable);
const ordered = value.every((item) => item === null || typeof item !== "object")
? items.sort()
: items;
return `[${ordered.join(",")}]`;
}
if (value !== null && typeof value === "object") {
return `{${Object.entries(value)
.filter(([, item]) => item !== undefined)
.sort(([a], [b]) => a.localeCompare(b))
.map(([key, item]) => `${JSON.stringify(key)}:${stable(item)}`)
.join(",")}}`;
}
return JSON.stringify(value);
}
async function writeReport(target: string, results: SyncResult[]) {
await mkdir(".sync", { recursive: true });
const lines = [
`Updates model TOMLs for the \`${target}\` sync target.`,
"",
"| Provider | Status | Created | Updated | Deleted |",
"| --- | --- | ---: | ---: | ---: |",
];
for (const result of results) {
lines.push(
`| ${result.name} | ${result.status} | ${result.created} | ${result.updated} | ${result.deleted} |`,
);
}
for (const result of results.filter((item) => item.files.length > 0)) {
lines.push("", `<details><summary>${result.name} changed files</summary>`, "");
for (const file of result.files) {
lines.push(`- ${file.status}: \`${file.path}\``);
}
lines.push("", "</details>");
}
const noticeResults = results.filter((item) => item.notices.length > 0);
if (noticeResults.length > 0) {
lines.push("", "## Notices");
for (const result of noticeResults) {
lines.push("", `### ${result.name}`);
for (const notice of result.notices) {
lines.push(`- ${notice}`);
}
}
}
lines.push("", "This PR was created automatically by the daily model sync workflow.");
await Bun.write(".sync/model-sync-report.md", `${lines.join("\n")}\n`);
}
function quote(value: string) {
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
}
function formatInteger(n: number) {
return String(n).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
}
function formatNumber(n: number) {
return Number.isInteger(n) ? formatInteger(n) : String(n);
}
function formatToml(model: z.infer<typeof SyncedAuthoredModel>) {
const lines: string[] = [];
const extendsLines: string[] = [];
if ("extends" in model) {
extendsLines.push("[extends]");
extendsLines.push(`from = ${quote(model.extends.from)}`);
if (model.extends.omit !== undefined) {
extendsLines.push(`omit = [${model.extends.omit.map(quote).join(", ")}]`);
}
}
if (model.name !== undefined) lines.push(`name = ${quote(model.name)}`);
if (model.family !== undefined) lines.push(`family = ${quote(model.family)}`);
if (model.release_date !== undefined) lines.push(`release_date = ${quote(model.release_date)}`);
if (model.last_updated !== undefined) lines.push(`last_updated = ${quote(model.last_updated)}`);
if (model.attachment !== undefined) lines.push(`attachment = ${model.attachment}`);
if (model.reasoning !== undefined) lines.push(`reasoning = ${model.reasoning}`);
if (model.temperature !== undefined) lines.push(`temperature = ${model.temperature}`);
if (model.tool_call !== undefined) lines.push(`tool_call = ${model.tool_call}`);
if (model.structured_output !== undefined) {
lines.push(`structured_output = ${model.structured_output}`);
}
if (model.knowledge !== undefined) lines.push(`knowledge = ${quote(model.knowledge)}`);
if (model.open_weights !== undefined) lines.push(`open_weights = ${model.open_weights}`);
if (model.status !== undefined) lines.push(`status = ${quote(model.status)}`);
if (extendsLines.length > 0) {
if (lines.length > 0) lines.push("");
lines.push(...extendsLines);
}
if (model.interleaved !== undefined) {
lines.push("");
if (model.interleaved === true) {
lines.push("interleaved = true");
} else {
lines.push("[interleaved]");
lines.push(`field = ${quote(model.interleaved.field)}`);
}
}
if (model.cost !== undefined) {
lines.push("", "[cost]");
lines.push(`input = ${formatNumber(model.cost.input)}`);
lines.push(`output = ${formatNumber(model.cost.output)}`);
if (model.cost.reasoning !== undefined) {
lines.push(`reasoning = ${formatNumber(model.cost.reasoning)}`);
}
if (model.cost.cache_read !== undefined) {
lines.push(`cache_read = ${formatNumber(model.cost.cache_read)}`);
}
if (model.cost.cache_write !== undefined) {
lines.push(`cache_write = ${formatNumber(model.cost.cache_write)}`);
}
if (model.cost.input_audio !== undefined) {
lines.push(`input_audio = ${formatNumber(model.cost.input_audio)}`);
}
if (model.cost.output_audio !== undefined) {
lines.push(`output_audio = ${formatNumber(model.cost.output_audio)}`);
}
for (const tier of model.cost.tiers ?? []) {
lines.push("", "[[cost.tiers]]");
lines.push(`tier = { size = ${formatInteger(tier.tier.size)} }`);
lines.push(`input = ${formatNumber(tier.input)}`);
lines.push(`output = ${formatNumber(tier.output)}`);
if (tier.reasoning !== undefined) lines.push(`reasoning = ${formatNumber(tier.reasoning)}`);
if (tier.cache_read !== undefined) lines.push(`cache_read = ${formatNumber(tier.cache_read)}`);
if (tier.cache_write !== undefined) lines.push(`cache_write = ${formatNumber(tier.cache_write)}`);
}
}
if (model.limit !== undefined) {
lines.push("", "[limit]");
if (model.limit.context !== undefined) lines.push(`context = ${formatInteger(model.limit.context)}`);
if (model.limit.input !== undefined) lines.push(`input = ${formatInteger(model.limit.input)}`);
if (model.limit.output !== undefined) lines.push(`output = ${formatInteger(model.limit.output)}`);
}
if (model.modalities !== undefined) {
lines.push("", "[modalities]");
if (model.modalities.input !== undefined) {
lines.push(`input = [${model.modalities.input.map(quote).join(", ")}]`);
}
if (model.modalities.output !== undefined) {
lines.push(`output = [${model.modalities.output.map(quote).join(", ")}]`);
}
}
return `${lines.join("\n")}\n`;
}
export async function main(args = process.argv.slice(2)) {
if (args.includes("--list-providers")) {
console.log(JSON.stringify(syncProviderMatrix()));
return;
}
const target = args.find((arg) => !arg.startsWith("-")) ?? "aggregators";
const results = await syncTargets(target, {
dryRun: args.includes("--dry-run"),
newOnly: args.includes("--new-only"),
});
await writeReport(target, results);
console.log("\nSync summary");
for (const result of results) {
console.log(
`${result.name}: ${result.created} created, ${result.updated} updated, ${result.deleted} deleted`,
);
}
}
if (import.meta.main) await main();
@@ -0,0 +1,176 @@
import { z } from "zod";
import type { ExistingModel, SyncProvider } from "../index.js";
import {
buildOpenRouterModel,
OpenRouterModel,
OpenRouterResponse,
} from "./openrouter.js";
const API_BASE = "https://api.cloudflare.com/client/v4/accounts";
const CloudflareOpenRouterResponse = z.object({
result: z.union([OpenRouterResponse, z.array(OpenRouterModel)]).optional(),
result_info: z.object({
page: z.number().optional(),
total_pages: z.number().optional(),
}).passthrough().optional(),
}).passthrough();
const CloudflareModel = z.object({
id: z.string(),
name: z.string(),
created: z.number(),
hugging_face_id: z.string().nullable().optional(),
context_length: z.number(),
max_output_length: z.number().nullable().optional(),
input_modalities: z.array(z.string()).optional(),
output_modalities: z.array(z.string()).optional(),
pricing: z.object({
prompt: z.string(),
completion: z.string(),
internal_reasoning: z.string().optional(),
input_cache_read: z.string().optional(),
input_cache_write: z.string().optional(),
}),
supported_features: z.array(z.string()).optional(),
supported_sampling_parameters: z.array(z.string()).optional(),
}).passthrough();
const CloudflareResponse = z.object({
data: z.array(CloudflareModel),
}).passthrough();
type CloudflareModel = z.infer<typeof CloudflareModel>;
export const cloudflareWorkersAi = {
id: "cloudflare-workers-ai",
name: "Cloudflare Workers AI",
modelsDir: "providers/cloudflare-workers-ai/models",
async fetchModels() {
const accountID = process.env.CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID;
const token = process.env.CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN;
if (accountID === undefined || token === undefined) {
throw new Error(
"Cloudflare Workers AI sync requires CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID and CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN",
);
}
const first = await fetchPage(accountID, token, 1);
const models = parseCloudflareModels(first);
const pageInfo = CloudflareOpenRouterResponse.safeParse(first).success
? CloudflareOpenRouterResponse.parse(first).result_info
: undefined;
for (let page = 2; page <= (pageInfo?.total_pages ?? 1); page++) {
models.push(...parseCloudflareModels(await fetchPage(accountID, token, page)));
}
return { data: models };
},
parseModels(raw) {
return parseCloudflareModels(raw);
},
translateModel(model, context) {
const normalized = normalizeModel(model);
const id = normalized.id.replace(/^workers-ai\//, "");
return {
id,
model: buildWorkersAiModel(normalized, context.existing(id)),
};
},
} satisfies SyncProvider<CloudflareModel>;
function buildWorkersAiModel(model: z.infer<typeof OpenRouterModel>, existing: ExistingModel | undefined) {
const synced = buildOpenRouterModel(model, existing);
return {
...synced,
name: existing?.name ?? synced.name,
release_date: existing?.release_date ?? synced.release_date,
last_updated: existing?.last_updated ?? synced.last_updated,
limit: {
...synced.limit,
output: existing?.limit?.output ?? synced.limit.output,
},
};
}
async function fetchPage(accountID: string, token: string, page: number) {
const url = new URL(`${API_BASE}/${accountID}/ai/models/search`);
url.searchParams.set("format", "openrouter");
url.searchParams.set("per_page", "1000");
url.searchParams.set("page", String(page));
const response = await fetch(url, {
headers: { Authorization: `Bearer ${token}` },
});
if (!response.ok) {
throw new Error(
`Cloudflare Workers AI models request failed: ${response.status} ${response.statusText}${await responseDetails(response)}`,
);
}
return response.json();
}
function parseCloudflareModels(raw: unknown) {
const cloudflare = CloudflareResponse.safeParse(raw);
if (cloudflare.success) return cloudflare.data.data;
const direct = OpenRouterResponse.safeParse(raw);
if (direct.success) return direct.data.data;
const wrapped = CloudflareOpenRouterResponse.parse(raw);
if (wrapped.result === undefined) {
throw new Error("Cloudflare Workers AI response did not include model data");
}
return Array.isArray(wrapped.result) ? wrapped.result : wrapped.result.data;
}
function normalizeModel(model: CloudflareModel) {
if ("architecture" in model && "top_provider" in model && "supported_parameters" in model) {
return OpenRouterModel.parse(model);
}
return OpenRouterModel.parse({
id: model.id.startsWith("@cf/") ? model.id : `@cf/${model.id.replace(/^@cf\//, "")}`,
name: model.name,
created: model.created,
hugging_face_id: model.hugging_face_id ?? null,
knowledge_cutoff: null,
context_length: model.context_length,
architecture: {
input_modalities: model.input_modalities ?? ["text"],
output_modalities: model.output_modalities ?? ["text"],
},
pricing: model.pricing,
top_provider: {
context_length: model.context_length,
max_completion_tokens: model.max_output_length ?? null,
},
supported_parameters: [
...model.supported_sampling_parameters ?? [],
...model.supported_features ?? [],
],
});
}
async function responseDetails(response: Response) {
const text = await response.text();
if (text.length === 0) return "";
try {
const body = z.object({
errors: z.array(z.object({
code: z.union([z.string(), z.number()]).optional(),
message: z.string().optional(),
}).passthrough()).optional(),
}).passthrough().parse(JSON.parse(text));
const details = body.errors
?.map((error) => [error.code, error.message].filter(Boolean).join(": "))
.filter((message) => message.length > 0)
.join("; ");
return details === undefined || details.length === 0 ? "" : ` (${details})`;
} catch {
return "";
}
}
+138
View File
@@ -0,0 +1,138 @@
import { z } from "zod";
import type { ExistingModel, SyncProvider, SyncedModel } from "../index.js";
const API_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/models";
const GoogleModel = z.object({
name: z.string(),
baseModelId: z.string().optional(),
version: z.string().optional(),
displayName: z.string().optional(),
description: z.string().optional(),
inputTokenLimit: z.number().int().nonnegative(),
outputTokenLimit: z.number().int().nonnegative(),
supportedGenerationMethods: z.array(z.string()).optional(),
temperature: z.number().optional(),
topP: z.number().optional(),
topK: z.number().optional(),
maxTemperature: z.number().optional(),
thinking: z.boolean().optional(),
}).passthrough();
const GoogleResponse = z.object({
models: z.array(GoogleModel).optional(),
nextPageToken: z.string().optional(),
}).passthrough();
type GoogleModel = z.infer<typeof GoogleModel>;
export const google = {
id: "google",
name: "Google",
modelsDir: "providers/google/models",
skipCreates: true,
sourceID(model) {
return model.name.replace(/^models\//, "");
},
skippedNotice(ids) {
if (ids.length === 0) return [];
return [
`${ids.length} Google models returned by the API were not created because the Models API does not provide authoritative modalities, pricing, knowledge cutoff, release date, tool calling, or structured output metadata. Existing models are still updated from API-authoritative fields.`,
`Skipped remote IDs: ${ids.map((id) => `\`${id}\``).join(", ")}`,
];
},
async fetchModels() {
const key = process.env.GOOGLE_API_KEY
?? process.env.GEMINI_API_KEY
?? process.env.GOOGLE_GENERATIVE_AI_API_KEY;
if (key === undefined) {
throw new Error("Google sync requires GOOGLE_API_KEY, GEMINI_API_KEY, or GOOGLE_GENERATIVE_AI_API_KEY");
}
const models: GoogleModel[] = [];
let pageToken: string | undefined;
do {
const url = new URL(API_ENDPOINT);
url.searchParams.set("key", key);
url.searchParams.set("pageSize", "1000");
if (pageToken !== undefined) url.searchParams.set("pageToken", pageToken);
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Google models request failed: ${response.status} ${response.statusText}`);
}
const page = GoogleResponse.parse(await response.json());
models.push(...page.models ?? []);
pageToken = page.nextPageToken;
} while (pageToken !== undefined);
return { models };
},
parseModels(raw) {
return GoogleResponse.parse(raw).models ?? [];
},
translateModel(model, context) {
const id = model.name.replace(/^models\//, "");
const existing = context.existing(id);
if (existing === undefined) return undefined;
return {
id,
model: buildModel(model, existing),
};
},
} satisfies SyncProvider<GoogleModel>;
function buildModel(model: GoogleModel, existing: ExistingModel): SyncedModel {
const name = existing.name;
const releaseDate = existing.release_date;
const lastUpdated = existing.last_updated;
const attachment = existing.attachment;
const reasoning = existing.reasoning;
const toolCall = existing.tool_call;
const openWeights = existing.open_weights;
const limit = existing.limit;
const modalities = existing.modalities;
if (
name === undefined
|| releaseDate === undefined
|| lastUpdated === undefined
|| attachment === undefined
|| reasoning === undefined
|| toolCall === undefined
|| openWeights === undefined
|| limit === undefined
|| modalities === undefined
) {
throw new Error(`Google model ${model.name} has incomplete local TOML metadata required for sync`);
}
return {
name: model.displayName ?? name,
family: existing.family,
release_date: releaseDate,
last_updated: lastUpdated,
attachment,
reasoning: model.thinking ?? reasoning,
temperature: model.temperature !== undefined || model.maxTemperature !== undefined
? true
: existing.temperature,
tool_call: toolCall,
structured_output: existing.structured_output,
knowledge: existing.knowledge,
open_weights: openWeights,
status: existing.status,
interleaved: existing.interleaved,
cost: existing.cost,
limit: {
input: limit.input,
context: model.inputTokenLimit,
output: model.outputTokenLimit,
},
modalities,
};
}
@@ -0,0 +1,334 @@
import { z } from "zod";
import { readFileSync, readdirSync } from "node:fs";
import path from "node:path";
import { ModelFamilyValues } from "../../family.js";
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
const API_ENDPOINT = "https://openrouter.ai/api/v1/models";
const PROVIDERS_DIR = path.join(import.meta.dirname, "..", "..", "..", "..", "..", "providers");
const modelFilesByProvider = new Map<string, Set<string>>();
const canonicalTomlByModel = new Map<string, Record<string, unknown>>();
const CANONICAL_PROVIDER_PREFIXES = {
anthropic: "anthropic",
cohere: "cohere",
deepseek: "deepseek",
google: "google",
meta: "llama",
"meta-llama": "llama",
minimax: "minimax",
mistralai: "mistral",
moonshotai: "moonshotai",
openai: "openai",
"x-ai": "xai",
xai: "xai",
xiaomi: "xiaomi",
zai: "zai",
"z-ai": "zai",
} as const;
export const OpenRouterModel = z.object({
id: z.string(),
name: z.string(),
created: z.number(),
hugging_face_id: z.string().nullable(),
knowledge_cutoff: z.string().nullable(),
context_length: z.number(),
architecture: z.object({
input_modalities: z.array(z.string()),
output_modalities: z.array(z.string()),
}),
pricing: z.object({
prompt: z.string(),
completion: z.string(),
internal_reasoning: z.string().optional(),
input_cache_read: z.string().optional(),
input_cache_write: z.string().optional(),
}),
top_provider: z.object({
context_length: z.number().nullable(),
max_completion_tokens: z.number().nullable(),
}),
supported_parameters: z.array(z.string()),
});
export const OpenRouterResponse = z.object({
data: z.array(OpenRouterModel),
}).passthrough();
export type OpenRouterModel = z.infer<typeof OpenRouterModel>;
export const openrouter = {
id: "openrouter",
name: "OpenRouter",
modelsDir: "providers/openrouter/models",
async fetchModels() {
const headers = process.env.OPENROUTER_API_KEY
? { Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}` }
: undefined;
const response = await fetch(API_ENDPOINT, { headers });
if (!response.ok) {
throw new Error(`OpenRouter request failed: ${response.status} ${response.statusText}`);
}
return response.json();
},
parseModels(raw) {
return OpenRouterResponse.parse(raw).data;
},
translateModel(model, context) {
return {
id: model.id,
model: buildOpenRouterModel(model, context.existing(model.id)),
};
},
} satisfies SyncProvider<OpenRouterModel>;
function dateFromTimestamp(timestamp: number) {
return new Date(timestamp * 1000).toISOString().slice(0, 10);
}
function price(value: string | undefined) {
if (value === undefined) return undefined;
const number = Number(value);
return Number.isFinite(number) && number >= 0
? Math.round(number * 1_000_000_000_000) / 1_000_000
: undefined;
}
type Modality = "text" | "audio" | "image" | "video" | "pdf";
function modalities(values: string[], fallback: Modality[]): Modality[] {
const allowed = new Set<Modality>(["text", "audio", "image", "video", "pdf"]);
const result = values
.map((value) => value.toLowerCase())
.map((value) => value === "file" ? "pdf" : value)
.filter((value): value is Modality => allowed.has(value as Modality));
return [...new Set(result.length > 0 ? result : fallback)];
}
function inferFamily(model: OpenRouterModel, name: string) {
const target = `${model.id} ${name}`.toLowerCase();
return [...ModelFamilyValues]
.sort((a, b) => b.length - a.length)
.find((family) => {
const value = family.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
if (family === "o") {
return new RegExp(`(^|[^a-z0-9])${value}(?=\\d|$|[^a-z0-9])`).test(target);
}
return new RegExp(`(^|[^a-z0-9])${value}(?=$|[^a-z0-9])`).test(target);
});
}
export function buildOpenRouterModel(model: OpenRouterModel, existing: ExistingModel | undefined): SyncedModel {
const params = new Set(model.supported_parameters);
const name = model.name.replace(/^[^:]+:\s+/, "");
const input = modalities(model.architecture.input_modalities, ["text"]);
const output = modalities(model.architecture.output_modalities, ["text"]);
const prompt = price(model.pricing.prompt);
const completion = price(model.pricing.completion);
const reasoning = params.has("reasoning") || params.has("include_reasoning");
const context = model.top_provider.context_length ?? model.context_length;
const family = inferFamily(model, name);
const releaseDate = dateFromTimestamp(model.created);
const familyValue = existing?.family === "o" && family !== "o"
? family
: (existing?.family ?? family);
const attachment = input.some((value) => value !== "text");
const toolCall = params.has("tools") || params.has("tool_choice");
const structuredOutput = params.has("structured_outputs");
const knowledge = model.knowledge_cutoff?.slice(0, 10) ?? existing?.knowledge;
const openWeights = Boolean(model.hugging_face_id);
const cost = prompt !== undefined && completion !== undefined
? {
input: prompt,
output: completion,
reasoning: reasoning ? price(model.pricing.internal_reasoning) : undefined,
cache_read: price(model.pricing.input_cache_read),
cache_write: price(model.pricing.input_cache_write),
tiers: existing?.cost?.tiers,
}
: existing?.cost;
const limit = {
context,
input: existing?.limit?.input,
output: model.top_provider.max_completion_tokens ?? existing?.limit?.output ?? context,
};
const canonical = resolveCanonicalModel(model.id);
if (canonical !== undefined) {
return {
extends: {
from: canonical.from,
omit: canonicalOmit(canonical.provider, canonical.modelID, cost, limit),
},
...canonicalRuntimeOverrides(canonical.provider, canonical.modelID, {
name: model.id.endsWith(":free") ? name : undefined,
attachment,
reasoning,
}),
temperature: params.has("temperature"),
tool_call: toolCall,
structured_output: structuredOutput,
status: existing?.status,
interleaved: existing?.interleaved,
cost,
limit,
modalities: { input, output },
};
}
return {
name,
family: familyValue,
release_date: releaseDate,
last_updated: releaseDate,
attachment,
reasoning,
temperature: params.has("temperature"),
tool_call: toolCall,
structured_output: structuredOutput,
knowledge,
open_weights: openWeights,
status: existing?.status,
interleaved: existing?.interleaved,
cost,
limit,
modalities: { input, output },
} satisfies SyncedFullModel;
}
function resolveCanonicalModel(openrouterID: string) {
const [prefix, ...modelParts] = openrouterID.split("/");
if (prefix === undefined || modelParts.length === 0) return undefined;
if (openrouterID.startsWith("~/") || prefix.startsWith("~")) return undefined;
const provider = CANONICAL_PROVIDER_PREFIXES[prefix as keyof typeof CANONICAL_PROVIDER_PREFIXES];
if (provider === undefined) return undefined;
const modelID = modelParts.join("/").replace(/:free$/, "");
const candidates = canonicalCandidates(provider, modelID);
const match = candidates.find((candidate) => {
return canonicalModelExists(provider, candidate);
});
return match === undefined
? undefined
: {
from: `${provider}/${match}`,
provider,
modelID: match,
};
}
function canonicalModelExists(provider: string, modelID: string) {
let files = modelFilesByProvider.get(provider);
if (files === undefined) {
try {
files = new Set(readdirSync(path.join(PROVIDERS_DIR, provider, "models")));
} catch {
files = new Set();
}
modelFilesByProvider.set(provider, files);
}
return files.has(`${modelID}.toml`);
}
function canonicalOmit(
provider: string,
modelID: string,
cost: SyncedFullModel["cost"],
limit: SyncedFullModel["limit"],
) {
const toml = canonicalToml(provider, modelID);
const omit = ["provider", "experimental"].filter((key) => toml[key] !== undefined);
const baseCost = toml.cost;
if (baseCost !== undefined && baseCost !== null && typeof baseCost === "object" && !Array.isArray(baseCost)) {
if (cost === undefined) {
omit.push("cost");
} else {
for (const key of ["reasoning", "cache_read", "cache_write", "input_audio", "output_audio", "tiers"] as const) {
if ((baseCost as Record<string, unknown>)[key] !== undefined && cost[key] === undefined) {
omit.push(`cost.${key}`);
}
}
if (hasLegacyContextOver200k(baseCost) && cost.tiers === undefined) {
omit.push("cost.context_over_200k");
}
}
}
const baseLimit = toml.limit;
if (
baseLimit !== undefined &&
baseLimit !== null &&
typeof baseLimit === "object" &&
!Array.isArray(baseLimit) &&
(baseLimit as Record<string, unknown>).input !== undefined &&
limit.input === undefined
) {
omit.push("limit.input");
}
return omit.length > 0 ? omit : undefined;
}
function hasLegacyContextOver200k(cost: object) {
const tiers = (cost as { tiers?: unknown }).tiers;
if (!Array.isArray(tiers) || tiers.length !== 1) return false;
const tier = tiers[0];
if (tier === null || typeof tier !== "object" || Array.isArray(tier)) return false;
const tierConfig = (tier as { tier?: unknown }).tier;
if (tierConfig === null || typeof tierConfig !== "object" || Array.isArray(tierConfig)) return false;
const size = (tierConfig as { size?: unknown }).size;
return typeof size === "number" && size >= 200_000;
}
function canonicalRuntimeOverrides(
provider: string,
modelID: string,
values: Pick<SyncedFullModel, "name" | "attachment" | "reasoning">,
) {
const toml = canonicalToml(provider, modelID);
return Object.fromEntries(
Object.entries(values).filter(([key, value]) => value !== undefined && toml[key] !== value),
);
}
function canonicalToml(provider: string, modelID: string) {
const key = `${provider}/${modelID}`;
let toml = canonicalTomlByModel.get(key);
if (toml === undefined) {
const filePath = path.join(PROVIDERS_DIR, provider, "models", `${modelID}.toml`);
toml = Bun.TOML.parse(readFileSync(filePath, "utf8")) as Record<string, unknown>;
canonicalTomlByModel.set(key, toml);
}
return toml;
}
function canonicalCandidates(provider: string, modelID: string) {
const candidates = [modelID];
if (provider === "anthropic") {
candidates.push(modelID.replace(/(claude-(?:opus|sonnet|haiku)-\d+)\.(\d+)/, "$1-$2"));
candidates.push(modelID.replace(/^claude-3\.5-/, "claude-3-5-"));
}
if (provider === "llama") {
candidates.push(modelID.replace(/^llama-(\d+)-(\d+)/, "llama-$1.$2"));
candidates.push(modelID.replace(/^llama-(4)-(maverick|scout)$/, "llama-$1-$2-17b"));
}
if (provider === "mistral") {
candidates.push(modelID.replace(/-latest$/, ""));
}
if (provider === "minimax") {
candidates.push(modelID.replace(/^minimax-m/, "MiniMax-M"));
}
return [...new Set(candidates)];
}
+211
View File
@@ -0,0 +1,211 @@
import { z } from "zod";
import type { ExistingModel, SyncProvider, SyncedModel } from "../index.js";
const API_BASE = "https://api.x.ai/v1";
const XAIModel = z.object({
id: z.string(),
canonical_id: z.string().optional(),
created: z.number().int().nonnegative(),
aliases: z.array(z.string()).optional(),
input_modalities: z.array(z.string()).optional(),
output_modalities: z.array(z.string()).optional(),
prompt_text_token_price: z.number().int().nonnegative().optional(),
cached_prompt_text_token_price: z.number().int().nonnegative().optional(),
completion_text_token_price: z.number().int().nonnegative().optional(),
max_prompt_length: z.number().int().nonnegative().optional(),
}).passthrough();
const XAIModelList = z.object({
models: z.array(XAIModel),
}).passthrough();
const XAIResponse = z.object({
models: z.array(XAIModel),
});
const XAIAPIKey = z.object({
acls: z.array(z.string()),
}).passthrough();
type XAIModel = z.infer<typeof XAIModel>;
export const xai = {
id: "xai",
name: "xAI",
modelsDir: "providers/xai/models",
skipCreates: true,
sourceID(model) {
return model.id;
},
skippedNotice(ids) {
if (ids.length === 0) return [];
return [
`${ids.length} xAI models returned by the API were not created because the Models API does not provide enough authoritative metadata for the catalog, especially output token limits and some feature/capability flags. Existing models are still updated from API-authoritative fields.`,
`Skipped remote IDs: ${ids.map((id) => `\`${id}\``).join(", ")}`,
];
},
async fetchModels() {
const key = process.env.XAI_API_KEY;
if (key === undefined) throw new Error("xAI sync requires XAI_API_KEY");
await assertFullModelAccess(key);
const models = await Promise.all([
fetchTypedModels(key, "language-models"),
fetchTypedModels(key, "image-generation-models"),
fetchTypedModels(key, "video-generation-models"),
]);
return { models: models.flat() };
},
parseModels(raw) {
const models = XAIResponse.parse(raw).models;
const seen = new Set<string>();
const expanded: XAIModel[] = [];
for (const model of models) {
if (!seen.has(model.id)) {
seen.add(model.id);
expanded.push(model);
}
}
for (const model of models) {
for (const alias of model.aliases ?? []) {
if (seen.has(alias)) continue;
seen.add(alias);
expanded.push({ ...model, id: alias, canonical_id: model.id });
}
}
return expanded;
},
translateModel(model, context) {
const existing = context.existing(model.id);
if (existing === undefined) return undefined;
return {
id: model.id,
model: buildModel(model, existing),
};
},
} satisfies SyncProvider<XAIModel>;
async function assertFullModelAccess(key: string) {
const response = await fetch(`${API_BASE}/api-key`, {
headers: { Authorization: `Bearer ${key}` },
});
if (!response.ok) {
throw new Error(`xAI API key metadata request failed: ${response.status} ${response.statusText}`);
}
const apiKey = XAIAPIKey.parse(await response.json());
if (!apiKey.acls.includes("api-key:model:*")) {
throw new Error("xAI sync requires XAI_API_KEY to include api-key:model:* so the model list is not ACL-filtered");
}
}
async function fetchTypedModels(key: string, endpoint: string) {
const response = await fetch(`${API_BASE}/${endpoint}`, {
headers: { Authorization: `Bearer ${key}` },
});
if (!response.ok) {
throw new Error(`xAI ${endpoint} request failed: ${response.status} ${response.statusText}`);
}
return XAIModelList.parse(await response.json()).models;
}
function dateFromTimestamp(timestamp: number) {
return new Date(timestamp * 1000).toISOString().slice(0, 10);
}
type Modality = "text" | "audio" | "image" | "video" | "pdf";
function modalities(values: string[] | undefined, fallback: Modality[]) {
const allowed = new Set<Modality>(["text", "audio", "image", "video", "pdf"]);
const result = (values ?? [])
.map((value) => value.toLowerCase())
.filter((value): value is Modality => allowed.has(value as Modality));
if (result.includes("image")) result.push("pdf");
return [...new Set(result.length > 0 ? result : fallback)];
}
function tokenPrice(value: number | undefined) {
if (value === undefined) return undefined;
return value / 10_000;
}
function preservedCostTiers(existing: ExistingModel) {
// The xAI models API exposes base pricing only; long-context tiers are curated from xAI docs/console.
return existing.cost?.tiers;
}
function cost(model: XAIModel, existing: ExistingModel) {
const input = tokenPrice(model.prompt_text_token_price);
const output = tokenPrice(model.completion_text_token_price);
if (input === undefined || output === undefined) return existing.cost;
return {
input,
output,
reasoning: existing.cost?.reasoning,
cache_read: tokenPrice(model.cached_prompt_text_token_price),
cache_write: existing.cost?.cache_write,
input_audio: existing.cost?.input_audio,
output_audio: existing.cost?.output_audio,
tiers: preservedCostTiers(existing),
};
}
function buildModel(model: XAIModel, existing: ExistingModel): SyncedModel {
const name = existing.name;
const attachment = existing.attachment;
const reasoning = existing.reasoning;
const toolCall = existing.tool_call;
const openWeights = existing.open_weights;
const limit = existing.limit;
const releaseDate = existing.release_date;
const lastUpdated = existing.last_updated;
if (
name === undefined
|| attachment === undefined
|| reasoning === undefined
|| toolCall === undefined
|| openWeights === undefined
|| limit === undefined
|| (model.canonical_id !== undefined && releaseDate === undefined)
|| (model.canonical_id !== undefined && lastUpdated === undefined)
) {
throw new Error(`xAI model ${model.id} has incomplete local TOML metadata required for sync`);
}
const input = modalities(model.input_modalities, existing.modalities?.input ?? ["text"]);
const output = modalities(model.output_modalities, existing.modalities?.output ?? ["text"]);
const created = dateFromTimestamp(model.created);
return {
name,
family: existing.family,
release_date: model.canonical_id === undefined ? created : releaseDate!,
last_updated: model.canonical_id === undefined ? created : lastUpdated!,
attachment: input.some((value) => value !== "text"),
reasoning,
temperature: existing.temperature,
tool_call: toolCall,
structured_output: existing.structured_output,
knowledge: existing.knowledge,
open_weights: openWeights,
status: existing.status,
interleaved: existing.interleaved,
cost: cost(model, existing),
limit: {
input: limit.input,
context: model.max_prompt_length ?? limit.context,
output: limit.output,
},
modalities: { input, output },
};
}
+23
View File
@@ -0,0 +1,23 @@
name = "Qwen3.7 Max"
family = "qwen"
release_date = "2026-05-21"
last_updated = "2026-05-21"
attachment = false
reasoning = true
temperature = true
tool_call = true
open_weights = false
[cost]
input = 2.50
output = 7.50
cache_read = 0.50
cache_write = 3.125
[limit]
context = 1_000_000
output = 65_536
[modalities]
input = ["text"]
output = ["text"]
@@ -1,3 +1,4 @@
# See https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-moonshot-ai-kimi-k2-thinking.html
name = "Kimi K2 Thinking"
release_date = "2025-12-02"
family = "kimi-thinking"
@@ -15,8 +16,8 @@ input = 0.6
output = 2.5
[limit]
context = 256_000
output = 256_000
context = 262_143
output = 16_000
[modalities]
input = ["text"]
@@ -1,3 +1,4 @@
# See https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-moonshot-ai-kimi-k2-5.html
name = "Kimi K2.5"
family = "kimi"
release_date = "2026-02-06"
@@ -15,8 +16,8 @@ input = 0.6
output = 3
[limit]
context = 256_000
output = 256_000
context = 262_143
output = 16_000
[modalities]
input = ["text", "image"]
-2
View File
@@ -1,2 +0,0 @@
[extends]
from = "xai/grok-3-mini"
-2
View File
@@ -1,2 +0,0 @@
[extends]
from = "xai/grok-3"
@@ -1,2 +0,0 @@
[extends]
from = "xai/grok-4-fast-non-reasoning"
-2
View File
@@ -1,2 +0,0 @@
[extends]
from = "xai/grok-4"
@@ -1,2 +0,0 @@
[extends]
from = "xai/grok-code-fast-1"
@@ -0,0 +1,9 @@
release_date = "2026-05-07"
last_updated = "2026-05-07"
[extends]
from = "moonshotai/kimi-k2.6"
[cost]
input = 0.83
output = 3.85
@@ -0,0 +1,22 @@
name = "Gemma Sea Lion V4 27B It"
family = "gemma"
release_date = "2025-09-23"
last_updated = "2025-09-23"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.351
output = 0.555
[limit]
context = 128_000
output = 128_000
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Deepseek R1 Distill Qwen 32B"
family = "deepseek"
release_date = "2025-01-22"
last_updated = "2025-01-22"
attachment = false
reasoning = true
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.497
output = 4.881
[limit]
context = 80_000
output = 80_000
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Gemma 3 12B It"
family = "gemma"
release_date = "2025-03-18"
last_updated = "2025-03-18"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.345
output = 0.556
[limit]
context = 80_000
output = 80_000
[modalities]
input = ["text"]
output = ["text"]
@@ -6,15 +6,16 @@ attachment = true
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = true
[cost]
input = 0.10
output = 0.30
input = 0.1
output = 0.3
[limit]
context = 256000
output = 16384
context = 256_000
output = 16_384
[modalities]
input = ["text", "image"]
@@ -1,17 +1,17 @@
name = "Trinity Large Preview"
family = "trinity"
release_date = "2026-01-27"
last_updated = "2026-01-27"
name = "Granite 4.0 H Micro"
family = "granite"
release_date = "2025-10-07"
last_updated = "2025-10-07"
attachment = false
reasoning = false
temperature = true
tool_call = true
structured_output = true
structured_output = false
open_weights = true
[cost]
input = 0.15
output = 0.45
input = 0.017
output = 0.112
[limit]
context = 131_000
@@ -0,0 +1,22 @@
name = "Llama 2 7B Chat fp16"
family = "llama"
release_date = "2023-11-07"
last_updated = "2023-11-07"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.556
output = 6.667
[limit]
context = 4_096
output = 4_096
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3 8B Instruct Awq"
family = "llama"
release_date = "2024-05-09"
last_updated = "2024-05-09"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.123
output = 0.266
[limit]
context = 8_192
output = 8_192
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3 8B Instruct"
family = "llama"
release_date = "2024-04-18"
last_updated = "2024-04-18"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.282
output = 0.827
[limit]
context = 7_968
output = 7_968
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3.1 8B Instruct Awq"
family = "llama"
release_date = "2024-07-25"
last_updated = "2024-07-25"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.123
output = 0.266
[limit]
context = 8_192
output = 8_192
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3.1 8B Instruct fp8"
family = "llama"
release_date = "2024-07-25"
last_updated = "2024-07-25"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.152
output = 0.287
[limit]
context = 32_000
output = 32_000
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3.2 11B Vision Instruct"
family = "llama"
release_date = "2024-09-25"
last_updated = "2024-09-25"
attachment = true
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.0485
output = 0.676
[limit]
context = 128_000
output = 128_000
[modalities]
input = ["text", "image"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3.2 1B Instruct"
family = "llama"
release_date = "2024-09-25"
last_updated = "2024-09-25"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.027
output = 0.201
[limit]
context = 60_000
output = 60_000
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3.2 3B Instruct"
family = "llama"
release_date = "2024-09-25"
last_updated = "2024-09-25"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.0509
output = 0.335
[limit]
context = 80_000
output = 80_000
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Llama 3.3 70B Instruct fp8 Fast"
family = "llama"
release_date = "2024-12-06"
last_updated = "2024-12-06"
attachment = false
reasoning = false
temperature = true
tool_call = true
structured_output = false
open_weights = true
[cost]
input = 0.293
output = 2.253
[limit]
context = 24_000
output = 24_000
[modalities]
input = ["text"]
output = ["text"]
@@ -6,6 +6,7 @@ attachment = true
reasoning = false
temperature = true
tool_call = true
structured_output = false
open_weights = true
[cost]
@@ -13,8 +14,8 @@ input = 0.27
output = 0.85
[limit]
context = 128000
output = 16384
context = 131_000
output = 16_384
[modalities]
input = ["text", "image"]
@@ -0,0 +1,22 @@
name = "Llama Guard 3 8B"
family = "llama"
release_date = "2025-01-22"
last_updated = "2025-01-22"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.484
output = 0.03
[limit]
context = 131_072
output = 131_072
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Mistral 7B Instruct V0.1"
family = "mistral"
release_date = "2023-11-07"
last_updated = "2023-11-07"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.11
output = 0.19
[limit]
context = 2_824
output = 2_824
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Mistral Small 3.1 24B Instruct"
family = "mistral-small"
release_date = "2025-03-18"
last_updated = "2025-03-18"
attachment = false
reasoning = false
temperature = true
tool_call = true
structured_output = false
open_weights = true
[cost]
input = 0.351
output = 0.555
[limit]
context = 128_000
output = 128_000
[modalities]
input = ["text"]
output = ["text"]
@@ -4,9 +4,9 @@ release_date = "2026-04-20"
last_updated = "2026-04-20"
attachment = true
reasoning = true
structured_output = true
temperature = true
tool_call = true
structured_output = true
knowledge = "2025-01"
open_weights = true
@@ -15,11 +15,11 @@ field = "reasoning_content"
[cost]
input = 0.95
output = 4.00
output = 4
cache_read = 0.16
[limit]
context = 256_000
context = 262_144
output = 256_000
[modalities]
@@ -6,14 +6,15 @@ attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = true
[interleaved]
field = "reasoning_content"
[cost]
input = 0.50
output = 1.50
input = 0.5
output = 1.5
[limit]
context = 256_000
@@ -1,10 +1,12 @@
name = "GPT OSS 120B"
family = "gpt-oss"
release_date = "2025-08-05"
last_updated = "2025-08-05"
attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = true
[cost]
@@ -12,8 +14,8 @@ input = 0.35
output = 0.75
[limit]
context = 128000
output = 16384
context = 128_000
output = 16_384
[modalities]
input = ["text"]
@@ -1,10 +1,12 @@
name = "GPT OSS 20B"
family = "gpt-oss"
release_date = "2025-08-05"
last_updated = "2025-08-05"
attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = true
[cost]
@@ -12,8 +14,8 @@ input = 0.2
output = 0.3
[limit]
context = 128000
output = 16384
context = 128_000
output = 16_384
[modalities]
input = ["text"]
@@ -0,0 +1,22 @@
name = "Qwen2.5 Coder 32B Instruct"
family = "qwen"
release_date = "2025-02-27"
last_updated = "2025-02-27"
attachment = false
reasoning = false
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.66
output = 1
[limit]
context = 32_768
output = 32_768
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Qwen3 30B A3b fp8"
family = "qwen"
release_date = "2025-04-30"
last_updated = "2025-04-30"
attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = false
open_weights = true
[cost]
input = 0.0509
output = 0.335
[limit]
context = 32_768
output = 32_768
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,22 @@
name = "Qwq 32B"
family = "qwen"
release_date = "2025-03-05"
last_updated = "2025-03-05"
attachment = false
reasoning = true
temperature = true
tool_call = false
structured_output = false
open_weights = true
[cost]
input = 0.66
output = 1
[limit]
context = 24_000
output = 24_000
[modalities]
input = ["text"]
output = ["text"]
@@ -6,12 +6,13 @@ attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = true
knowledge = "2025-04"
open_weights = true
[cost]
input = 0.06
output = 0.40
input = 0.0605
output = 0.4
[limit]
context = 131_072
+22
View File
@@ -0,0 +1,22 @@
name = "DeepSeek V3.2"
family = "deepseek"
release_date = "2025-07-22"
last_updated = "2025-07-22"
attachment = false
reasoning = false
temperature = true
tool_call = true
open_weights = false
[cost]
input = 0.28
output = 0.38
cache_read = 0.06
[limit]
context = 163_840
output = 163_840
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,14 @@
[extends]
from = "deepseek/deepseek-v4-flash"
[cost]
input = 0.12
output = 0.21
cache_read = 0.02
[limit]
context = 1_000_000
output = 131_072
[provider]
npm = "@ai-sdk/openai-compatible"
@@ -0,0 +1,26 @@
name = "DeepSeek V4 Pro (Precision)"
family = "deepseek-thinking"
release_date = "2026-04-24"
last_updated = "2026-04-24"
attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = true
[interleaved]
field = "reasoning_content"
[cost]
input = 1.25
output = 2.50
cache_read = 0.10
[limit]
context = 1_000_000
output = 131_072
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,14 @@
[extends]
from = "deepseek/deepseek-v4-pro"
[cost]
input = 0.40
output = 0.85
cache_read = 0.003
[limit]
context = 1_000_000
output = 131_072
[provider]
npm = "@ai-sdk/openai-compatible"
+14
View File
@@ -0,0 +1,14 @@
[extends]
from = "google/gemma-4-31b-it"
[cost]
input = 0.10
output = 0.30
cache_read = 0.02
[limit]
context = 262_144
output = 262_144
[provider]
npm = "@ai-sdk/openai-compatible"
+10
View File
@@ -0,0 +1,10 @@
[extends]
from = "zhipuai/glm-4.7-flash"
[cost]
input = 0.04
output = 0.30
cache_read = 0.008
[provider]
npm = "@ai-sdk/openai-compatible"
+14
View File
@@ -0,0 +1,14 @@
[extends]
from = "zhipuai/glm-4.7"
[cost]
input = 0.25
output = 1.10
cache_read = 0.05
[limit]
context = 202_752
output = 202_752
[provider]
npm = "@ai-sdk/openai-compatible"
@@ -0,0 +1,26 @@
name = "GLM 5.1 (Precision)"
family = "glm"
release_date = "2026-03-27"
last_updated = "2026-03-27"
attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = false
[interleaved]
field = "reasoning_content"
[cost]
input = 0.75
output = 2.90
cache_read = 0.15
[limit]
context = 202_752
output = 202_752
[modalities]
input = ["text"]
output = ["text"]
+14
View File
@@ -0,0 +1,14 @@
[extends]
from = "zhipuai/glm-5.1"
[cost]
input = 0.45
output = 2.10
cache_read = 0.09
[limit]
context = 202_752
output = 202_752
[provider]
npm = "@ai-sdk/openai-compatible"
+14
View File
@@ -0,0 +1,14 @@
[extends]
from = "zhipuai/glm-5"
[cost]
input = 0.48
output = 1.90
cache_read = 0.10
[limit]
context = 202_752
output = 202_752
[provider]
npm = "@ai-sdk/openai-compatible"
+21
View File
@@ -0,0 +1,21 @@
name = "Experiment!: Greg"
release_date = "2026-01-27"
last_updated = "2026-01-27"
attachment = false
reasoning = false
temperature = true
tool_call = false
open_weights = false
[cost]
input = 0.10
output = 0.20
cache_read = 0.02
[limit]
context = 229_376
output = 229_376
[modalities]
input = ["text"]
output = ["text"]
@@ -0,0 +1,26 @@
name = "Kimi K2.5 (Lightning)"
family = "kimi-k2.5"
release_date = "2026-02-06"
last_updated = "2026-02-06"
attachment = false
reasoning = true
temperature = false
tool_call = true
structured_output = true
open_weights = true
[interleaved]
field = "reasoning_content"
[cost]
input = 1.00
output = 3.00
cache_read = 0.20
[limit]
context = 131_072
output = 32_768
[modalities]
input = ["text", "image", "video"]
output = ["text"]
+10
View File
@@ -0,0 +1,10 @@
[extends]
from = "moonshotai/kimi-k2.5"
[cost]
input = 0.35
output = 1.70
cache_read = 0.07
[provider]
npm = "@ai-sdk/openai-compatible"
@@ -0,0 +1,26 @@
name = "Kimi K2.6 (Precision)"
family = "kimi-k2.6"
release_date = "2026-04-21"
last_updated = "2026-04-21"
attachment = true
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = true
[interleaved]
field = "reasoning_content"
[cost]
input = 0.55
output = 2.70
cache_read = 0.11
[limit]
context = 262_144
output = 262_144
[modalities]
input = ["text", "image", "video"]
output = ["text"]
+10
View File
@@ -0,0 +1,10 @@
[extends]
from = "moonshotai/kimi-k2.6"
[cost]
input = 0.50
output = 1.99
cache_read = 0.10
[provider]
npm = "@ai-sdk/openai-compatible"
@@ -0,0 +1,25 @@
name = "MiMo-V2.5-Pro (Precision)"
family = "mimo"
release_date = "2026-04-22"
last_updated = "2026-04-22"
attachment = false
reasoning = true
temperature = true
tool_call = true
open_weights = true
[interleaved]
field = "reasoning_content"
[cost]
input = 0.80
output = 2.50
cache_read = 0.16
[limit]
context = 1_000_000
output = 131_072
[modalities]
input = ["text"]
output = ["text"]
+10
View File
@@ -0,0 +1,10 @@
[extends]
from = "xiaomi/mimo-v2.5-pro"
[cost]
input = 0.50
output = 1.50
cache_read = 0.10
[provider]
npm = "@ai-sdk/openai-compatible"
+12
View File
@@ -0,0 +1,12 @@
reasoning = false
[extends]
from = "minimax/MiniMax-M2.5"
[cost]
input = 0.11
output = 0.95
cache_read = 0.02
[provider]
npm = "@ai-sdk/openai-compatible"
@@ -0,0 +1,14 @@
[extends]
from = "alibaba/qwen3.5-397b-a17b"
[cost]
input = 0.35
output = 1.75
cache_read = 0.07
[limit]
context = 262_144
output = 262_144
[provider]
npm = "@ai-sdk/openai-compatible"
+26
View File
@@ -0,0 +1,26 @@
name = "Qwen3.5 9B"
family = "qwen"
release_date = "2026-03-13"
last_updated = "2026-03-13"
attachment = true
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = true
[interleaved]
field = "reasoning_content"
[cost]
input = 0.04
output = 0.15
cache_read = 0.008
[limit]
context = 262_144
output = 262_144
[modalities]
input = ["text", "image", "video", "audio"]
output = ["text"]
+14
View File
@@ -0,0 +1,14 @@
[extends]
from = "alibaba/qwen3.6-27b"
[cost]
input = 0.20
output = 1.50
cache_read = 0.04
[limit]
context = 262_144
output = 262_144
[provider]
npm = "@ai-sdk/openai-compatible"
+5
View File
@@ -0,0 +1,5 @@
name = "CrofAI"
env = ["CROF_API_KEY"]
npm = "@ai-sdk/openai-compatible"
api = "https://crof.ai/v1"
doc = "https://crof.ai/docs"
@@ -0,0 +1,7 @@
[extends]
from = "deepseek/deepseek-v4-flash"
[cost]
input = 0.14
output = 0.28
cache_read = 0.03
@@ -0,0 +1,24 @@
name = "Agentic Chat (GPT-5.5)"
family = "gpt"
release_date = "2026-04-23"
last_updated = "2026-04-23"
knowledge = "2025-08-31"
attachment = true
reasoning = true
temperature = false
tool_call = true
structured_output = true
open_weights = false
[cost]
input = 0
output = 0
[limit]
context = 1_050_000
input = 922_000
output = 128_000
[modalities]
input = ["text", "image", "pdf"]
output = ["text"]
@@ -1,3 +0,0 @@
[extends]
from = "google/gemini-2.5-flash-lite-preview-09-2025"
omit = ["structured_output"]
@@ -1,2 +0,0 @@
[extends]
from = "google/gemini-2.5-flash-preview-04-17"
@@ -1,3 +0,0 @@
[extends]
from = "google/gemini-2.5-flash-preview-05-20"
omit = ["structured_output"]
@@ -1,3 +0,0 @@
[extends]
from = "google/gemini-2.5-pro-preview-05-06"
omit = ["structured_output"]
@@ -1,3 +0,0 @@
[extends]
from = "google/gemini-2.5-pro-preview-06-05"
omit = ["structured_output"]
@@ -1,23 +0,0 @@
name = "Gemini 1.5 Flash-8B"
family = "gemini-flash"
release_date = "2024-10-03"
last_updated = "2024-10-03"
attachment = true
reasoning = false
temperature = true
knowledge = "2024-04"
tool_call = true
open_weights = false
[cost]
input = 0.0375
output = 0.15
cache_read = 0.01
[limit]
context = 1_000_000
output = 8_192
[modalities]
input = ["text", "image", "audio", "video"]
output = ["text"]
@@ -1,23 +0,0 @@
name = "Gemini 1.5 Flash"
family = "gemini-flash"
release_date = "2024-05-14"
last_updated = "2024-05-14"
attachment = true
reasoning = false
temperature = true
knowledge = "2024-04"
tool_call = true
open_weights = false
[cost]
input = 0.075
output = 0.30
cache_read = 0.01875
[limit]
context = 1_000_000
output = 8_192
[modalities]
input = ["text", "image", "audio", "video"]
output = ["text"]
@@ -1,23 +0,0 @@
name = "Gemini 1.5 Pro"
family = "gemini-pro"
release_date = "2024-02-15"
last_updated = "2024-02-15"
attachment = true
reasoning = false
temperature = true
knowledge = "2024-04"
tool_call = true
open_weights = false
[cost]
input = 1.25
output = 5.00
cache_read = 0.3125
[limit]
context = 1_000_000
output = 8_192
[modalities]
input = ["text", "image", "audio", "video"]
output = ["text"]
@@ -1,18 +1,18 @@
name = "Gemini 2.0 Flash Lite"
name = "Gemini 2.0 Flash-Lite"
family = "gemini-flash-lite"
release_date = "2024-12-11"
last_updated = "2024-12-11"
attachment = true
reasoning = false
temperature = true
knowledge = "2024-06"
tool_call = true
structured_output = true
knowledge = "2024-06"
open_weights = false
[cost]
input = 0.075
output = 0.30
output = 0.3
[limit]
context = 1_048_576
@@ -1,23 +0,0 @@
name = "Gemini 2.5 Flash Image (Preview)"
family = "gemini-flash"
release_date = "2025-08-26"
last_updated = "2025-08-26"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-06"
tool_call = false
open_weights = false
[cost]
input = 0.30
output = 30
cache_read = 0.075
[limit]
context = 32_768
output = 32_768
[modalities]
input = ["text", "image"]
output = ["text", "image"]
@@ -1,16 +1,16 @@
name = "Gemini 2.5 Flash Image"
name = "Nano Banana"
family = "gemini-flash"
release_date = "2025-08-26"
last_updated = "2025-08-26"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-06"
tool_call = false
knowledge = "2025-06"
open_weights = false
[cost]
input = 0.30
input = 0.3
output = 30
cache_read = 0.075
@@ -20,4 +20,4 @@ output = 32_768
[modalities]
input = ["text", "image"]
output = ["text", "image"]
output = ["text", "image"]
@@ -1,24 +0,0 @@
name = "Gemini 2.5 Flash Lite Preview 06-17"
family = "gemini-flash-lite"
release_date = "2025-06-17"
last_updated = "2025-06-17"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
open_weights = false
[cost]
input = 0.10
output = 0.40
cache_read = 0.025
input_audio = 0.30
[limit]
context = 1_048_576
output = 65_536
[modalities]
input = ["text", "image", "audio", "video", "pdf"]
output = ["text"]
@@ -1,24 +0,0 @@
name = "Gemini 2.5 Flash Lite Preview 09-25"
family = "gemini-flash-lite"
release_date = "2025-09-25"
last_updated = "2025-09-25"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
structured_output = true
open_weights = false
[cost]
input = 0.10
output = 0.40
cache_read = 0.025
[limit]
context = 1_048_576
output = 65_536
[modalities]
input = ["text", "image", "audio", "video", "pdf"]
output = ["text"]
@@ -1,20 +1,20 @@
name = "Gemini 2.5 Flash Lite"
name = "Gemini 2.5 Flash-Lite"
family = "gemini-flash-lite"
release_date = "2025-06-17"
last_updated = "2025-06-17"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
structured_output = true
knowledge = "2025-01"
open_weights = false
[cost]
input = 0.10
output = 0.40
input = 0.1
output = 0.4
cache_read = 0.01
input_audio = 0.30
input_audio = 0.3
[limit]
context = 1_048_576
@@ -1,23 +0,0 @@
name = "Gemini 2.5 Flash Preview 04-17"
family = "gemini-flash"
release_date = "2025-04-17"
last_updated = "2025-04-17"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
open_weights = false
[cost]
input = 0.15
output = 0.60
cache_read = 0.0375
[limit]
context = 1_048_576
output = 65_536
[modalities]
input = ["text", "image", "audio", "video", "pdf"]
output = ["text"]
@@ -4,19 +4,19 @@ release_date = "2025-05-01"
last_updated = "2025-05-01"
attachment = false
reasoning = false
temperature = false
knowledge = "2025-01"
temperature = true
tool_call = false
knowledge = "2025-01"
open_weights = false
[cost]
input = 0.50
output = 10.00
input = 0.5
output = 10
[limit]
context = 8_000
output = 16_000
context = 8_192
output = 16_384
[modalities]
input = ["text"]
output = ["audio"]
output = ["audio"]
@@ -1,24 +0,0 @@
name = "Gemini 2.5 Pro Preview 05-06"
family = "gemini-pro"
release_date = "2025-05-06"
last_updated = "2025-05-06"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
structured_output = true
open_weights = false
[cost]
input = 1.25
output = 10.00
cache_read = 0.31
[limit]
context = 1_048_576
output = 65_536
[modalities]
input = ["text", "image", "audio", "video", "pdf"]
output = ["text"]
@@ -1,24 +0,0 @@
name = "Gemini 2.5 Pro Preview 06-05"
family = "gemini-pro"
release_date = "2025-06-05"
last_updated = "2025-06-05"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
structured_output = true
open_weights = false
[cost]
input = 1.25
output = 10.00
cache_read = 0.31
[limit]
context = 1_048_576
output = 65_536
[modalities]
input = ["text", "image", "audio", "video", "pdf"]
output = ["text"]
@@ -4,19 +4,19 @@ release_date = "2025-05-01"
last_updated = "2025-05-01"
attachment = false
reasoning = false
temperature = false
knowledge = "2025-01"
temperature = true
tool_call = false
knowledge = "2025-01"
open_weights = false
[cost]
input = 1.00
output = 20.00
input = 1
output = 20
[limit]
context = 8_000
output = 16_000
context = 8_192
output = 16_384
[modalities]
input = ["text"]
output = ["audio"]
output = ["audio"]
@@ -11,19 +11,19 @@ knowledge = "2025-01"
open_weights = false
[cost]
input = 2.00
output = 12.00
cache_read = 0.20
input = 2
output = 12
cache_read = 0.2
[[cost.tiers]]
tier = { size = 200_000 }
input = 4.00
output = 18.00
cache_read = 0.40
input = 4
output = 18
cache_read = 0.4
[limit]
context = 1000000
output = 64000
context = 1_048_576
output = 65_536
[modalities]
input = ["text", "image", "video", "audio", "pdf"]
@@ -1,21 +1,21 @@
name = "Gemini 3.1 Flash Image (Preview)"
name = "Nano Banana 2"
family = "gemini-flash"
release_date = "2026-02-26"
last_updated = "2026-02-26"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = false
knowledge = "2025-01"
open_weights = false
[cost]
input = 0.50
output = 60.00
input = 0.5
output = 60
[limit]
context = 131_072
output = 32_768
context = 65_536
output = 65_536
[modalities]
input = ["text", "image", "pdf"]
@@ -1,24 +1,25 @@
name = "Gemini 2.5 Flash Preview 05-20"
name = "Gemini 3.5 Flash"
family = "gemini-flash"
release_date = "2025-05-20"
last_updated = "2025-05-20"
release_date = "2026-05-19"
last_updated = "2026-05-19"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
structured_output = true
knowledge = "2025-01"
open_weights = false
[cost]
input = 0.15
output = 0.60
cache_read = 0.0375
input = 1.50
output = 9.00
cache_read = 0.15
input_audio = 1.50
[limit]
context = 1_048_576
output = 65_536
[modalities]
input = ["text", "image", "audio", "video", "pdf"]
input = ["text", "image", "video", "audio", "pdf"]
output = ["text"]
@@ -5,17 +5,17 @@ last_updated = "2025-05-20"
attachment = false
reasoning = false
temperature = false
knowledge = "2025-05"
tool_call = false
knowledge = "2025-05"
open_weights = false
[cost]
input = 0.15
output = 0.00
output = 0
[limit]
context = 2_048
output = 3_072
output = 1
[modalities]
input = ["text"]
@@ -1,24 +0,0 @@
name = "Gemini Live 2.5 Flash Preview Native Audio"
family = "gemini-flash"
release_date = "2025-06-17"
last_updated = "2025-09-18"
attachment = false
reasoning = true
temperature = false
knowledge = "2025-01"
tool_call = true
open_weights = false
[cost]
input = 0.50
output = 2.00
input_audio = 3.00
output_audio = 12.00
[limit]
context = 131_072
output = 65_536
[modalities]
input = ["text", "audio", "video"]
output = ["text", "audio"]
@@ -1,24 +0,0 @@
name = "Gemini Live 2.5 Flash"
family = "gemini-flash"
release_date = "2025-09-01"
last_updated = "2025-09-01"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-01"
tool_call = true
open_weights = false
[cost]
input = 0.50
output = 2.00
input_audio = 3.00
output_audio = 12.00
[limit]
context = 128_000
output = 8_000
[modalities]
input = ["text", "image", "audio", "video"]
output = ["text", "audio"]
@@ -1,23 +0,0 @@
name = "Gemma 3 12B"
family = "gemma"
release_date = "2025-03-13"
last_updated = "2025-03-13"
attachment = true
reasoning = false
temperature = true
knowledge = "2024-10"
tool_call = false
structured_output = true
open_weights = true
[cost]
input = 0
output = 0
[limit]
context = 32_768
output = 8_192
[modalities]
input = ["text", "image"]
output = ["text"]
@@ -1,23 +0,0 @@
name = "Gemma 3 27B"
family = "gemma"
release_date = "2025-03-12"
last_updated = "2025-03-12"
attachment = true
reasoning = false
temperature = true
knowledge = "2024-10"
tool_call = true
structured_output = true
open_weights = true
[cost]
input = 0
output = 0
[limit]
context = 131_072
output = 8_192
[modalities]
input = ["text", "image"]
output = ["text"]
@@ -1,22 +0,0 @@
name = "Gemma 3 4B"
family = "gemma"
release_date = "2025-03-13"
last_updated = "2025-03-13"
attachment = true
reasoning = false
temperature = true
knowledge = "2024-10"
tool_call = false
open_weights = true
[cost]
input = 0
output = 0
[limit]
context = 32_768
output = 8_192
[modalities]
input = ["text", "image"]
output = ["text"]
Loaded 100 of 503 files, more files were not shown because too many files have changed in this diff. Show more