Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f31eec5b94 |
No files matched your search
@@ -88,8 +88,6 @@ jobs:
|
||||
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_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID }}
|
||||
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 }}
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# Sources (accessed 2026-08-28):
|
||||
# https://huggingface.co/Qwen/Qwen3.8-Flash-Next
|
||||
# https://huggingface.co/api/models/Qwen/Qwen3.8-Flash-Next
|
||||
# https://qwen.ai/blog?id=qwen3.8-flash-next
|
||||
# Hub lastModified 2026-08-27T05:03:36Z is the open-weight drop (Do not use
|
||||
# Hub createdAt, staged countdown page).
|
||||
# Experimental preview of the Qwen4 architecture (Qwen4Exp): hybrid
|
||||
# Gated DeltaNet + Qwen Sparse Attention, 512 experts (10 routed + 1 shared),
|
||||
# 125B total with 6B active plus 51B n-gram embedding and 4B MTP.
|
||||
# Thinking always on: reasoning_effort low|medium|xhigh (default xhigh).
|
||||
# Native context 262K, extensible up to 1M tokens.
|
||||
|
||||
name = "Qwen3.8 Flash Next"
|
||||
description = "Open-weight experimental preview of the Qwen4 architecture: hybrid-attention MoE (125B total, 6B active) with vision encoder for coding, agent tasks, and image and video understanding"
|
||||
family = "qwen"
|
||||
release_date = "2026-08-27"
|
||||
last_updated = "2026-08-27"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
license = "qwen-community-1.0"
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 131_072
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
output = ["text"]
|
||||
|
||||
[[weights]]
|
||||
label = "Hugging Face"
|
||||
url = "https://huggingface.co/Qwen/Qwen3.8-Flash-Next"
|
||||
@@ -1,19 +0,0 @@
|
||||
# Source: https://www.qwencloud.com/models/qwen3.8-flash
|
||||
name = "Qwen3.8 Flash"
|
||||
description = "Qwen vision-language model for visual reasoning, documents, and agent tasks"
|
||||
family = "qwen"
|
||||
release_date = "2026-08-26"
|
||||
last_updated = "2026-08-26"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 131_072
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
output = ["text"]
|
||||
@@ -1,19 +0,0 @@
|
||||
name = "Claude Fable 5.1"
|
||||
description = "Claude model for demanding reasoning and long-horizon agentic work"
|
||||
family = "claude-fable"
|
||||
release_date = "2026-09-01"
|
||||
last_updated = "2026-09-01"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
open_weights = false
|
||||
knowledge = "2026-06"
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 128_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "pdf"]
|
||||
output = ["text"]
|
||||
@@ -6,11 +6,10 @@ description = "Low-latency ByteDance Seed model for high-throughput chat, extrac
|
||||
family = "seed"
|
||||
release_date = "2025-08-28"
|
||||
last_updated = "2025-08-28"
|
||||
attachment = true
|
||||
attachment = false
|
||||
reasoning = false
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
@@ -18,5 +17,5 @@ context = 256_000
|
||||
output = 32_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = false
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -10,7 +10,6 @@ attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -6,11 +6,10 @@ description = "ByteDance Seed model for multimodal reasoning, long-context analy
|
||||
family = "seed"
|
||||
release_date = "2025-12-28"
|
||||
last_updated = "2025-12-28"
|
||||
attachment = true
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
@@ -18,5 +17,5 @@ context = 256_000
|
||||
output = 64_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -10,7 +10,6 @@ attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
name = "Ornith 1.5 35B A3B"
|
||||
description = "Mixture-of-experts coding-reasoning model for agentic software tasks, tool use, and image understanding"
|
||||
family = "ornith"
|
||||
release_date = "2026-08-18"
|
||||
last_updated = "2026-08-23"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
license = "MIT"
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
|
||||
[[weights]]
|
||||
label = "Hugging Face"
|
||||
url = "https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B"
|
||||
|
||||
[[links]]
|
||||
label = "Model card"
|
||||
url = "https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B"
|
||||
type = "model_card"
|
||||
@@ -1,19 +0,0 @@
|
||||
name = "DeepSeek V4 Flash Vision Exp"
|
||||
description = "Experimental multimodal DeepSeek V4 Flash model for image understanding, coding, and agentic work"
|
||||
family = "deepseek-flash"
|
||||
release_date = "2026-08-21"
|
||||
last_updated = "2026-08-21"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 384_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
@@ -1,22 +0,0 @@
|
||||
# https://ofox.ai/models/deepseek/deepseek-v4-pro-0423
|
||||
# https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro
|
||||
name = "DeepSeek V4 Pro 0423"
|
||||
description = "DeepSeek V4 Pro initial snapshot with million-token context and support for thinking and non-thinking modes"
|
||||
family = "deepseek-thinking"
|
||||
release_date = "2026-04-23"
|
||||
last_updated = "2026-04-23"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2025-05"
|
||||
open_weights = true
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 384_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -1,16 +1,14 @@
|
||||
# https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro-0813
|
||||
name = "DeepSeek V4 Pro 0813"
|
||||
description = "DeepSeek V4 Pro snapshot with million-token context and support for thinking and non-thinking modes"
|
||||
family = "deepseek-thinking"
|
||||
release_date = "2026-08-12"
|
||||
last_updated = "2026-08-22"
|
||||
last_updated = "2026-08-12"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
license = "MIT"
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
@@ -19,7 +17,3 @@ output = 384_000
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
|
||||
[[weights]]
|
||||
label = "Hugging Face"
|
||||
url = "https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro-0813"
|
||||
@@ -1,19 +0,0 @@
|
||||
# Source: https://vercel.com/ai-gateway/models/gemini-3.5-transcribe-live
|
||||
# Live transcription has no token context/output window; zero denotes not applicable.
|
||||
name = "Gemini 3.5 Transcribe Live"
|
||||
description = "Speech transcription model for accurate audio-to-text and captioning workflows"
|
||||
family = "gemini"
|
||||
release_date = "2026-08-26"
|
||||
last_updated = "2026-08-26"
|
||||
attachment = false
|
||||
reasoning = false
|
||||
tool_call = false
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 0
|
||||
output = 0
|
||||
|
||||
[modalities]
|
||||
input = ["audio"]
|
||||
output = ["text"]
|
||||
@@ -1,22 +0,0 @@
|
||||
# Sources:
|
||||
# - https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash
|
||||
# - https://ai.google.dev/gemini-api/docs/latest-model
|
||||
name = "Gemini 3.8 Flash"
|
||||
description = "Google's most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows"
|
||||
family = "gemini-flash"
|
||||
release_date = "2026-09-02"
|
||||
last_updated = "2026-09-02"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 1_048_576
|
||||
output = 65_536
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video", "audio", "pdf"]
|
||||
output = ["text"]
|
||||
@@ -1,15 +1,15 @@
|
||||
# Tracks the current Gemini Flash release (gemini-3.7-flash).
|
||||
# Tracks the current Gemini Flash release (gemini-3.5-flash).
|
||||
name = "Gemini Flash Latest"
|
||||
description = "High-efficiency Gemini model for agentic workflows, coding, and multimodal reasoning"
|
||||
description = "Fast Gemini model balancing multimodal reasoning, tool use, and cost"
|
||||
family = "gemini-flash"
|
||||
release_date = "2026-08-13"
|
||||
last_updated = "2026-08-13"
|
||||
release_date = "2026-05-19"
|
||||
last_updated = "2026-05-19"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2026-03"
|
||||
knowledge = "2025-01"
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# Tracks the current Gemini Flash-Lite release (gemini-3.5-flash-lite).
|
||||
# Tracks the current Gemini Flash-Lite release (gemini-3.1-flash-lite).
|
||||
name = "Gemini Flash-Lite Latest"
|
||||
description = "Fast Gemini model balancing multimodal reasoning, tool use, and cost"
|
||||
description = "Low-latency Gemini model for high-volume multimodal and agent workloads"
|
||||
family = "gemini-flash-lite"
|
||||
release_date = "2026-07-21"
|
||||
last_updated = "2026-07-21"
|
||||
release_date = "2026-05-07"
|
||||
last_updated = "2026-05-07"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2026-03"
|
||||
knowledge = "2025-01"
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# https://novita.ai/models/model-detail/inclusionai-ling-3.0-flash-fin
|
||||
# https://openrouter.ai/api/v1/models/inclusionai/ling-3.0-flash-fin:free/endpoints
|
||||
# https://vercel.com/changelog/ling-3-0-flash-fin-now-available-on-ai-gateway-for-free
|
||||
name = "Ling 3.0 Flash Fin"
|
||||
description = "Finance-enhanced model for financial research, multi-step investment workflows, and long-horizon planning and execution"
|
||||
family = "ling"
|
||||
release_date = "2026-08-27"
|
||||
last_updated = "2026-08-27"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 32_768
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -11,8 +11,8 @@ tool_call = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 65_536
|
||||
output = 2_048
|
||||
context = 200_000
|
||||
output = 131_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
|
||||
@@ -10,8 +10,8 @@ tool_call = true
|
||||
open_weights = true
|
||||
|
||||
[limit]
|
||||
context = 204_800
|
||||
output = 131_072
|
||||
context = 196_608
|
||||
output = 128_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
|
||||
@@ -10,8 +10,8 @@ tool_call = true
|
||||
open_weights = true
|
||||
|
||||
[limit]
|
||||
context = 1_048_576
|
||||
output = 512_000
|
||||
context = 512_000
|
||||
output = 128_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# Sources:
|
||||
# - https://platform.minimax.io/docs/guides/image-generation (text-to-image + subject reference)
|
||||
# - https://platform.minimax.io/docs/api-reference/image-generation-t2i (POST /v1/image_generation)
|
||||
# - https://platform.minimax.io/docs/guides/pricing-paygo#image ($0.0035 per image)
|
||||
# - https://platform.minimax.io/docs/guides/pricing-token-plan (covered by Token Plan; no per-image cost)
|
||||
# Note: served on the standalone image endpoint (/v1/image_generation), not the
|
||||
# Anthropic-compatible /anthropic/v1 base — hence no provider entry under providers/minimax*.
|
||||
|
||||
name = "MiniMax image-01"
|
||||
description = "MiniMax text-to-image generation model with reference-image support"
|
||||
family = "minimax"
|
||||
release_date = "2025-02-15"
|
||||
last_updated = "2026-08-25"
|
||||
attachment = true
|
||||
reasoning = false
|
||||
temperature = false
|
||||
tool_call = false
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 0
|
||||
output = 0
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["image"]
|
||||
@@ -5,7 +5,7 @@ release_date = "2025-08-07"
|
||||
last_updated = "2025-08-07"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = false
|
||||
temperature = true
|
||||
tool_call = false
|
||||
structured_output = true
|
||||
knowledge = "2024-09-30"
|
||||
|
||||
@@ -5,7 +5,7 @@ release_date = "2025-11-13"
|
||||
last_updated = "2025-11-13"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2024-09-30"
|
||||
|
||||
@@ -5,7 +5,7 @@ release_date = "2025-12-11"
|
||||
last_updated = "2025-12-11"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2025-08-31"
|
||||
|
||||
@@ -5,7 +5,7 @@ release_date = "2026-02-05"
|
||||
last_updated = "2026-02-05"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2025-08-31"
|
||||
|
||||
@@ -5,7 +5,7 @@ release_date = "2026-03-17"
|
||||
last_updated = "2026-03-17"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2025-08-31"
|
||||
|
||||
@@ -5,7 +5,7 @@ release_date = "2026-03-17"
|
||||
last_updated = "2026-03-17"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2025-08-31"
|
||||
|
||||
@@ -5,7 +5,7 @@ release_date = "2026-03-05"
|
||||
last_updated = "2026-03-05"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
knowledge = "2025-08-31"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# https://cloud.tencent.com/document/product/1823/130051
|
||||
name = "Hy3"
|
||||
description = "Tencent Hy reasoning model for coding, instruction following, and agent tasks"
|
||||
family = "Hy"
|
||||
@@ -12,8 +11,7 @@ open_weights = true
|
||||
|
||||
[limit]
|
||||
context = 256_000
|
||||
input = 192_000
|
||||
output = 128_000
|
||||
output = 64_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
name = "Hy4 preview"
|
||||
description = "A next-generation productivity model with significantly enhanced Agent and complex task execution capabilities."
|
||||
family = "Hy"
|
||||
release_date = "2026-08-28"
|
||||
last_updated = "2026-08-28"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
open_weights = true
|
||||
|
||||
[limit]
|
||||
context = 1_024_000
|
||||
output = 64_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -1,25 +0,0 @@
|
||||
# Sources (accessed 2026-08-19):
|
||||
# - https://z.ai/blog/glm-4.6v
|
||||
# - https://huggingface.co/zai-org/GLM-4.6V-Flash
|
||||
name = "GLM-4.6V-Flash"
|
||||
description = "Lightweight GLM vision model for visual reasoning, documents, and multimodal agents"
|
||||
family = "glm"
|
||||
release_date = "2025-12-08"
|
||||
last_updated = "2025-12-08"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
open_weights = true
|
||||
|
||||
[limit]
|
||||
context = 128_000
|
||||
output = 32_768
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
output = ["text"]
|
||||
|
||||
[[weights]]
|
||||
label = "Hugging Face"
|
||||
url = "https://huggingface.co/zai-org/GLM-4.6V-Flash"
|
||||
@@ -1,19 +0,0 @@
|
||||
name = "GLM-5.3-Flash"
|
||||
description = "Native multimodal GLM model for efficient coding and long-horizon agent tasks"
|
||||
family = "glm"
|
||||
release_date = "2026-08-26"
|
||||
last_updated = "2026-08-26"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 131_072
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video", "pdf"]
|
||||
output = ["text"]
|
||||
@@ -8,7 +8,7 @@ reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
open_weights = false
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
|
||||
@@ -25,11 +25,9 @@
|
||||
"chutes:sync": "bun ./packages/core/script/sync-models.ts chutes",
|
||||
"databricks:generate": "bun ./packages/core/script/generate-databricks.ts",
|
||||
"helicone:generate": "bun ./packages/core/script/generate-helicone.ts",
|
||||
"cloudflare-ai-gateway:generate": "bun ./packages/core/script/generate-cloudflare-ai-gateway.ts",
|
||||
"huggingface:sync": "bun ./packages/core/script/sync-models.ts huggingface",
|
||||
"kilo:sync": "bun ./packages/core/script/sync-models.ts kilo",
|
||||
"llmgateway:sync": "bun ./packages/core/script/sync-models.ts llmgateway",
|
||||
"llmgateway-providers:sync": "bun ./packages/core/script/sync-models.ts llmgateway-providers",
|
||||
"requesty:sync": "bun ./packages/core/script/sync-models.ts requesty",
|
||||
"merge-gateway:sync": "bun ./packages/core/script/sync-models.ts merge-gateway",
|
||||
"nano-gpt:sync": "bun ./packages/core/script/sync-models.ts nano-gpt",
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { syncProviderByID } from "../src/sync/index.js";
|
||||
|
||||
const check = process.argv.includes("--check");
|
||||
const result = await syncProviderByID("cloudflare-ai-gateway", { dryRun: check });
|
||||
|
||||
if (check) {
|
||||
if (result.files.length > 0) {
|
||||
console.error(`--check: ${result.files.length} file(s) out of date`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("--check: up to date");
|
||||
}
|
||||
@@ -52,7 +52,6 @@ export const ModelFamilyValues = [
|
||||
|
||||
// Meta Muse
|
||||
"muse",
|
||||
"muse-free",
|
||||
|
||||
// Alibaba Qwen
|
||||
"qwen",
|
||||
|
||||
@@ -5,13 +5,11 @@ export const MAX_CREATED_MODELS = 10;
|
||||
export const MAX_DELETED_MODELS = 10;
|
||||
export const MAX_MODEL_CHURN = 15;
|
||||
const REVIEWED_REASONING_PROVIDERS = new Set([
|
||||
"crossmodel",
|
||||
"edenai",
|
||||
"empiriolabs",
|
||||
"hyper",
|
||||
"kilo",
|
||||
"llmgateway",
|
||||
"llmgateway-providers",
|
||||
"merge-gateway",
|
||||
"nano-gpt",
|
||||
"openrouter",
|
||||
@@ -55,14 +53,6 @@ export async function classifyAutoMerge(
|
||||
if (created + deleted > MAX_MODEL_CHURN) {
|
||||
reasons.push(`${created + deleted} models created or deleted (limit ${MAX_MODEL_CHURN})`);
|
||||
}
|
||||
if (
|
||||
models.some((change) =>
|
||||
change.status === "deleted"
|
||||
&& change.path.startsWith("providers/cloudflare-ai-gateway/models/")
|
||||
)
|
||||
) {
|
||||
reasons.push("Cloudflare AI Gateway model deletions require manual review");
|
||||
}
|
||||
|
||||
const reasoningMetadata = async (path: string, loader: typeof load) => {
|
||||
const model = Bun.TOML.parse(await loader(path)) as Record<string, unknown>;
|
||||
|
||||
@@ -9,7 +9,6 @@ import { ambient } from "./providers/ambient.js";
|
||||
import { anthropic } from "./providers/anthropic.js";
|
||||
import { baseten } from "./providers/baseten.js";
|
||||
import { chutes } from "./providers/chutes.js";
|
||||
import { cloudflareAiGateway } from "./providers/cloudflare-ai-gateway.js";
|
||||
import { cloudflareWorkersAi } from "./providers/cloudflare-workers-ai.js";
|
||||
import { cortecs } from "./providers/cortecs.js";
|
||||
import { crossmodel } from "./providers/crossmodel.js";
|
||||
@@ -17,15 +16,13 @@ import { deepinfra } from "./providers/deepinfra.js";
|
||||
import { digitalocean } from "./providers/digitalocean.js";
|
||||
import { edenai } from "./providers/edenai.js";
|
||||
import { empiriolabs } from "./providers/empiriolabs.js";
|
||||
import { githubCopilot } from "./providers/github-copilot.js";
|
||||
import { google } from "./providers/google.js";
|
||||
import { hyper } from "./providers/hyper.js";
|
||||
import { huggingface } from "./providers/huggingface.js";
|
||||
import { inceptron } from "./providers/inceptron.js";
|
||||
import { kilo } from "./providers/kilo.js";
|
||||
import { llmgateway, llmgatewayProviders } from "./providers/llmgateway.js";
|
||||
import { llmgateway } from "./providers/llmgateway.js";
|
||||
import { mergeGateway } from "./providers/merge-gateway.js";
|
||||
import { meta } from "./providers/meta.js";
|
||||
import { nanoGpt } from "./providers/nano-gpt.js";
|
||||
import { openai } from "./providers/openai.js";
|
||||
import { ofox } from "./providers/ofox.js";
|
||||
@@ -85,8 +82,6 @@ export interface SyncProvider<SourceModel> {
|
||||
preserveSymlinks?: boolean;
|
||||
preserveBaseModels?: boolean;
|
||||
preserveDescriptions?: boolean;
|
||||
/** Replace existing leading comments with translateModel.header. */
|
||||
authoritativeHeaders?: boolean;
|
||||
sameModel?(current: ExistingModel, desired: SyncedModel): boolean;
|
||||
missingNotice?(paths: string[]): string[];
|
||||
/**
|
||||
@@ -103,17 +98,7 @@ export interface SyncProvider<SourceModel> {
|
||||
existing(id: string): ExistingModel | undefined;
|
||||
authored(id: string): ExistingModel | undefined;
|
||||
},
|
||||
): {
|
||||
id: string;
|
||||
model: SyncedModel;
|
||||
metadata?: { id: string; model: SyncedMetadata };
|
||||
/**
|
||||
* Leading comment block for the written file (e.g. the wire-path header
|
||||
* every toggle reasoning control requires). Existing headers win unless
|
||||
* authoritativeHeaders is enabled.
|
||||
*/
|
||||
header?: string;
|
||||
} | undefined;
|
||||
): { id: string; model: SyncedModel; metadata?: { id: string; model: SyncedMetadata } } | undefined;
|
||||
}
|
||||
|
||||
export interface SyncResult {
|
||||
@@ -133,7 +118,6 @@ export const providers: {
|
||||
anthropic: SyncProvider<any>;
|
||||
baseten: SyncProvider<any>;
|
||||
chutes: SyncProvider<any>;
|
||||
"cloudflare-ai-gateway": SyncProvider<any>;
|
||||
"cloudflare-workers-ai": SyncProvider<any>;
|
||||
cortecs: SyncProvider<any>;
|
||||
crossmodel: SyncProvider<any>;
|
||||
@@ -141,16 +125,13 @@ export const providers: {
|
||||
digitalocean: SyncProvider<any>;
|
||||
edenai: SyncProvider<any>;
|
||||
empiriolabs: SyncProvider<any>;
|
||||
"github-copilot": SyncProvider<any>;
|
||||
google: SyncProvider<any>;
|
||||
hyper: SyncProvider<any>;
|
||||
huggingface: SyncProvider<any>;
|
||||
inceptron: SyncProvider<any>;
|
||||
kilo: SyncProvider<any>;
|
||||
llmgateway: SyncProvider<any>;
|
||||
"llmgateway-providers": SyncProvider<any>;
|
||||
"merge-gateway": SyncProvider<any>;
|
||||
meta: SyncProvider<any>;
|
||||
"nano-gpt": SyncProvider<any>;
|
||||
ofox: SyncProvider<any>;
|
||||
openai: SyncProvider<any>;
|
||||
@@ -168,7 +149,6 @@ export const providers: {
|
||||
anthropic,
|
||||
baseten,
|
||||
chutes,
|
||||
"cloudflare-ai-gateway": cloudflareAiGateway,
|
||||
"cloudflare-workers-ai": cloudflareWorkersAi,
|
||||
cortecs,
|
||||
crossmodel,
|
||||
@@ -176,16 +156,13 @@ export const providers: {
|
||||
digitalocean,
|
||||
edenai,
|
||||
empiriolabs,
|
||||
"github-copilot": githubCopilot,
|
||||
google,
|
||||
hyper,
|
||||
huggingface,
|
||||
inceptron,
|
||||
kilo,
|
||||
llmgateway,
|
||||
"llmgateway-providers": llmgatewayProviders,
|
||||
"merge-gateway": mergeGateway,
|
||||
meta,
|
||||
"nano-gpt": nanoGpt,
|
||||
ofox,
|
||||
openai,
|
||||
@@ -209,7 +186,6 @@ export const groups = {
|
||||
"inceptron",
|
||||
"kilo",
|
||||
"llmgateway",
|
||||
"llmgateway-providers",
|
||||
"merge-gateway",
|
||||
"nano-gpt",
|
||||
"ofox",
|
||||
@@ -217,8 +193,8 @@ export const groups = {
|
||||
"openrouter",
|
||||
"vercel",
|
||||
],
|
||||
cloudflare: ["cloudflare-ai-gateway", "cloudflare-workers-ai"],
|
||||
direct: ["ambient", "anthropic", "baseten", "chutes", "cortecs", "deepinfra", "digitalocean", "github-copilot", "google", "hyper", "meta", "openai", "ovhcloud", "pioneer", "tinfoil", "venice", "wandb", "xai"],
|
||||
cloudflare: ["cloudflare-workers-ai"],
|
||||
direct: ["ambient", "anthropic", "baseten", "chutes", "cortecs", "deepinfra", "digitalocean", "google", "hyper", "openai", "ovhcloud", "pioneer", "tinfoil", "venice", "wandb", "xai"],
|
||||
} as const;
|
||||
|
||||
type ProviderID = keyof typeof providers;
|
||||
@@ -243,12 +219,7 @@ export async function syncProvider<SourceModel>(
|
||||
const { models: existing, brokenSymlinks } = existingState;
|
||||
let { modelMetadata } = existingState;
|
||||
const sourceModels = provider.parseModels(await provider.fetchModels());
|
||||
const desired = new Map<string, {
|
||||
model: z.infer<typeof SyncedAuthoredModel>;
|
||||
content: string;
|
||||
header: string;
|
||||
}>();
|
||||
const caseNormalizedDesiredPaths = new Map<string, string>();
|
||||
const desired = new Map<string, { model: z.infer<typeof SyncedAuthoredModel>; content: string }>();
|
||||
const desiredMetadata = new Map<string, { model: z.infer<typeof ModelMetadata>; content: string }>();
|
||||
const skippedRemote: string[] = [];
|
||||
|
||||
@@ -273,15 +244,9 @@ export async function syncProvider<SourceModel>(
|
||||
continue;
|
||||
}
|
||||
|
||||
const collidingPath = caseNormalizedDesiredPaths.get(relativePath.toLowerCase());
|
||||
if (collidingPath !== undefined) {
|
||||
throw new Error(
|
||||
collidingPath === relativePath
|
||||
? `Duplicate synced model path: ${provider.id}/${relativePath}`
|
||||
: `Synced model paths differ only in case: ${provider.id}/${collidingPath} and ${provider.id}/${relativePath}`,
|
||||
);
|
||||
if (desired.has(relativePath)) {
|
||||
throw new Error(`Duplicate synced model path: ${provider.id}/${relativePath}`);
|
||||
}
|
||||
caseNormalizedDesiredPaths.set(relativePath.toLowerCase(), relativePath);
|
||||
|
||||
if (translated.metadata !== undefined) {
|
||||
const parsedMetadata = ModelMetadata.safeParse({
|
||||
@@ -305,16 +270,13 @@ export async function syncProvider<SourceModel>(
|
||||
: preserveBaseModel(translated.model, existing.get(relativePath)?.authored);
|
||||
const translatedBase = "base_model" in translatedModel ? translatedModel.base_model : undefined;
|
||||
let resolvedReasoning: boolean | undefined;
|
||||
let baseReasoningOptions: unknown;
|
||||
if (translatedBase !== undefined) {
|
||||
if (translated.metadata?.id === translatedBase) {
|
||||
resolvedReasoning = translated.metadata.model.reasoning;
|
||||
baseReasoningOptions = translated.metadata.model.reasoning_options;
|
||||
} else {
|
||||
modelMetadata ??= await readModelMetadata(provider.modelsDir);
|
||||
const canonicalReasoning = modelMetadata[translatedBase]?.reasoning;
|
||||
resolvedReasoning = typeof canonicalReasoning === "boolean" ? canonicalReasoning : undefined;
|
||||
baseReasoningOptions = modelMetadata[translatedBase]?.reasoning_options;
|
||||
}
|
||||
} else {
|
||||
resolvedReasoning = existing.get(relativePath)?.toml.reasoning;
|
||||
@@ -323,7 +285,6 @@ export async function syncProvider<SourceModel>(
|
||||
translatedModel,
|
||||
existing.get(relativePath)?.authored,
|
||||
resolvedReasoning,
|
||||
baseReasoningOptions,
|
||||
);
|
||||
const withDescription = provider.preserveDescriptions === false
|
||||
? withReasoningOptions
|
||||
@@ -337,16 +298,9 @@ export async function syncProvider<SourceModel>(
|
||||
throw parsed.error;
|
||||
}
|
||||
|
||||
const translatedHeader = translated.header === undefined
|
||||
? undefined
|
||||
: leadingComments(translated.header);
|
||||
const header = provider.authoritativeHeaders
|
||||
? translatedHeader ?? ""
|
||||
: (existing.get(relativePath)?.header || translatedHeader) ?? "";
|
||||
desired.set(relativePath, {
|
||||
model: parsed.data,
|
||||
content: header + formatToml(parsed.data),
|
||||
header,
|
||||
content: (existing.get(relativePath)?.header ?? "") + formatToml(parsed.data),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -355,7 +309,7 @@ export async function syncProvider<SourceModel>(
|
||||
|
||||
const metadataDir = modelMetadataDir(provider.modelsDir);
|
||||
for (const [relativePath, file] of desiredMetadata) {
|
||||
const filePath = await safeWritePath(metadataDir, relativePath);
|
||||
const filePath = path.join(metadataDir, relativePath);
|
||||
const currentFile = Bun.file(filePath);
|
||||
const currentText = await currentFile.exists() ? await currentFile.text() : undefined;
|
||||
const current = currentText !== undefined
|
||||
@@ -386,7 +340,7 @@ export async function syncProvider<SourceModel>(
|
||||
console.log(`Skipping metadata removal in new-only mode: ${relativePath}`);
|
||||
continue;
|
||||
}
|
||||
const filePath = await safeWritePath(metadataDir, relativePath);
|
||||
const filePath = path.join(metadataDir, relativePath);
|
||||
files.push({ status: "deleted", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would remove metadata ${relativePath}`);
|
||||
@@ -397,7 +351,7 @@ export async function syncProvider<SourceModel>(
|
||||
}
|
||||
|
||||
for (const [relativePath, file] of desired) {
|
||||
const filePath = await safeWritePath(provider.modelsDir, relativePath, true);
|
||||
const filePath = path.join(provider.modelsDir, relativePath);
|
||||
const current = existing.get(relativePath);
|
||||
|
||||
if (current === undefined) {
|
||||
@@ -417,12 +371,7 @@ export async function syncProvider<SourceModel>(
|
||||
continue;
|
||||
}
|
||||
|
||||
const headerChanged = provider.authoritativeHeaders && current.header !== file.header;
|
||||
if (
|
||||
headerChanged
|
||||
|| !(provider.sameModel?.(current.authored, file.model)
|
||||
?? sameModel(relativePath, current.authored, file.model))
|
||||
) {
|
||||
if (!(provider.sameModel?.(current.authored, file.model) ?? sameModel(relativePath, current.authored, file.model))) {
|
||||
if (options.newOnly) {
|
||||
unchanged++;
|
||||
continue;
|
||||
@@ -455,7 +404,7 @@ export async function syncProvider<SourceModel>(
|
||||
continue;
|
||||
}
|
||||
|
||||
const filePath = await safeWritePath(provider.modelsDir, relativePath, true);
|
||||
const filePath = path.join(provider.modelsDir, relativePath);
|
||||
files.push({ status: "deleted", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would remove ${relativePath}`);
|
||||
@@ -527,7 +476,6 @@ export function preserveReasoningOptions(
|
||||
model: SyncedModel,
|
||||
existing: ExistingModel | undefined,
|
||||
resolvedReasoning: boolean | undefined = existing?.reasoning,
|
||||
baseReasoningOptions: unknown = undefined,
|
||||
): SyncedModel {
|
||||
if ((model.reasoning ?? resolvedReasoning) === false) {
|
||||
const { reasoning_options: _reasoningOptions, ...withoutReasoningOptions } = model;
|
||||
@@ -535,10 +483,7 @@ export function preserveReasoningOptions(
|
||||
}
|
||||
if (model.reasoning_options !== undefined) return model;
|
||||
if (existing?.reasoning_options === undefined) {
|
||||
// When the base model already declares reasoning_options, leave the field
|
||||
// unset so the factored file inherits them — stamping [] here would
|
||||
// shadow the base's real controls with "no controls".
|
||||
return (model.reasoning ?? resolvedReasoning) === true && baseReasoningOptions === undefined
|
||||
return (model.reasoning ?? resolvedReasoning) === true
|
||||
? { ...model, reasoning_options: [] }
|
||||
: model;
|
||||
}
|
||||
@@ -626,31 +571,6 @@ async function isSymlink(filePath: string) {
|
||||
}
|
||||
}
|
||||
|
||||
async function safeWritePath(root: string, relativePath: string, allowLeafSymlink = false) {
|
||||
const resolvedRoot = path.resolve(root);
|
||||
const target = path.resolve(resolvedRoot, relativePath);
|
||||
const relative = path.relative(resolvedRoot, target);
|
||||
if (relative === "" || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
||||
throw new Error(`Refusing to sync path outside ${root}: ${relativePath}`);
|
||||
}
|
||||
if (await isSymlink(resolvedRoot)) {
|
||||
throw new Error(`Refusing to sync through symlink: ${resolvedRoot}`);
|
||||
}
|
||||
|
||||
let current = resolvedRoot;
|
||||
for (const segment of path.relative(resolvedRoot, path.dirname(target)).split(path.sep)) {
|
||||
if (segment === "") continue;
|
||||
current = path.join(current, segment);
|
||||
if (await isSymlink(current)) {
|
||||
throw new Error(`Refusing to sync through symlink: ${current}`);
|
||||
}
|
||||
}
|
||||
if (!allowLeafSymlink && await isSymlink(target)) {
|
||||
throw new Error(`Refusing to sync through symlink: ${target}`);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
async function readModelMetadata(modelsDir: string) {
|
||||
const metadataDir = modelMetadataDir(modelsDir);
|
||||
const result: Record<string, Record<string, unknown>> = {};
|
||||
@@ -878,7 +798,7 @@ async function writeReport(target: string, results: SyncResult[]) {
|
||||
}
|
||||
}
|
||||
|
||||
lines.push("", "This PR was created automatically by the model sync workflow.");
|
||||
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`);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,502 +0,0 @@
|
||||
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { z } from "zod";
|
||||
|
||||
import { ReasoningOption } from "../../schema.js";
|
||||
import type { ExistingModel, SyncProvider, SyncedBaseModel } from "../index.js";
|
||||
|
||||
const API_BASE = "https://api.cloudflare.com/client/v4/accounts";
|
||||
const PROVIDER_DIR = path.join(
|
||||
import.meta.dirname,
|
||||
"..",
|
||||
"..",
|
||||
"..",
|
||||
"..",
|
||||
"..",
|
||||
"providers",
|
||||
"cloudflare-ai-gateway",
|
||||
);
|
||||
const MODELS_ROOT = path.join(import.meta.dirname, "..", "..", "..", "..", "..", "models");
|
||||
const CURATION_PATH = path.join(PROVIDER_DIR, "curation.toml");
|
||||
const TEXT_GENERATION = "Text Generation";
|
||||
const REQUEST_TIMEOUT_MS = 30_000;
|
||||
const MAX_CATALOG_PAGES = 1_000;
|
||||
const MAX_BACKOFF_DELAY_MS = 8_000;
|
||||
const MAX_RETRY_DELAY_MS = 60_000;
|
||||
|
||||
const NATIVE_NPM: Record<string, string> = {
|
||||
anthropic: "@ai-sdk/anthropic",
|
||||
openai: "@ai-sdk/openai",
|
||||
};
|
||||
|
||||
const CatalogEntry = z.object({
|
||||
model_id: z.string().refine(isSafeModelID, "model_id must be a safe relative provider/model path"),
|
||||
task: z.string(),
|
||||
context_length: z.number().int().positive().nullish(),
|
||||
pricing: z.record(z.number().nonnegative()).nullish(),
|
||||
}).passthrough();
|
||||
const CatalogModel = CatalogEntry.extend({
|
||||
task: z.literal(TEXT_GENERATION),
|
||||
context_length: z.number().int().positive().nullish(),
|
||||
pricing: z.record(z.number().nonnegative()),
|
||||
});
|
||||
|
||||
const CloudflareResponse = z.object({
|
||||
success: z.literal(true),
|
||||
result: z.array(CatalogEntry),
|
||||
result_info: z.object({
|
||||
page: z.number().int().positive(),
|
||||
per_page: z.number().int().positive(),
|
||||
total_count: z.number().int().nonnegative(),
|
||||
total_pages: z.number().int().positive().optional(),
|
||||
count: z.number().int().nonnegative().optional(),
|
||||
}).passthrough(),
|
||||
}).passthrough();
|
||||
|
||||
const SourceModel = z.object({
|
||||
catalog: CatalogModel,
|
||||
schemaInput: z.unknown().optional(),
|
||||
});
|
||||
|
||||
const CuratedModel = z.object({
|
||||
base_model: z.string().refine(isSafeModelID, "base_model must be a safe relative provider/model path").optional(),
|
||||
structured_output: z.boolean().optional(),
|
||||
reasoning_options: z.array(ReasoningOption).optional(),
|
||||
limit: z.object({
|
||||
context: z.number().optional(),
|
||||
input: z.number().optional(),
|
||||
output: z.number().optional(),
|
||||
}).strict().optional(),
|
||||
interleaved: z.union([
|
||||
z.literal(true),
|
||||
z.object({ field: z.enum(["reasoning_content", "reasoning_details"]) }).strict(),
|
||||
]).optional(),
|
||||
note: z.array(z.string().refine((value) => !/[\r\n]/.test(value))).optional(),
|
||||
}).strict();
|
||||
|
||||
const Curation = z.object({
|
||||
skip: z.array(z.string()).default([]),
|
||||
models: z.record(CuratedModel).default({}),
|
||||
}).strict();
|
||||
|
||||
type CatalogModel = z.infer<typeof CatalogModel>;
|
||||
type CatalogEntry = z.infer<typeof CatalogEntry>;
|
||||
type SourceModel = z.infer<typeof SourceModel>;
|
||||
type CuratedModel = z.infer<typeof CuratedModel>;
|
||||
|
||||
const curation = Curation.parse(Bun.TOML.parse(readFileSync(CURATION_PATH, "utf8")));
|
||||
const skippedModels = new Set(curation.skip);
|
||||
|
||||
export const cloudflareAiGateway = {
|
||||
id: "cloudflare-ai-gateway",
|
||||
name: "Cloudflare AI Gateway",
|
||||
modelsDir: "providers/cloudflare-ai-gateway/models",
|
||||
preserveDescriptions: false,
|
||||
authoritativeHeaders: true,
|
||||
async fetchModels() {
|
||||
const catalog = CatalogEntry.array().parse(await loadCatalog());
|
||||
const catalogIDs = new Set(catalog.map((model) => model.model_id));
|
||||
if (catalogIDs.size !== catalog.length) {
|
||||
throw new Error("Cloudflare AI Gateway catalog returned duplicate model IDs");
|
||||
}
|
||||
const textModels = catalog.filter((model) => model.task === TEXT_GENERATION);
|
||||
if (textModels.length === 0) {
|
||||
throw new Error("Cloudflare AI Gateway catalog returned no Text Generation models");
|
||||
}
|
||||
|
||||
const emittedModels = textModels.filter(
|
||||
(model) => !model.model_id.startsWith("@cf/") && !skippedModels.has(model.model_id),
|
||||
).map((model) => CatalogModel.parse(model));
|
||||
if (emittedModels.length === 0) {
|
||||
throw new Error("Cloudflare AI Gateway catalog returned no eligible proxied models");
|
||||
}
|
||||
const sources = await mapLimit(emittedModels, 6, async (model) => ({
|
||||
catalog: model,
|
||||
schemaInput: await loadCatalogSchemaInput(model.model_id),
|
||||
}));
|
||||
|
||||
const liveIDs = new Set(textModels.map((model) => model.model_id));
|
||||
for (const id of Object.keys(curation.models)) {
|
||||
if (!liveIDs.has(id)) console.warn(`warning: curation id not in live feed: ${id}`);
|
||||
}
|
||||
|
||||
return sources;
|
||||
},
|
||||
parseModels(raw) {
|
||||
return SourceModel.array().parse(raw);
|
||||
},
|
||||
translateModel(source, context) {
|
||||
const id = source.catalog.model_id;
|
||||
const curated = curation.models[id] ?? {};
|
||||
return {
|
||||
id,
|
||||
model: buildCloudflareAiGatewayModel(
|
||||
source.catalog,
|
||||
source.schemaInput,
|
||||
curated,
|
||||
context.authored(id),
|
||||
),
|
||||
header: noteHeader(curated.note),
|
||||
};
|
||||
},
|
||||
} satisfies SyncProvider<SourceModel>;
|
||||
|
||||
export function buildCloudflareAiGatewayModel(
|
||||
catalog: CatalogModel,
|
||||
schemaInput: unknown,
|
||||
curated: CuratedModel = {},
|
||||
existing?: ExistingModel,
|
||||
): SyncedBaseModel {
|
||||
const id = catalog.model_id;
|
||||
const baseModel = curated.base_model ?? resolveBaseModel(id);
|
||||
if (baseModel === undefined) {
|
||||
throw new Error(`${id}: no lab file and no curated base_model; add it to skip or map it`);
|
||||
}
|
||||
|
||||
const model: SyncedBaseModel = { base_model: baseModel };
|
||||
if (curated.structured_output !== undefined) {
|
||||
model.structured_output = curated.structured_output;
|
||||
}
|
||||
if (curated.interleaved !== undefined) model.interleaved = curated.interleaved;
|
||||
|
||||
if (baseReasoning(baseModel)) {
|
||||
const derived = deriveReasoningOptions(schemaInput);
|
||||
const reasoningOptions = curated.reasoning_options ?? (derived.length > 0 ? derived : undefined);
|
||||
if (reasoningOptions === undefined) {
|
||||
throw new Error(
|
||||
`${id}: base ${baseModel} reasons but the catalog schema and curation provide no reasoning_options`,
|
||||
);
|
||||
}
|
||||
model.reasoning_options = reasoningOptions;
|
||||
}
|
||||
|
||||
model.cost = proxiedCost(catalog.pricing, id);
|
||||
|
||||
const limit = {
|
||||
...(catalog.context_length == null && existing?.limit?.context === undefined
|
||||
? {}
|
||||
: { context: catalog.context_length ?? existing?.limit?.context }),
|
||||
...curated.limit,
|
||||
};
|
||||
if (Object.keys(limit).length > 0) model.limit = limit;
|
||||
|
||||
const npm = NATIVE_NPM[id.split("/")[0]!];
|
||||
if (npm !== undefined) model.provider = { npm };
|
||||
return model;
|
||||
}
|
||||
|
||||
export function deriveReasoningOptions(
|
||||
schemaInput: unknown,
|
||||
): NonNullable<SyncedBaseModel["reasoning_options"]> {
|
||||
let hasToggle = false;
|
||||
let effortValues: Array<"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "default">
|
||||
| undefined;
|
||||
|
||||
const EffortValues = z.array(z.enum([
|
||||
"none",
|
||||
"minimal",
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
"max",
|
||||
"default",
|
||||
]));
|
||||
|
||||
const visit = (node: unknown) => {
|
||||
if (Array.isArray(node)) {
|
||||
node.forEach(visit);
|
||||
return;
|
||||
}
|
||||
if (node === null || typeof node !== "object") return;
|
||||
|
||||
for (const [key, value] of Object.entries(node)) {
|
||||
if (key !== "properties" || value === null || typeof value !== "object") {
|
||||
visit(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const [property, rawSchema] of Object.entries(value)) {
|
||||
const propertySchema = rawSchema as Record<string, unknown>;
|
||||
if (property === "enable_thinking" || property === "thinking") hasToggle = true;
|
||||
if (property === "effort" || property === "reasoning_effort") {
|
||||
const candidates = [propertySchema, ...arrayValue(propertySchema.anyOf), ...arrayValue(propertySchema.oneOf)];
|
||||
for (const candidate of candidates) {
|
||||
const parsed = EffortValues.safeParse(candidate.enum);
|
||||
if (parsed.success) effortValues = parsed.data;
|
||||
}
|
||||
}
|
||||
visit(rawSchema);
|
||||
}
|
||||
}
|
||||
};
|
||||
visit(schemaInput);
|
||||
|
||||
const options: NonNullable<SyncedBaseModel["reasoning_options"]> = [];
|
||||
if (hasToggle) options.push({ type: "toggle" });
|
||||
if (effortValues !== undefined) options.push({ type: "effort", values: effortValues });
|
||||
return options;
|
||||
}
|
||||
|
||||
function arrayValue(value: unknown): Array<Record<string, unknown>> {
|
||||
return Array.isArray(value)
|
||||
? value.filter((item): item is Record<string, unknown> => item !== null && typeof item === "object")
|
||||
: [];
|
||||
}
|
||||
|
||||
async function loadCatalog() {
|
||||
const fixtureDir = process.env.CF_AIG_FIXTURE_DIR;
|
||||
if (fixtureDir !== undefined) return loadFixtureRows(fixtureDir, "catalog");
|
||||
|
||||
const { accountID, token } = credentials();
|
||||
const pages: Array<z.infer<typeof CloudflareResponse>> = [];
|
||||
for (let page = 1; page <= MAX_CATALOG_PAGES; page++) {
|
||||
const url = new URL(`${API_BASE}/${accountID}/ai/catalog/models`);
|
||||
url.searchParams.set("page", String(page));
|
||||
url.searchParams.set("per_page", "50");
|
||||
const { response, json } = await fetchJsonWithRetry(url, { headers: { Authorization: `Bearer ${token}` } });
|
||||
if (!response.ok) {
|
||||
throw new Error(`Cloudflare AI Gateway catalog request failed: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
const body = CloudflareResponse.parse(json);
|
||||
pages.push(body);
|
||||
const expectedPages = catalogPageCount(pages[0]!);
|
||||
if (expectedPages > MAX_CATALOG_PAGES) throw new Error(`Invalid Cloudflare AI Gateway catalog page count: ${expectedPages}`);
|
||||
if (page === expectedPages) return validateCatalogPages(pages, "Cloudflare AI Gateway catalog");
|
||||
}
|
||||
throw new Error("Cloudflare AI Gateway catalog exceeded the pagination safety limit");
|
||||
}
|
||||
|
||||
async function loadCatalogSchemaInput(id: string): Promise<unknown> {
|
||||
const fixtureDir = process.env.CF_AIG_FIXTURE_DIR;
|
||||
if (fixtureDir !== undefined) {
|
||||
const file = path.join(fixtureDir, "schema", `${id.replaceAll("/", "_")}.json`);
|
||||
if (!existsSync(file)) return undefined;
|
||||
return z.object({
|
||||
success: z.literal(true),
|
||||
result: z.object({ schema: z.object({ input: z.unknown().optional() }).passthrough() }).passthrough(),
|
||||
}).passthrough().parse(JSON.parse(readFileSync(file, "utf8"))).result.schema.input;
|
||||
}
|
||||
|
||||
const { accountID, token } = credentials();
|
||||
const { response, json } = await fetchJsonWithRetry(
|
||||
`${API_BASE}/${accountID}/ai/catalog/models/${id.split("/").map(encodeURIComponent).join("/")}/schema`,
|
||||
{ headers: { Authorization: `Bearer ${token}` } },
|
||||
);
|
||||
if (response.status === 404) return undefined;
|
||||
if (!response.ok) {
|
||||
throw new Error(`Cloudflare AI Gateway schema request failed for ${id}: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
return z.object({
|
||||
success: z.literal(true),
|
||||
result: z.object({ schema: z.object({ input: z.unknown().optional() }).passthrough() }).passthrough(),
|
||||
}).passthrough().parse(json).result.schema.input;
|
||||
}
|
||||
|
||||
function credentials() {
|
||||
const token = process.env.CLOUDFLARE_API_TOKEN
|
||||
?? process.env.CLOUDFLARE_PRODUCTION_API_TOKEN;
|
||||
const accountID = process.env.CLOUDFLARE_ACCOUNT_ID
|
||||
?? process.env.CLOUDFLARE_PRODUCTION_ACCOUNT_ID_AI_GATEWAY_SANDBOX;
|
||||
if (!token || !accountID) {
|
||||
throw new Error(
|
||||
"Cloudflare AI Gateway sync requires Cloudflare API token and account ID credentials",
|
||||
);
|
||||
}
|
||||
return { accountID, token };
|
||||
}
|
||||
|
||||
function loadFixtureRows(directory: string, prefix: string): unknown[] {
|
||||
const pages = readdirSync(directory)
|
||||
.filter((name) => name.startsWith(prefix) && name.endsWith(".json"))
|
||||
.sort()
|
||||
.map((file) => CloudflareResponse.parse(JSON.parse(readFileSync(path.join(directory, file), "utf8"))))
|
||||
.sort((a, b) => a.result_info.page - b.result_info.page);
|
||||
return validateCatalogPages(pages, `Cloudflare AI Gateway fixtures in ${directory}`);
|
||||
}
|
||||
|
||||
function catalogPageCount(page: z.infer<typeof CloudflareResponse>) {
|
||||
const calculated = Math.max(1, Math.ceil(page.result_info.total_count / page.result_info.per_page));
|
||||
if (page.result_info.total_pages !== undefined && page.result_info.total_pages !== calculated) {
|
||||
throw new Error("Invalid Cloudflare AI Gateway catalog pagination: total_pages does not match total_count");
|
||||
}
|
||||
return page.result_info.total_pages ?? calculated;
|
||||
}
|
||||
|
||||
function validateCatalogPages(pages: Array<z.infer<typeof CloudflareResponse>>, source: string) {
|
||||
const first = pages[0];
|
||||
if (first === undefined) throw new Error(`${source} contained no pages`);
|
||||
const expectedPages = catalogPageCount(first);
|
||||
if (pages.length !== expectedPages) {
|
||||
throw new Error(`${source} contains ${pages.length}/${expectedPages} pages`);
|
||||
}
|
||||
|
||||
const models: CatalogEntry[] = [];
|
||||
const ids = new Set<string>();
|
||||
for (const [index, page] of pages.entries()) {
|
||||
if (page.result_info.page !== index + 1) {
|
||||
throw new Error(`${source} expected page ${index + 1}, got ${page.result_info.page}`);
|
||||
}
|
||||
if (
|
||||
page.result_info.total_count !== first.result_info.total_count
|
||||
|| page.result_info.per_page !== first.result_info.per_page
|
||||
|| catalogPageCount(page) !== expectedPages
|
||||
) {
|
||||
throw new Error(`${source} pagination changed while reading pages`);
|
||||
}
|
||||
if (page.result_info.count !== undefined && page.result_info.count !== page.result.length) {
|
||||
throw new Error(`${source} result count mismatch on page ${page.result_info.page}`);
|
||||
}
|
||||
if (page.result.length > page.result_info.per_page) {
|
||||
throw new Error(`${source} page ${page.result_info.page} exceeds per_page`);
|
||||
}
|
||||
for (const model of page.result) {
|
||||
if (ids.has(model.model_id)) throw new Error(`${source} returned duplicate model ID ${model.model_id}`);
|
||||
ids.add(model.model_id);
|
||||
models.push(model);
|
||||
}
|
||||
}
|
||||
if (models.length !== first.result_info.total_count) {
|
||||
throw new Error(`${source} pagination ended at ${models.length}/${first.result_info.total_count}`);
|
||||
}
|
||||
return models;
|
||||
}
|
||||
|
||||
async function fetchJsonWithRetry(
|
||||
url: string | URL,
|
||||
init: RequestInit,
|
||||
attempts = 5,
|
||||
): Promise<{ response: Response; json?: unknown }> {
|
||||
let delay = 500;
|
||||
for (let attempt = 1; attempt <= attempts; attempt++) {
|
||||
try {
|
||||
const timeout = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
||||
const response = await fetch(url, {
|
||||
...init,
|
||||
signal: init.signal ? AbortSignal.any([init.signal, timeout]) : timeout,
|
||||
});
|
||||
if (!response.ok) {
|
||||
if ((response.status === 429 || response.status >= 500) && attempt < attempts) {
|
||||
await response.body?.cancel();
|
||||
await waitForRetry(retryDelay(response, delay), init.signal);
|
||||
delay = Math.min(delay * 2, MAX_BACKOFF_DELAY_MS);
|
||||
continue;
|
||||
}
|
||||
await response.body?.cancel();
|
||||
return { response };
|
||||
}
|
||||
try {
|
||||
return { response, json: await response.json() };
|
||||
} catch (error) {
|
||||
if (attempt === attempts) throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
if (init.signal?.aborted || attempt === attempts) throw error;
|
||||
}
|
||||
await waitForRetry(delay, init.signal);
|
||||
delay = Math.min(delay * 2, MAX_BACKOFF_DELAY_MS);
|
||||
}
|
||||
throw new Error("Cloudflare AI Gateway request exhausted retries");
|
||||
}
|
||||
|
||||
function retryDelay(response: Response, fallback: number) {
|
||||
const value = response.headers.get("retry-after");
|
||||
if (value === null) return fallback;
|
||||
const seconds = Number(value);
|
||||
if (Number.isFinite(seconds) && seconds >= 0) return Math.min(seconds * 1_000, MAX_RETRY_DELAY_MS);
|
||||
const timestamp = Date.parse(value);
|
||||
return Number.isFinite(timestamp)
|
||||
? Math.min(Math.max(timestamp - Date.now(), 0), MAX_RETRY_DELAY_MS)
|
||||
: fallback;
|
||||
}
|
||||
|
||||
function waitForRetry(delay: number, signal: AbortSignal | null | undefined) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (signal?.aborted) return reject(signal.reason);
|
||||
const onAbort = () => {
|
||||
clearTimeout(timer);
|
||||
reject(signal.reason);
|
||||
};
|
||||
const timer = setTimeout(() => {
|
||||
signal?.removeEventListener("abort", onAbort);
|
||||
resolve();
|
||||
}, delay);
|
||||
signal?.addEventListener("abort", onAbort, { once: true });
|
||||
});
|
||||
}
|
||||
|
||||
async function mapLimit<T, R>(items: T[], limit: number, transform: (item: T) => Promise<R>) {
|
||||
const results = new Array<R>(items.length);
|
||||
let next = 0;
|
||||
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, async () => {
|
||||
while (next < items.length) {
|
||||
const index = next++;
|
||||
results[index] = await transform(items[index]!);
|
||||
}
|
||||
}));
|
||||
return results;
|
||||
}
|
||||
|
||||
const FLAT_PRICING_KEYS: Record<string, "input" | "output" | "cache_read" | "cache_write"> = {
|
||||
"Input tokens (per 1M)": "input",
|
||||
"Output tokens (per 1M)": "output",
|
||||
"Cached input tokens (per 1M)": "cache_read",
|
||||
"Cache creation tokens (per 1M)": "cache_write",
|
||||
};
|
||||
const TIERED_PRICING_KEY = /^(Input|Output|Cached input)\s*(<=?|>=?)\s*(\d+)k\s*\(per 1M\)$/;
|
||||
const TIERED_PRICING_FIELDS = {
|
||||
Input: "input",
|
||||
Output: "output",
|
||||
"Cached input": "cache_read",
|
||||
} as const;
|
||||
|
||||
function proxiedCost(pricing: Record<string, number>, id: string): NonNullable<SyncedBaseModel["cost"]> {
|
||||
const cost: NonNullable<SyncedBaseModel["cost"]> = {};
|
||||
for (const [key, value] of Object.entries(pricing)) {
|
||||
const flatField = FLAT_PRICING_KEYS[key];
|
||||
if (flatField !== undefined) {
|
||||
cost[flatField] = value;
|
||||
continue;
|
||||
}
|
||||
const tier = TIERED_PRICING_KEY.exec(key);
|
||||
if (tier !== null) {
|
||||
const field = TIERED_PRICING_FIELDS[tier[1] as keyof typeof TIERED_PRICING_FIELDS];
|
||||
if (tier[2]!.startsWith("<")) cost[field] = value;
|
||||
continue;
|
||||
}
|
||||
throw new Error(`${id}: unmapped pricing key "${key}"`);
|
||||
}
|
||||
if (cost.input === undefined || cost.output === undefined) {
|
||||
throw new Error(`${id}: catalog pricing must include input and output rates`);
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
function isSafeModelID(id: string) {
|
||||
if (path.isAbsolute(id) || id.includes("\\")) return false;
|
||||
const segments = id.split("/");
|
||||
return segments.length >= 2
|
||||
&& segments.every((segment) => /^[A-Za-z0-9@._-]+$/.test(segment) && segment !== "." && segment !== "..");
|
||||
}
|
||||
|
||||
function resolveBaseModel(id: string) {
|
||||
if (labFileExists(id)) return id;
|
||||
const dashed = id.replaceAll(".", "-");
|
||||
return labFileExists(dashed) ? dashed : undefined;
|
||||
}
|
||||
|
||||
function labFileExists(id: string) {
|
||||
return existsSync(path.join(MODELS_ROOT, `${id}.toml`));
|
||||
}
|
||||
|
||||
function baseReasoning(id: string) {
|
||||
const file = path.join(MODELS_ROOT, `${id}.toml`);
|
||||
return existsSync(file) && z.object({ reasoning: z.boolean().optional() }).passthrough()
|
||||
.parse(Bun.TOML.parse(readFileSync(file, "utf8"))).reasoning === true;
|
||||
}
|
||||
|
||||
function noteHeader(note: string[] | undefined) {
|
||||
return note === undefined || note.length === 0
|
||||
? undefined
|
||||
: `${note.map((line) => `# ${line}`).join("\n")}\n`;
|
||||
}
|
||||
@@ -13,16 +13,6 @@ const CANONICAL_BASE_MODEL_EXCEPTIONS = {
|
||||
const EUR_TO_USD = 1.114;
|
||||
|
||||
const CortecsModality = z.enum(["text", "audio", "image", "video", "pdf"]);
|
||||
type CortecsModality = z.infer<typeof CortecsModality>;
|
||||
|
||||
function modalities(values: string[]): CortecsModality[] {
|
||||
const allowed = new Set<CortecsModality>(CortecsModality.options);
|
||||
const result = values
|
||||
.map((value) => value.toLowerCase())
|
||||
.map((value) => value === "file" ? "pdf" : value)
|
||||
.filter((value): value is CortecsModality => allowed.has(value as CortecsModality));
|
||||
return [...new Set<CortecsModality>(result.length > 0 ? result : ["text"])];
|
||||
}
|
||||
|
||||
export const CortecsModel = z.object({
|
||||
id: z.string().min(1),
|
||||
@@ -36,9 +26,8 @@ export const CortecsModel = z.object({
|
||||
cache_write_cost: z.number().nonnegative().optional(),
|
||||
}).passthrough(),
|
||||
context_size: z.number().int().positive(),
|
||||
max_output_tokens: z.number().int().positive().optional(),
|
||||
input_modalities: z.array(z.string()).transform(modalities).default(["text"]),
|
||||
output_modalities: z.array(z.string()).transform(modalities).default(["text"]),
|
||||
input_modalities: z.array(CortecsModality).default(["text"]),
|
||||
output_modalities: z.array(CortecsModality).default(["text"]),
|
||||
supported_features: z.array(z.string()).default([]),
|
||||
}).passthrough();
|
||||
|
||||
@@ -98,7 +87,7 @@ export function buildCortecsModel(
|
||||
const limit = {
|
||||
context: model.context_size,
|
||||
input: existing?.limit?.input,
|
||||
output: model.max_output_tokens ?? authored?.limit?.output ?? model.context_size,
|
||||
output: authored?.limit?.output ?? model.context_size,
|
||||
};
|
||||
const cost = {
|
||||
input: usd(model.pricing.input_token),
|
||||
|
||||
@@ -22,13 +22,11 @@ function baseModelExists(modelID: string): boolean {
|
||||
// CROSSMODEL_MODELS_URL overrides the endpoint (e.g. a local backend) for testing.
|
||||
const API_ENDPOINT = process.env.CROSSMODEL_MODELS_URL ?? "https://www.crossmodel.ai/api/models";
|
||||
|
||||
const REASONING_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"] as const;
|
||||
|
||||
const ReasoningCapability = z
|
||||
.object({
|
||||
supported: z.boolean().optional(),
|
||||
toggle: z.boolean().nullish().transform((value) => value ?? undefined),
|
||||
effort: z.array(z.enum(REASONING_EFFORTS)).nullish().transform((value) => value ?? undefined),
|
||||
effort: z.array(z.string()).nullish().transform((value) => value ?? undefined),
|
||||
budget_tokens: z
|
||||
.object({ min: z.number().optional(), max: z.number().optional() })
|
||||
.nullish()
|
||||
@@ -162,6 +160,15 @@ function modalities(values: string[] | undefined, fallback: Modality[]): Modalit
|
||||
return [...new Set(result.length > 0 ? result : fallback)];
|
||||
}
|
||||
|
||||
// models.dev's reasoning_options effort enum (schema.ts ReasoningEffortValue).
|
||||
// Guarding against it means an unexpected upstream value is dropped instead of
|
||||
// silently producing a TOML that fails `validate`.
|
||||
const REASONING_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"] as const;
|
||||
type ReasoningEffort = (typeof REASONING_EFFORTS)[number];
|
||||
function isReasoningEffort(value: string): value is ReasoningEffort {
|
||||
return (REASONING_EFFORTS as readonly string[]).includes(value);
|
||||
}
|
||||
|
||||
// Project CrossModel's capabilities.reasoning onto models.dev reasoning_options.
|
||||
// reasoning absent -> undefined (non-reasoning model; option omitted)
|
||||
// reasoning === {} -> [] (model reasons, no verified user-selectable control)
|
||||
@@ -172,7 +179,8 @@ function reasoningOptions(model: CrossModelModel): SyncedModel["reasoning_option
|
||||
const options: NonNullable<SyncedModel["reasoning_options"]> = [];
|
||||
if (reasoning.toggle === true) options.push({ type: "toggle" });
|
||||
if (reasoning.effort !== undefined) {
|
||||
if (reasoning.effort.length > 0) options.push({ type: "effort", values: reasoning.effort });
|
||||
const values = reasoning.effort.filter(isReasoningEffort);
|
||||
if (values.length > 0) options.push({ type: "effort", values });
|
||||
}
|
||||
if (reasoning.budget_tokens !== undefined) {
|
||||
const budget: { type: "budget_tokens"; min?: number; max?: number } = { type: "budget_tokens" };
|
||||
@@ -180,9 +188,6 @@ function reasoningOptions(model: CrossModelModel): SyncedModel["reasoning_option
|
||||
if (reasoning.budget_tokens.max !== undefined) budget.max = reasoning.budget_tokens.max;
|
||||
options.push(budget);
|
||||
}
|
||||
if (options.some((option) => option.type === "effort" && option.values.includes("none"))) {
|
||||
return options.filter((option) => option.type !== "toggle");
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@@ -575,13 +575,13 @@ export function resolveDigitalOceanBaseModel(id: string) {
|
||||
if (id.startsWith("gemma")) candidates.push(`google/${id}`);
|
||||
|
||||
// anthropic-claude-5-sonnet → anthropic/claude-sonnet-5
|
||||
const anthropicSwapped = id.match(/^anthropic-claude-(\d+(?:\.\d+)?)-([a-z]+)$/);
|
||||
const anthropicSwapped = id.match(/^anthropic-claude-(\d+(?:\.\d+)?)-(opus|sonnet|haiku)$/);
|
||||
if (anthropicSwapped !== null) {
|
||||
candidates.push(`anthropic/claude-${anthropicSwapped[2]}-${anthropicSwapped[1]}`);
|
||||
}
|
||||
// anthropic-claude-opus-5 → anthropic/claude-opus-5
|
||||
// also normalize dotted versions: anthropic-claude-opus-4.6 → anthropic/claude-opus-4-6
|
||||
const anthropicFamily = id.match(/^anthropic-claude-([a-z]+)-(\d+(?:\.\d+)?)$/);
|
||||
const anthropicFamily = id.match(/^anthropic-claude-(opus|sonnet|haiku)-(\d+(?:\.\d+)?)$/);
|
||||
if (anthropicFamily !== null) {
|
||||
const version = anthropicFamily[2].replaceAll(".", "-");
|
||||
candidates.push(`anthropic/claude-${anthropicFamily[1]}-${anthropicFamily[2]}`);
|
||||
|
||||
@@ -3,7 +3,7 @@ import path from "node:path";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
|
||||
import type { SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
|
||||
import {
|
||||
factorBaseModel,
|
||||
modelMetadata,
|
||||
@@ -230,10 +230,10 @@ function regionVariantName(model: EdenAIModel, baseModel: string) {
|
||||
// Reasoning options
|
||||
// ========================================
|
||||
|
||||
// This sync currently maps only `reasoning_effort`, using the effort list the
|
||||
// lab entry (or an established relay peer) documents. Toggle / budget controls
|
||||
// need route-specific mappings. Preserve authored controls when unresolved;
|
||||
// skip new models rather than inventing an empty control set.
|
||||
// Eden AI's only reasoning control is `reasoning_effort`, so a model is
|
||||
// published with the effort list its lab entry (or an established relay peer)
|
||||
// already documents. Peers exposing only `toggle` / `budget_tokens` have no
|
||||
// equivalent here, and those models are skipped rather than given a guess.
|
||||
function effortValues(options: unknown): string[] | "always-on" | undefined {
|
||||
if (!Array.isArray(options)) return undefined;
|
||||
if (options.length === 0) return "always-on";
|
||||
@@ -425,7 +425,6 @@ function mapModalities(values: readonly string[] | null | undefined) {
|
||||
|
||||
export function buildEdenAIModel(
|
||||
model: EdenAIModel,
|
||||
existing?: ExistingModel,
|
||||
firstParty: ReadonlySet<string> = firstPartyBaseModels,
|
||||
): SyncedModel | undefined {
|
||||
const baseModel = resolveEdenAIBaseModel(model);
|
||||
@@ -450,7 +449,7 @@ export function buildEdenAIModel(
|
||||
// the lab entry owns it and only the effort controls are authored here.
|
||||
const reasoning = modelMetadata(baseModel).reasoning === true;
|
||||
const reasoningOptions = reasoning
|
||||
? reasoningOptionsFor(baseModel) ?? existing?.reasoning_options
|
||||
? reasoningOptionsFor(baseModel)
|
||||
: undefined;
|
||||
if (reasoning && reasoningOptions === undefined) return undefined;
|
||||
|
||||
@@ -495,24 +494,12 @@ export const edenai = {
|
||||
return response.json();
|
||||
},
|
||||
parseModels(raw) {
|
||||
const unique = new Map<string, EdenAIModel>();
|
||||
for (const model of EdenAIResponse.parse(raw).data) {
|
||||
const key = model.id.toLowerCase();
|
||||
const previous = unique.get(key);
|
||||
// Eden AI publishes case-only duplicates that collide on macOS. Keep the
|
||||
// lowercase API ID, but retain context metadata supplied by its duplicate.
|
||||
const preferred = model.id === key ? model : previous ?? model;
|
||||
unique.set(key, {
|
||||
...preferred,
|
||||
context_length: preferred.context_length ?? previous?.context_length ?? model.context_length,
|
||||
});
|
||||
}
|
||||
const models = [...unique.values()];
|
||||
const models = EdenAIResponse.parse(raw).data;
|
||||
firstPartyBaseModels = collectFirstPartyBaseModels(models);
|
||||
return models;
|
||||
},
|
||||
translateModel(model, context) {
|
||||
const built = buildEdenAIModel(model, context.existing(model.id));
|
||||
translateModel(model) {
|
||||
const built = buildEdenAIModel(model);
|
||||
if (built === undefined) return undefined;
|
||||
return { id: model.id, model: built };
|
||||
},
|
||||
|
||||
@@ -191,9 +191,6 @@ function reasoningOptions(model: EmpiriolabsModel): SyncedModel["reasoning_optio
|
||||
if (budget.max !== undefined) option.max = budget.max;
|
||||
options.push(option);
|
||||
}
|
||||
if (options.some((option) => option.type === "effort" && option.values.includes("none"))) {
|
||||
return options.filter((option) => option.type !== "toggle");
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { ExistingModel, SyncProvider, SyncedModel } from "../index.js";
|
||||
|
||||
const PRICING_ENDPOINT = "https://raw.githubusercontent.com/github/docs/main/data/tables/copilot/models-and-pricing.yml";
|
||||
|
||||
const NOT_APPLICABLE = "Not applicable";
|
||||
|
||||
const Price = z.string().regex(/^\$\d+(?:\.\d+)?$/u);
|
||||
|
||||
export const GitHubCopilotPricingRow = z.object({
|
||||
model: z.string().min(1),
|
||||
provider: z.string().min(1),
|
||||
release_status: z.string().min(1),
|
||||
category: z.string().min(1),
|
||||
threshold: z.string().optional(),
|
||||
tier: z.string().optional(),
|
||||
input: Price,
|
||||
cached_input: Price,
|
||||
output: Price,
|
||||
cache_write: z.union([Price, z.literal(NOT_APPLICABLE)]).optional(),
|
||||
notes: z.string().optional(),
|
||||
}).passthrough();
|
||||
|
||||
export type GitHubCopilotPricingRow = z.infer<typeof GitHubCopilotPricingRow>;
|
||||
|
||||
export interface GitHubCopilotPricingModel {
|
||||
slug: string;
|
||||
releaseStatus: string;
|
||||
rows: GitHubCopilotPricingRow[];
|
||||
}
|
||||
|
||||
// Map names in pricing YAML to actual filenames in repo
|
||||
const FILE_ALIASES: Record<string, string> = {
|
||||
"mai-code-1-flash": "mai-code-1-flash-picker",
|
||||
};
|
||||
|
||||
const IGNORED_ROWS = new Set([
|
||||
// Goes in [experimental.modes.fast] under claude-opus-4.8
|
||||
"claude-opus-4.8-fast-mode-preview",
|
||||
// No matching model in repo
|
||||
"raptor-mini",
|
||||
]);
|
||||
|
||||
export function githubCopilotModelSlug(name: string) {
|
||||
return name
|
||||
.replace(/\[\^[^\]]*\]/gu, "")
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9.]+/gu, "-")
|
||||
.replace(/^-+|-+$/gu, "");
|
||||
}
|
||||
|
||||
function price(value: string) {
|
||||
return value === NOT_APPLICABLE ? undefined : Number(value.slice(1));
|
||||
}
|
||||
|
||||
function rowCost(row: GitHubCopilotPricingRow) {
|
||||
return {
|
||||
input: price(row.input),
|
||||
output: price(row.output),
|
||||
cache_read: price(row.cached_input),
|
||||
cache_write: row.cache_write === undefined ? undefined : price(row.cache_write),
|
||||
};
|
||||
}
|
||||
|
||||
function longContextThresholdSize(threshold: string | undefined, slug: string) {
|
||||
const match = threshold?.match(/^>\s*(\d+(?:\.\d+)?)\s*([KM])$/u);
|
||||
if (!match) throw new Error(`Unparseable long-context threshold for ${slug}: ${threshold}`);
|
||||
return Number(match[1]) * (match[2] === "K" ? 1_000 : 1_000_000);
|
||||
}
|
||||
|
||||
export function buildGitHubCopilotCost(model: GitHubCopilotPricingModel) {
|
||||
const defaults: GitHubCopilotPricingRow[] = [];
|
||||
const longContext: GitHubCopilotPricingRow[] = [];
|
||||
for (const row of model.rows) {
|
||||
const tier = row.tier ?? "Default";
|
||||
if (tier === "Default") defaults.push(row);
|
||||
else if (tier === "Long context") longContext.push(row);
|
||||
else throw new Error(`Unknown pricing tier for ${model.slug}: ${row.tier}`);
|
||||
}
|
||||
const base = defaults[0];
|
||||
if (base === undefined || defaults.length > 1) {
|
||||
throw new Error(`Expected exactly one default pricing row for ${model.slug}, found ${defaults.length}`);
|
||||
}
|
||||
|
||||
const tiers = longContext
|
||||
.map((row) => ({
|
||||
tier: { type: "context" as const, size: longContextThresholdSize(row.threshold, model.slug) },
|
||||
...rowCost(row),
|
||||
}))
|
||||
.sort((a, b) => a.tier.size - b.tier.size);
|
||||
|
||||
return { ...rowCost(base), tiers: tiers.length > 0 ? tiers : undefined };
|
||||
}
|
||||
|
||||
export function parseGitHubCopilotPricing(raw: unknown) {
|
||||
const rows = z.array(GitHubCopilotPricingRow).parse(raw);
|
||||
const models = new Map<string, GitHubCopilotPricingModel>();
|
||||
for (const row of rows) {
|
||||
const slug = githubCopilotModelSlug(row.model);
|
||||
const model = models.get(slug) ?? { slug, releaseStatus: row.release_status, rows: [] };
|
||||
model.rows.push(row);
|
||||
models.set(slug, model);
|
||||
}
|
||||
return [...models.values()];
|
||||
}
|
||||
|
||||
export function buildGitHubCopilotModel(
|
||||
model: GitHubCopilotPricingModel,
|
||||
authored: ExistingModel,
|
||||
): SyncedModel {
|
||||
// Only update token rates, leaving audio/reasoning rates and all other
|
||||
// fields untouched.
|
||||
const cost = { ...authored.cost, ...buildGitHubCopilotCost(model) };
|
||||
return { ...authored, cost } as SyncedModel;
|
||||
}
|
||||
|
||||
export const githubCopilot = {
|
||||
id: "github-copilot",
|
||||
name: "GitHub Copilot",
|
||||
modelsDir: "providers/github-copilot/models",
|
||||
skipCreates: true,
|
||||
deleteMissing: false,
|
||||
sourceID(model) {
|
||||
return IGNORED_ROWS.has(model.slug) ? undefined : model.slug;
|
||||
},
|
||||
skippedNotice(ids) {
|
||||
if (ids.length === 0) return [];
|
||||
return [
|
||||
`${ids.length} Copilot pricing table models have no local catalog file: ${ids.map((id) => `\`${id}\``).join(", ")}`,
|
||||
];
|
||||
},
|
||||
missingNotice(paths) {
|
||||
if (paths.length === 0) return [];
|
||||
return [
|
||||
`${paths.length} local Copilot models are missing from the docs pricing table and were retained: ${paths.map((path) => `\`${path}\``).join(", ")}`,
|
||||
];
|
||||
},
|
||||
async fetchModels() {
|
||||
const response = await fetch(PRICING_ENDPOINT);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Copilot pricing request failed: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
return Bun.YAML.parse(await response.text());
|
||||
},
|
||||
parseModels: parseGitHubCopilotPricing,
|
||||
translateModel(model, context) {
|
||||
if (IGNORED_ROWS.has(model.slug)) return undefined;
|
||||
const candidates = [
|
||||
model.slug,
|
||||
FILE_ALIASES[model.slug],
|
||||
model.releaseStatus === "Public preview" ? `${model.slug}-preview` : undefined,
|
||||
].filter((candidate) => candidate !== undefined);
|
||||
const id = candidates.find((candidate) => context.authored(candidate) !== undefined);
|
||||
const authored = id === undefined ? undefined : context.authored(id);
|
||||
if (id === undefined || authored === undefined) return undefined;
|
||||
return {
|
||||
id,
|
||||
model: buildGitHubCopilotModel(model, authored),
|
||||
header: "# Pricing: https://docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing\n",
|
||||
};
|
||||
},
|
||||
} satisfies SyncProvider<GitHubCopilotPricingModel>;
|
||||
@@ -1,21 +1,16 @@
|
||||
import { z } from "zod";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { describeModel } from "../../describe.js";
|
||||
import { inferKimiFamily, ModelFamilyValues } from "../../family.js";
|
||||
import { ReasoningOption } from "../../schema.js";
|
||||
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
|
||||
import { factorBaseModel, resolveModelMetadataBaseModel } from "./openrouter.js";
|
||||
import { factorBaseModel, resolveCanonicalBaseModel } from "./openrouter.js";
|
||||
|
||||
const API_ENDPOINT = "https://api.llmgateway.io/v1/models";
|
||||
|
||||
// LLM Gateway names the originating lab in `family`; most already match the
|
||||
// canonical prefixes understood by resolveModelMetadataBaseModel, and labs
|
||||
// outside that shared table (e.g. perplexity) resolve through its exact
|
||||
// `models/` path match without widening the OpenRouter prefix map for every
|
||||
// other provider. Alias the few that spell the lab differently. (Mirrors
|
||||
// huggingface's CANONICAL_ORG_PREFIXES.)
|
||||
// canonical prefixes understood by resolveCanonicalBaseModel. Alias the few that
|
||||
// spell the lab differently. (Mirrors huggingface's CANONICAL_ORG_PREFIXES.)
|
||||
const CANONICAL_FAMILY_ALIASES: Record<string, string> = {
|
||||
grok: "xai",
|
||||
mistral: "mistralai",
|
||||
@@ -35,6 +30,10 @@ const Pricing = z.object({
|
||||
input_cache_write: z.string().optional(),
|
||||
});
|
||||
|
||||
const LLMGatewayProvider = z.object({
|
||||
reasoning_efforts: z.array(z.string()).optional(),
|
||||
}).passthrough();
|
||||
|
||||
const ReasoningEffortOrder = new Map([
|
||||
"none",
|
||||
"minimal",
|
||||
@@ -55,22 +54,9 @@ export const LLMGatewayModel = z.object({
|
||||
input_modalities: z.array(z.string()),
|
||||
output_modalities: z.array(z.string()),
|
||||
}),
|
||||
providers: z.array(
|
||||
z.object({
|
||||
providerId: z.string().optional(),
|
||||
vision: z.boolean().optional(),
|
||||
tools: z.boolean().optional(),
|
||||
reasoning: z.boolean().optional(),
|
||||
reasoning_efforts: z.array(
|
||||
z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"]),
|
||||
).optional(),
|
||||
}).passthrough(),
|
||||
).optional(),
|
||||
pricing: Pricing,
|
||||
// Absent for pseudo-models (custom/auto) and some non-text mappings; text
|
||||
// models always report it.
|
||||
context_length: z.number().optional(),
|
||||
max_output: z.number().optional(),
|
||||
providers: z.array(LLMGatewayProvider),
|
||||
context_length: z.number(),
|
||||
supported_parameters: z.array(z.string()),
|
||||
structured_outputs: z.boolean().optional(),
|
||||
}).passthrough();
|
||||
@@ -81,117 +67,31 @@ export const LLMGatewayResponse = z.object({
|
||||
|
||||
export type LLMGatewayModel = z.infer<typeof LLMGatewayModel>;
|
||||
|
||||
async function fetchLLMGatewayModels(url: string) {
|
||||
const headers = process.env.LLMGATEWAY_API_KEY
|
||||
? { Authorization: `Bearer ${process.env.LLMGATEWAY_API_KEY}` }
|
||||
: undefined;
|
||||
const response = await fetch(url, { headers });
|
||||
if (!response.ok) {
|
||||
throw new Error(`LLM Gateway request failed: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
|
||||
function textOnly(model: LLMGatewayModel) {
|
||||
const output = model.architecture.output_modalities;
|
||||
return output.length === 1 && output[0] === "text";
|
||||
}
|
||||
|
||||
// The DevPass (LLM Gateway) provider: the gateway's aggregated catalog of root
|
||||
// model IDs, auto-routed across upstream providers.
|
||||
export const llmgateway = {
|
||||
id: "llmgateway",
|
||||
name: "DevPass (LLM Gateway)",
|
||||
name: "LLM Gateway",
|
||||
modelsDir: "providers/llmgateway/models",
|
||||
async fetchModels() {
|
||||
return fetchLLMGatewayModels(API_ENDPOINT);
|
||||
const headers = process.env.LLMGATEWAY_API_KEY
|
||||
? { Authorization: `Bearer ${process.env.LLMGATEWAY_API_KEY}` }
|
||||
: undefined;
|
||||
const response = await fetch(API_ENDPOINT, { headers });
|
||||
if (!response.ok) {
|
||||
throw new Error(`LLM Gateway request failed: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
return response.json();
|
||||
},
|
||||
parseModels(raw) {
|
||||
const data = LLMGatewayResponse.parse(raw).data.filter(textOnly);
|
||||
// An empty catalog is an upstream fault; syncing it would delete every
|
||||
// model file, so fail loudly instead.
|
||||
if (data.length === 0) {
|
||||
throw new Error("LLM Gateway returned no text models");
|
||||
}
|
||||
return data;
|
||||
return LLMGatewayResponse.parse(raw).data.filter((model) => {
|
||||
const output = model.architecture.output_modalities;
|
||||
return output.length === 1 && output[0] === "text";
|
||||
});
|
||||
},
|
||||
translateModel(model, context) {
|
||||
const translated = buildLLMGatewayModel(model, context.existing(model.id));
|
||||
if (translated === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return { id: model.id, model: translated };
|
||||
},
|
||||
sourceID(model) {
|
||||
return model.id;
|
||||
},
|
||||
} satisfies SyncProvider<LLMGatewayModel>;
|
||||
|
||||
// Every toggle reasoning control requires a leading wire-path comment, and the
|
||||
// sync runner only carries over headers that already exist on disk. Files this
|
||||
// sync writes with a toggle get the gateway-wide default; a hand-written
|
||||
// header on the existing file always wins.
|
||||
const TOGGLE_HEADER = `# Toggle: $.reasoning_effort = "none" disables thinking; any other accepted
|
||||
# value (or omitting the field) leaves it on. The gateway maps it to the
|
||||
# deployment's thinking switch.
|
||||
# https://docs.llmgateway.io/features/reasoning
|
||||
`;
|
||||
|
||||
function toggleHeader(model: SyncedModel) {
|
||||
return model.reasoning_options?.some((option) => option.type === "toggle")
|
||||
? TOGGLE_HEADER
|
||||
: undefined;
|
||||
}
|
||||
|
||||
// The LLM Gateway provider: one entry per upstream provider mapping, addressed
|
||||
// the way the gateway accepts provider-pinned requests (`provider/model-id`).
|
||||
export const llmgatewayProviders = {
|
||||
id: "llmgateway-providers",
|
||||
name: "LLM Gateway",
|
||||
modelsDir: "providers/llmgateway-providers/models",
|
||||
async fetchModels() {
|
||||
return fetchLLMGatewayModels(`${API_ENDPOINT}?mapped=true`);
|
||||
},
|
||||
parseModels(raw) {
|
||||
const data = LLMGatewayResponse.parse(raw).data;
|
||||
// A deployment without the mapped view ignores the query param and returns
|
||||
// aggregated root IDs (no provider prefix); syncing those here would wipe
|
||||
// the provider-pinned catalog, so refuse to proceed. An empty response (or
|
||||
// one left empty after filtering) would silently do the same via the
|
||||
// delete-missing pass, so it is equally fatal.
|
||||
if (data.length === 0 || !data.every((model) => model.id.includes("/"))) {
|
||||
throw new Error("LLM Gateway mapped view unavailable: response is empty or contains unprefixed model ids");
|
||||
}
|
||||
// llmgateway/custom is the BYO-model placeholder and llmgateway/auto the
|
||||
// auto-router; pinning either to a provider is meaningless in this catalog
|
||||
// (the aggregated llmgateway provider carries `auto`).
|
||||
const mapped = data.filter((model) => !model.id.startsWith("llmgateway/") && textOnly(model));
|
||||
if (mapped.length === 0) {
|
||||
throw new Error("LLM Gateway mapped view returned no text models");
|
||||
}
|
||||
// Every mapped entry is one specific provider deployment whose single
|
||||
// providers[] mapping drives capabilities and reasoning controls. A kept
|
||||
// entry with zero or several mappings would make the builder silently fall
|
||||
// back to noisy supported_parameters / sibling defaults, so fail loudly.
|
||||
const malformed = mapped.filter((model) => model.providers?.length !== 1);
|
||||
if (malformed.length > 0) {
|
||||
throw new Error(
|
||||
`LLM Gateway mapped view returned entries without exactly one provider mapping: ${
|
||||
malformed.map((model) => model.id).join(", ")
|
||||
}`,
|
||||
);
|
||||
}
|
||||
return mapped;
|
||||
},
|
||||
translateModel(model, context) {
|
||||
const translated = buildLLMGatewayMappedModel(model, context.existing(model.id));
|
||||
if (translated === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return { id: model.id, model: translated, header: toggleHeader(translated) };
|
||||
},
|
||||
sourceID(model) {
|
||||
return model.id;
|
||||
return {
|
||||
id: model.id,
|
||||
model: buildLLMGatewayModel(model, context.existing(model.id)),
|
||||
};
|
||||
},
|
||||
} satisfies SyncProvider<LLMGatewayModel>;
|
||||
|
||||
@@ -225,75 +125,12 @@ function modalities(values: string[], fallback: Modality[]): Modality[] {
|
||||
return [...new Set(result.length > 0 ? result : fallback)];
|
||||
}
|
||||
|
||||
// Modalities as served by a specific deployment: a mapping without vision must
|
||||
// not carry image/pdf input, regardless of what the model-level architecture
|
||||
// claims — attachment=false with image input is contradictory.
|
||||
function deploymentModalities(model: LLMGatewayModel, vision: boolean | undefined) {
|
||||
const base = defaultModalities(model);
|
||||
if (vision !== false) {
|
||||
return base;
|
||||
}
|
||||
const input = base.input.filter((value) => value !== "image" && value !== "pdf");
|
||||
return {
|
||||
input: input.length > 0 ? input : (["text"] satisfies Modality[]),
|
||||
output: base.output,
|
||||
};
|
||||
}
|
||||
|
||||
const MODELS_DIR = path.join(import.meta.dirname, "..", "..", "..", "..", "..", "models");
|
||||
const AGGREGATED_MODELS_DIR = path.join(import.meta.dirname, "..", "..", "..", "..", "..", "providers", "llmgateway", "models");
|
||||
const canonicalOutputLimitByID = new Map<string, number | undefined>();
|
||||
|
||||
interface SiblingCuration {
|
||||
reasoning_options?: SyncedFullModel["reasoning_options"];
|
||||
interleaved?: SyncedFullModel["interleaved"];
|
||||
cost_tiers?: NonNullable<SyncedFullModel["cost"]>["tiers"];
|
||||
}
|
||||
|
||||
const siblingCurationByID = new Map<string, SiblingCuration>();
|
||||
|
||||
// The aggregated llmgateway catalog curates reasoning controls, the reasoning
|
||||
// side-channel, and context pricing tiers for the same gateway surface; mapped
|
||||
// deployments of the same root model reuse them when the deployment does not
|
||||
// declare its own.
|
||||
function siblingCuration(rootID: string): SiblingCuration {
|
||||
let curation = siblingCurationByID.get(rootID);
|
||||
if (curation === undefined) {
|
||||
const filePath = path.join(AGGREGATED_MODELS_DIR, `${rootID}.toml`);
|
||||
const authored = existsSync(filePath)
|
||||
? Bun.TOML.parse(readFileSync(filePath, "utf8")) as SiblingCuration & {
|
||||
cost?: { tiers?: NonNullable<SyncedFullModel["cost"]>["tiers"] };
|
||||
}
|
||||
: undefined;
|
||||
curation = {
|
||||
reasoning_options: authored?.reasoning_options?.length ? authored.reasoning_options : undefined,
|
||||
interleaved: authored?.interleaved,
|
||||
cost_tiers: authored?.cost?.tiers,
|
||||
};
|
||||
siblingCurationByID.set(rootID, curation);
|
||||
}
|
||||
return curation;
|
||||
}
|
||||
|
||||
// Whether the canonical metadata declares limit.output; factored entries can
|
||||
// only omit their own output override when the base has one to inherit.
|
||||
function canonicalOutputLimit(modelID: string) {
|
||||
if (!canonicalOutputLimitByID.has(modelID)) {
|
||||
const filePath = path.join(MODELS_DIR, `${modelID}.toml`);
|
||||
const metadata = existsSync(filePath)
|
||||
? Bun.TOML.parse(readFileSync(filePath, "utf8")) as { limit?: { output?: number } }
|
||||
: undefined;
|
||||
canonicalOutputLimitByID.set(modelID, metadata?.limit?.output);
|
||||
}
|
||||
return canonicalOutputLimitByID.get(modelID);
|
||||
}
|
||||
|
||||
function resolveLLMGatewayBaseModel(model: LLMGatewayModel, modelID = model.id) {
|
||||
const alias = BASE_MODEL_ALIASES[modelID];
|
||||
function resolveLLMGatewayBaseModel(model: LLMGatewayModel) {
|
||||
const alias = BASE_MODEL_ALIASES[model.id];
|
||||
if (alias !== undefined) return alias;
|
||||
if (model.family === undefined) return undefined;
|
||||
const prefix = CANONICAL_FAMILY_ALIASES[model.family] ?? model.family;
|
||||
return resolveModelMetadataBaseModel(`${prefix}/${modelID}`);
|
||||
return resolveCanonicalBaseModel(`${prefix}/${model.id}`);
|
||||
}
|
||||
|
||||
function inferFamily(model: LLMGatewayModel, name: string) {
|
||||
@@ -315,19 +152,15 @@ function inferFamily(model: LLMGatewayModel, name: string) {
|
||||
export function buildLLMGatewayModel(
|
||||
model: LLMGatewayModel,
|
||||
existing: ExistingModel | undefined,
|
||||
): SyncedModel | undefined {
|
||||
): SyncedModel {
|
||||
const prompt = price(model.pricing.prompt);
|
||||
const completion = price(model.pricing.completion);
|
||||
const reasoning = model.supported_parameters.includes("reasoning")
|
||||
|| model.supported_parameters.includes("include_reasoning");
|
||||
const reasoningOptions = llmGatewayReasoningOptions(model, existing);
|
||||
const reported = model.context_length ?? 0;
|
||||
// A missing/zero context must never be authored as limit.context = 0:
|
||||
// factored entries leave it unset and inherit the base, and unfactored
|
||||
// creates are skipped entirely. An authored 0 on the existing file is
|
||||
// equally unusable and must not be re-stamped.
|
||||
const servedContext = reported > 0 ? reported : undefined;
|
||||
const context = servedContext ?? (existing?.limit?.context || undefined);
|
||||
const context = model.context_length > 0
|
||||
? model.context_length
|
||||
: existing?.limit?.context ?? model.context_length;
|
||||
|
||||
// The gateway is authoritative for the volatile, gateway-specific data — cost,
|
||||
// served limits, and explicitly advertised reasoning efforts. Its
|
||||
@@ -346,24 +179,15 @@ export function buildLLMGatewayModel(
|
||||
tiers: existing?.cost?.tiers,
|
||||
}
|
||||
: existing?.cost;
|
||||
// Authored limits carry only known-positive values — never the zero/absent
|
||||
// `reported` fallback.
|
||||
const limit = context !== undefined
|
||||
? {
|
||||
context,
|
||||
input: existing?.limit?.input,
|
||||
output: (existing?.limit?.output || undefined) ?? context,
|
||||
}
|
||||
: undefined;
|
||||
const limit = {
|
||||
context,
|
||||
input: existing?.limit?.input,
|
||||
output: existing?.limit?.output ?? context,
|
||||
};
|
||||
|
||||
// Existing factored model: refresh cost + limit, keep every authored override
|
||||
// as-is (undefined fields keep inheriting the base model).
|
||||
if (existing?.base_model !== undefined) {
|
||||
const factoredLimit = {
|
||||
context,
|
||||
input: existing.limit?.input,
|
||||
output: existing.limit?.output ?? context,
|
||||
};
|
||||
return factorBaseModel(
|
||||
existing.base_model,
|
||||
{
|
||||
@@ -376,7 +200,7 @@ export function buildLLMGatewayModel(
|
||||
tool_call: existing.tool_call,
|
||||
structured_output: existing.structured_output,
|
||||
open_weights: existing.open_weights,
|
||||
limit: factoredLimit,
|
||||
limit,
|
||||
modalities: existing.modalities,
|
||||
}),
|
||||
reasoning: existing.reasoning,
|
||||
@@ -388,22 +212,16 @@ export function buildLLMGatewayModel(
|
||||
interleaved: existing.interleaved,
|
||||
knowledge: existing.knowledge,
|
||||
modalities: existing.modalities,
|
||||
limit: factoredLimit,
|
||||
limit,
|
||||
cost,
|
||||
},
|
||||
factoredLimit,
|
||||
limit,
|
||||
existing.base_model_omit,
|
||||
);
|
||||
}
|
||||
|
||||
// Existing full model: refresh cost + limit, preserve curated metadata.
|
||||
if (existing !== undefined) {
|
||||
// With no usable context from the API or the file there is nothing valid
|
||||
// to author, and skipping would hand the file to the delete-missing pass —
|
||||
// fail loudly rather than write limit.context = 0.
|
||||
if (limit === undefined) {
|
||||
throw new Error(`LLM Gateway entry ${model.id} has no usable context to author`);
|
||||
}
|
||||
return {
|
||||
name: existing.name ?? model.name,
|
||||
description: existing.description ?? describeModel({
|
||||
@@ -453,12 +271,7 @@ export function buildLLMGatewayModel(
|
||||
}
|
||||
|
||||
// Brand-new model: best-effort translation from the gateway. Capability and
|
||||
// modality data are unreliable here and should be hand-reviewed. Without a
|
||||
// positive served context there is nothing usable to author, so skip.
|
||||
if (servedContext === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const createdLimit = limit ?? { context: servedContext, input: undefined, output: servedContext };
|
||||
// modality data are unreliable here and should be hand-reviewed.
|
||||
const { input, output } = defaultModalities(model);
|
||||
return {
|
||||
name: model.name,
|
||||
@@ -471,7 +284,7 @@ export function buildLLMGatewayModel(
|
||||
|| model.supported_parameters.includes("tool_choice"),
|
||||
structured_output: model.structured_outputs ?? false,
|
||||
open_weights: false,
|
||||
limit: createdLimit,
|
||||
limit,
|
||||
modalities: { input, output },
|
||||
}),
|
||||
family: inferFamily(model, model.name),
|
||||
@@ -486,261 +299,7 @@ export function buildLLMGatewayModel(
|
||||
structured_output: model.structured_outputs ?? false,
|
||||
open_weights: false,
|
||||
cost,
|
||||
limit: createdLimit,
|
||||
modalities: { input, output },
|
||||
} satisfies SyncedFullModel;
|
||||
}
|
||||
|
||||
export function buildLLMGatewayMappedModel(
|
||||
model: LLMGatewayModel,
|
||||
existing: ExistingModel | undefined,
|
||||
): SyncedModel | undefined {
|
||||
// Mapped entries carry exactly one provider mapping; its capability flags
|
||||
// describe that specific deployment, unlike the aggregated view where
|
||||
// supported_parameters are too noisy to trust.
|
||||
const mapping = model.providers?.[0];
|
||||
const rootID = model.id.split("/").slice(1).join("/");
|
||||
const prompt = price(model.pricing.prompt);
|
||||
const completion = price(model.pricing.completion);
|
||||
// The mapping's flag stays authoritative on resyncs too, so the written
|
||||
// reasoning boolean and the reasoning_options derived from it always move
|
||||
// together; prior curation only fills in when the mapping is silent, then
|
||||
// the noisy supported_parameters signal as a last resort.
|
||||
const reasoning = mapping?.reasoning
|
||||
?? existing?.reasoning
|
||||
?? (model.supported_parameters.includes("reasoning")
|
||||
|| model.supported_parameters.includes("include_reasoning"));
|
||||
// The exact reasoning_effort values this deployment accepts. A deployment
|
||||
// whose only accepted effort is "none" exposes a plain on/off switch (the
|
||||
// gateway honours it through the thinking toggle), not effort tiers.
|
||||
const deploymentOptions = mapping?.reasoning_efforts?.length
|
||||
? mapping.reasoning_efforts.length === 1 && mapping.reasoning_efforts[0] === "none"
|
||||
? [{ type: "toggle" as const }]
|
||||
: [{ type: "effort" as const, values: mapping.reasoning_efforts }]
|
||||
: undefined;
|
||||
// Deployment-declared efforts own the effort/toggle surface; curation falls
|
||||
// back from non-empty options on this file to the aggregated llmgateway
|
||||
// catalog's controls for the same root model on the same gateway surface.
|
||||
// Curated non-effort controls (e.g. budget_tokens for $.reasoning.max_tokens,
|
||||
// which this host serves regardless of the effort list) survive alongside
|
||||
// deployment efforts instead of being wiped by them. A curated [] counts as
|
||||
// unknown so a bad first stamp is not sticky. Non-reasoning deployments
|
||||
// carry none; the same applies to the interleaved reasoning side-channel.
|
||||
const sibling = siblingCuration(rootID);
|
||||
const curatedOptions = (existing?.reasoning_options?.length ? existing.reasoning_options : undefined)
|
||||
?? sibling.reasoning_options;
|
||||
const reasoningOptions = reasoning
|
||||
? deploymentOptions !== undefined
|
||||
? [
|
||||
...(curatedOptions ?? []).filter((option) => option.type !== "effort" && option.type !== "toggle"),
|
||||
...deploymentOptions,
|
||||
]
|
||||
: curatedOptions
|
||||
: undefined;
|
||||
const interleaved = reasoning
|
||||
? existing?.interleaved ?? sibling.interleaved
|
||||
: undefined;
|
||||
const reported = model.context_length ?? 0;
|
||||
// Same zero-context rule as the aggregated builder: never author 0, inherit
|
||||
// on factored entries, skip unfactored creates. An authored 0 on the
|
||||
// existing file is equally unusable.
|
||||
const servedContext = reported > 0 ? reported : undefined;
|
||||
const context = servedContext ?? (existing?.limit?.context || undefined);
|
||||
|
||||
const cost = prompt !== undefined && completion !== undefined
|
||||
? {
|
||||
input: prompt,
|
||||
output: completion,
|
||||
reasoning: reasoning ? nonZeroPrice(model.pricing.internal_reasoning) ?? existing?.cost?.reasoning : existing?.cost?.reasoning,
|
||||
cache_read: nonZeroPrice(model.pricing.input_cache_read) ?? existing?.cost?.cache_read,
|
||||
cache_write: nonZeroPrice(model.pricing.input_cache_write) ?? existing?.cost?.cache_write,
|
||||
// The gateway API does not expose context pricing tiers, so authored
|
||||
// tiers stick and new files seed from the aggregated sibling's curated
|
||||
// tiers rather than silently under-stating long-context pricing.
|
||||
tiers: existing?.cost?.tiers ?? sibling.cost_tiers,
|
||||
}
|
||||
: existing?.cost;
|
||||
// The gateway's max_output is the deployment's real served limit, so it wins
|
||||
// over inherited/authored values, unlike the aggregated view.
|
||||
const servedOutput = (model.max_output || undefined) ?? (existing?.limit?.output || undefined);
|
||||
// Authored limits carry only known-positive values — never the zero/absent
|
||||
// `reported` fallback.
|
||||
const limit = context !== undefined
|
||||
? {
|
||||
context,
|
||||
input: existing?.limit?.input,
|
||||
output: servedOutput ?? context,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
// Existing factored model: refresh cost + limit, keep every authored override
|
||||
// as-is. Unlike the aggregated provider, the name override must be carried
|
||||
// forward: mapped names disambiguate deployments of the same model (e.g.
|
||||
// "GPT-5.5 (Azure)" vs "GPT-5.5 (OpenAI)") and must not collapse back to the
|
||||
// base metadata name.
|
||||
if (existing?.base_model !== undefined) {
|
||||
// Mirror the brand-new factored path: without a served or authored output,
|
||||
// keep inheriting the base's output rather than stamping context over it.
|
||||
const factoredLimit = {
|
||||
context,
|
||||
input: existing.limit?.input,
|
||||
output: servedOutput ?? (canonicalOutputLimit(existing.base_model) !== undefined ? undefined : context),
|
||||
};
|
||||
// Deployment capability flags keep their create-path authority on
|
||||
// resyncs: a mapping that gains or loses reasoning/vision/tools/structured
|
||||
// outputs realigns the written flags together with the reasoning_options
|
||||
// computed from them, instead of freezing stale curation forever.
|
||||
return factorBaseModel(
|
||||
existing.base_model,
|
||||
{
|
||||
name: existing.name ?? model.name,
|
||||
attachment: mapping?.vision ?? existing.attachment,
|
||||
// No describeModel fallback: synthesizing a description here would
|
||||
// stamp a sticky generic override on every name-pinned factored entry;
|
||||
// leaving it unset keeps inheriting the lab text from the base.
|
||||
description: existing.description,
|
||||
reasoning: mapping?.reasoning ?? existing.reasoning,
|
||||
reasoning_options: reasoningOptions,
|
||||
temperature: existing.temperature,
|
||||
tool_call: mapping?.tools ?? existing.tool_call,
|
||||
structured_output: model.structured_outputs ?? existing.structured_output,
|
||||
status: existing.status,
|
||||
interleaved,
|
||||
knowledge: existing.knowledge,
|
||||
// Vision realigns modalities in both directions: false strips
|
||||
// image/pdf, true clears any stale stripped override so the base's
|
||||
// richer inputs inherit again; only a silent mapping keeps curation.
|
||||
modalities: mapping?.vision === undefined
|
||||
? existing.modalities
|
||||
: mapping.vision
|
||||
? undefined
|
||||
: deploymentModalities(model, false),
|
||||
limit: factoredLimit,
|
||||
cost,
|
||||
},
|
||||
factoredLimit,
|
||||
existing.base_model_omit,
|
||||
);
|
||||
}
|
||||
|
||||
// Existing full model: refresh cost + limit, preserve curated metadata.
|
||||
// Capability flags follow the same rule as the factored path above: the
|
||||
// deployment mapping wins, curation fills the gaps.
|
||||
if (existing !== undefined) {
|
||||
// With no usable context from the API or the file there is nothing valid
|
||||
// to author, and skipping would hand the file to the delete-missing pass —
|
||||
// fail loudly rather than write limit.context = 0.
|
||||
if (limit === undefined) {
|
||||
throw new Error(`LLM Gateway mapped entry ${model.id} has no usable context to author`);
|
||||
}
|
||||
const resolved = {
|
||||
attachment: mapping?.vision ?? existing.attachment ?? false,
|
||||
tool_call: mapping?.tools ?? existing.tool_call ?? false,
|
||||
structured_output: model.structured_outputs ?? existing.structured_output,
|
||||
// Same bidirectional vision rule as the factored path; with no base to
|
||||
// inherit from, a declared vision recomputes from the served
|
||||
// architecture instead of clearing.
|
||||
modalities: mapping?.vision === undefined
|
||||
? existing.modalities ?? deploymentModalities(model, undefined)
|
||||
: deploymentModalities(model, mapping.vision),
|
||||
};
|
||||
return {
|
||||
name: existing.name ?? model.name,
|
||||
description: existing.description ?? describeModel({
|
||||
id: model.id,
|
||||
name: existing.name ?? model.name,
|
||||
family: existing.family,
|
||||
reasoning,
|
||||
tool_call: resolved.tool_call,
|
||||
structured_output: resolved.structured_output,
|
||||
open_weights: existing.open_weights,
|
||||
limit,
|
||||
modalities: resolved.modalities,
|
||||
}),
|
||||
family: existing.family,
|
||||
release_date: existing.release_date ?? dateFromTimestamp(model.created),
|
||||
last_updated: existing.last_updated ?? dateFromTimestamp(model.created),
|
||||
attachment: resolved.attachment,
|
||||
reasoning,
|
||||
reasoning_options: reasoningOptions,
|
||||
temperature: existing.temperature ?? false,
|
||||
tool_call: resolved.tool_call,
|
||||
structured_output: resolved.structured_output,
|
||||
knowledge: existing.knowledge,
|
||||
open_weights: existing.open_weights ?? false,
|
||||
status: existing.status,
|
||||
interleaved,
|
||||
cost,
|
||||
limit,
|
||||
modalities: resolved.modalities,
|
||||
} satisfies SyncedFullModel;
|
||||
}
|
||||
|
||||
// Brand-new model with a reviewed metadata entry: factor against the
|
||||
// canonical base. The mapped ID is `serving-provider/model-id` and the
|
||||
// serving provider is unrelated to the originating lab, so resolve the base
|
||||
// from the root model ID + family, and keep the disambiguating name. The
|
||||
// mapping's own capability flags describe this specific deployment, so they
|
||||
// go in as overrides (factorBaseModel drops the ones equal to the base).
|
||||
const canonical = resolveLLMGatewayBaseModel(model, rootID);
|
||||
if (canonical !== undefined) {
|
||||
const factoredLimit = {
|
||||
context,
|
||||
input: undefined,
|
||||
// Without a served limit, inherit the base's output; only fall back to
|
||||
// context when the base declares none (output is required downstream).
|
||||
output: model.max_output ?? (canonicalOutputLimit(canonical) !== undefined ? undefined : context),
|
||||
};
|
||||
return factorBaseModel(canonical, {
|
||||
name: model.name,
|
||||
attachment: mapping?.vision,
|
||||
reasoning: mapping?.reasoning,
|
||||
reasoning_options: reasoningOptions,
|
||||
interleaved,
|
||||
tool_call: mapping?.tools,
|
||||
structured_output: model.structured_outputs,
|
||||
// A deployment without vision must not inherit image/pdf inputs from
|
||||
// the base — attachment=false with image input is contradictory.
|
||||
modalities: mapping?.vision === false ? deploymentModalities(model, false) : undefined,
|
||||
limit: factoredLimit,
|
||||
cost,
|
||||
}, factoredLimit);
|
||||
}
|
||||
|
||||
// Brand-new model without metadata: best-effort translation. The mapping's
|
||||
// own capability flags are reliable here; modalities mirror the mapping too.
|
||||
// Without a positive served context there is nothing usable to author.
|
||||
if (servedContext === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const createdLimit = limit ?? { context: servedContext, input: undefined, output: servedOutput ?? servedContext };
|
||||
const { input, output } = deploymentModalities(model, mapping?.vision);
|
||||
return {
|
||||
name: model.name,
|
||||
description: describeModel({
|
||||
id: model.id,
|
||||
name: model.name,
|
||||
family: inferFamily(model, model.name),
|
||||
reasoning,
|
||||
tool_call: mapping?.tools ?? false,
|
||||
structured_output: model.structured_outputs ?? false,
|
||||
open_weights: false,
|
||||
limit: createdLimit,
|
||||
modalities: { input, output },
|
||||
}),
|
||||
family: inferFamily(model, model.name),
|
||||
release_date: dateFromTimestamp(model.created),
|
||||
last_updated: dateFromTimestamp(model.created),
|
||||
attachment: mapping?.vision ?? input.some((value) => value !== "text"),
|
||||
reasoning,
|
||||
reasoning_options: reasoningOptions,
|
||||
interleaved,
|
||||
temperature: model.supported_parameters.includes("temperature"),
|
||||
tool_call: mapping?.tools ?? false,
|
||||
structured_output: model.structured_outputs ?? false,
|
||||
open_weights: false,
|
||||
cost,
|
||||
limit: createdLimit,
|
||||
limit,
|
||||
modalities: { input, output },
|
||||
} satisfies SyncedFullModel;
|
||||
}
|
||||
@@ -749,7 +308,7 @@ function llmGatewayReasoningOptions(
|
||||
model: LLMGatewayModel,
|
||||
existing: ExistingModel | undefined,
|
||||
): SyncedFullModel["reasoning_options"] {
|
||||
const advertised = new Set((model.providers ?? []).flatMap((provider) => provider.reasoning_efforts ?? []));
|
||||
const advertised = new Set(model.providers.flatMap((provider) => provider.reasoning_efforts ?? []));
|
||||
if (advertised.size === 0) return undefined;
|
||||
|
||||
const efforts = [...advertised].sort((a, b) => {
|
||||
|
||||
@@ -158,14 +158,7 @@ export const mergeGateway = {
|
||||
translateModel(model, context) {
|
||||
const existing = context.existing(model.model);
|
||||
const translated = buildMergeGatewayModel(model, existing, context.authored(model.model));
|
||||
return translated === undefined ? undefined : {
|
||||
id: model.model,
|
||||
model: translated,
|
||||
header: translated.reasoning_options?.some((option) => option.type === "toggle")
|
||||
&& translated.reasoning_options.some((option) => option.type === "budget_tokens")
|
||||
? '# Toggle: thinking.type = "enabled"|"disabled"; enabled requires thinking.budget_tokens.\n# https://docs.merge.dev/merge-gateway/features/reasoning\n'
|
||||
: undefined,
|
||||
};
|
||||
return translated === undefined ? undefined : { id: model.model, model: translated };
|
||||
},
|
||||
} satisfies SyncProvider<MergeGatewayModel>;
|
||||
|
||||
@@ -188,10 +181,6 @@ export function mergeGatewayReasoningOptions(
|
||||
options.push({ type: "effort" as const, values: [...effortValues] });
|
||||
}
|
||||
|
||||
if (controls.includes("thinking.budget_tokens")) {
|
||||
options.push({ type: "budget_tokens" });
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { SyncProvider, SyncedModel } from "../index.js";
|
||||
|
||||
const MODELS_ENDPOINT = "https://dev.meta.ai/docs/models.md";
|
||||
const PRICING_ENDPOINT = "https://dev.meta.ai/docs/pricing-rate-limits.md";
|
||||
|
||||
const MetaResponse = z.object({ models: z.string(), pricing: z.string() });
|
||||
const MetaModel = z.object({
|
||||
id: z.string().regex(/^[a-z0-9][a-z0-9.-]*$/),
|
||||
context: z.number().int().positive().safe(),
|
||||
cost: z.object({
|
||||
input: z.number().finite().nonnegative(),
|
||||
output: z.number().finite().nonnegative(),
|
||||
cache_read: z.number().finite().nonnegative(),
|
||||
}),
|
||||
});
|
||||
|
||||
export type MetaModel = z.infer<typeof MetaModel>;
|
||||
|
||||
function cells(line: string) {
|
||||
return line.trim().split("|").slice(1, -1).map((cell) => cell.trim());
|
||||
}
|
||||
|
||||
function table(markdown: string, header: string[]) {
|
||||
const lines = markdown.split("\n");
|
||||
const start = lines.findIndex((line) => JSON.stringify(cells(line)) === JSON.stringify(header));
|
||||
if (start < 0) throw new Error(`Meta docs are missing the ${header.join(" / ")} table`);
|
||||
const separator = cells(lines[start + 1] ?? "");
|
||||
if (separator.length !== header.length || separator.some((cell) => !/^:?-+:?$/.test(cell))) {
|
||||
throw new Error("Meta docs have an invalid table separator");
|
||||
}
|
||||
const rows: string[][] = [];
|
||||
for (const line of lines.slice(start + 2)) {
|
||||
if (!line.trim().startsWith("|")) break;
|
||||
const row = cells(line);
|
||||
if (row.length !== header.length) throw new Error("Meta docs have an invalid table row");
|
||||
rows.push(row);
|
||||
}
|
||||
if (rows.length === 0) throw new Error("Meta docs table is empty");
|
||||
return rows;
|
||||
}
|
||||
|
||||
function tierCost(markdown: string, tier: string) {
|
||||
const sections = markdown.split(/^### /m).filter((section) => section.split("\n")[0]?.includes(`{#${tier}}`));
|
||||
if (sections.length !== 1) throw new Error(`Meta docs need exactly one pricing section for ${tier}`);
|
||||
const prices = new Map<string, number>();
|
||||
for (const [usage, price] of table(sections[0]!, ["Usage", "Price per 1M tokens"])) {
|
||||
if (!/^\$\d+(?:\.\d+)?$/.test(price!) || prices.has(usage!)) {
|
||||
throw new Error(`Meta docs have invalid or duplicate ${tier} pricing`);
|
||||
}
|
||||
prices.set(usage!, Number(price!.slice(1)));
|
||||
}
|
||||
return {
|
||||
input: prices.get("Input"),
|
||||
output: prices.get("Output"),
|
||||
cache_read: prices.get("Cached input"),
|
||||
};
|
||||
}
|
||||
|
||||
export function parseMetaModels(raw: unknown): MetaModel[] {
|
||||
const response = MetaResponse.parse(raw);
|
||||
const rows = table(response.models, ["Model ID", "Tier", "Input modalities", "Output modalities", "Context window"]);
|
||||
const ids = new Set<string>();
|
||||
return rows.map(([model, tierLink, _input, output, window]) => {
|
||||
const id = model?.match(/^`([^`]+)`$/)?.[1];
|
||||
const tier = tierLink?.match(/^\[[^\]]+\]\([^)]*#([a-z-]+)\)$/)?.[1];
|
||||
const tokens = window?.match(/^(\d+|\d{1,3}(?:,\d{3})+) tokens$/)?.[1];
|
||||
if (id === undefined || tier === undefined || tokens === undefined || output !== "Text") {
|
||||
throw new Error("Meta docs have an unsupported token-priced model row");
|
||||
}
|
||||
if (ids.has(id)) throw new Error(`Meta docs have a duplicate model: ${id}`);
|
||||
ids.add(id);
|
||||
const parsed = MetaModel.safeParse({
|
||||
id,
|
||||
context: Number(tokens.replaceAll(",", "")),
|
||||
cost: tierCost(response.pricing, tier),
|
||||
});
|
||||
if (!parsed.success) {
|
||||
parsed.error.cause = { provider: "meta", model: id };
|
||||
throw parsed.error;
|
||||
}
|
||||
return parsed.data;
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchMetaModels(fetcher: typeof fetch = fetch) {
|
||||
const [models, pricing] = await Promise.all([MODELS_ENDPOINT, PRICING_ENDPOINT].map(async (url) => {
|
||||
const response = await fetcher(url);
|
||||
if (!response.ok) throw new Error(`Meta docs request failed: ${response.status} ${response.statusText}`);
|
||||
return response.text();
|
||||
}));
|
||||
return { models, pricing };
|
||||
}
|
||||
|
||||
export const meta = {
|
||||
id: "meta",
|
||||
name: "Meta",
|
||||
modelsDir: "providers/meta/models",
|
||||
skipCreates: true,
|
||||
deleteMissing: false,
|
||||
sourceID(model) {
|
||||
return model.id;
|
||||
},
|
||||
skippedNotice(ids) {
|
||||
return ids.length === 0 ? [] : [
|
||||
`Meta's public docs list models requiring hand-authored metadata: ${ids.map((id) => `\`${id}\``).join(", ")}`,
|
||||
];
|
||||
},
|
||||
fetchModels: fetchMetaModels,
|
||||
parseModels: parseMetaModels,
|
||||
translateModel(model, context) {
|
||||
const authored = context.authored(model.id);
|
||||
if (authored === undefined) return undefined;
|
||||
// Only the documented token rates and context window are authoritative.
|
||||
// Keep output limits, modalities, reasoning controls, dates, and base_model.
|
||||
const limit = context.existing(model.id)?.limit?.context === model.context
|
||||
? authored.limit
|
||||
: { ...authored.limit, context: model.context };
|
||||
return {
|
||||
id: model.id,
|
||||
model: { ...authored, limit, cost: { ...authored.cost, ...model.cost } } as SyncedModel,
|
||||
};
|
||||
},
|
||||
} satisfies SyncProvider<MetaModel>;
|
||||
@@ -44,7 +44,6 @@ const CANONICAL_PROVIDER_PREFIXES = {
|
||||
thinkingmachines: { provider: "thinkingmachines", metadata: "thinkingmachines" },
|
||||
"x-ai": { provider: "xai", metadata: "xai" },
|
||||
xai: { provider: "xai", metadata: "xai" },
|
||||
spacexai: { provider: "xai", metadata: "xai" },
|
||||
xiaomi: { provider: "xiaomi", metadata: "xiaomi" },
|
||||
zai: { provider: "zai", metadata: "zhipuai" },
|
||||
"z-ai": { provider: "zai", metadata: "zhipuai" },
|
||||
@@ -128,13 +127,9 @@ export const openrouter = {
|
||||
const authored = context.authored(model.id);
|
||||
return authored === undefined ? undefined : { id: model.id, model: authored as SyncedModel };
|
||||
}
|
||||
const translated = buildOpenRouterModel(model, context.existing(model.id));
|
||||
return {
|
||||
id: model.id,
|
||||
model: translated,
|
||||
header: translated.reasoning_options?.some((option) => option.type === "toggle")
|
||||
? "# Toggle: reasoning.enabled = true|false\n# https://openrouter.ai/docs/guides/best-practices/reasoning-tokens\n"
|
||||
: undefined,
|
||||
model: buildOpenRouterModel(model, context.existing(model.id)),
|
||||
};
|
||||
},
|
||||
} satisfies SyncProvider<OpenRouterModel>;
|
||||
@@ -219,9 +214,8 @@ export function buildOpenRouterModel(
|
||||
// Prefer OpenRouter's live reasoning metadata over authored options so aliases
|
||||
// and rotated models pick up new efforts/budget support. Fall back to authored
|
||||
// only when the API omits a reasoning object.
|
||||
const reasoning_options = reasoning
|
||||
? openRouterReasoningOptions(model.reasoning) ?? existing?.reasoning_options
|
||||
: undefined;
|
||||
const reasoning_options = openRouterReasoningOptions(model.reasoning)
|
||||
?? (reasoning ? existing?.reasoning_options : undefined);
|
||||
const context = model.context_length;
|
||||
const family = inferFamily(model, name);
|
||||
const releaseDate = dateFromTimestamp(model.created);
|
||||
@@ -326,11 +320,10 @@ function openRouterReasoningOptions(reasoning: OpenRouterModel["reasoning"]): Sy
|
||||
? ["max", "xhigh", "high", "medium", "low", "minimal", "none"] as const
|
||||
: reasoning.supported_efforts;
|
||||
|
||||
if (!reasoning.mandatory && !efforts?.includes("none")) {
|
||||
options.push({ type: "toggle" });
|
||||
}
|
||||
|
||||
if (efforts !== undefined) {
|
||||
if (!reasoning.mandatory && !efforts.includes("none")) {
|
||||
options.push({ type: "toggle" });
|
||||
}
|
||||
options.push({
|
||||
type: "effort",
|
||||
values: reasoning.mandatory ? efforts.filter((value) => value !== "none") : [...efforts],
|
||||
@@ -569,7 +562,7 @@ function canonicalCandidates(provider: string, modelID: string) {
|
||||
|
||||
if (provider === "anthropic") {
|
||||
for (const candidate of [...candidates]) {
|
||||
candidates.push(candidate.replace(/(claude-[a-z]+-\d+)\.(\d+)/, "$1-$2"));
|
||||
candidates.push(candidate.replace(/(claude-(?:opus|sonnet|haiku)-\d+)\.(\d+)/, "$1-$2"));
|
||||
candidates.push(candidate.replace(/^claude-3\.5-/, "claude-3-5-"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,12 +103,15 @@ export function buildOvhcloudModel(
|
||||
const outputCost = price(model.pricing?.completion);
|
||||
const cacheRead = price(model.pricing?.input_cache_reads);
|
||||
const cacheWrite = price(model.pricing?.input_cache_writes);
|
||||
const cost = {
|
||||
input: inputCost ?? 0,
|
||||
output: outputCost ?? 0,
|
||||
cache_read: cacheRead !== undefined && cacheRead > 0 ? cacheRead : undefined,
|
||||
cache_write: cacheWrite !== undefined && cacheWrite > 0 ? cacheWrite : undefined,
|
||||
};
|
||||
const cost =
|
||||
(inputCost ?? 0) > 0 || (outputCost ?? 0) > 0
|
||||
? {
|
||||
input: inputCost ?? 0,
|
||||
output: outputCost ?? 0,
|
||||
cache_read: cacheRead !== undefined && cacheRead > 0 ? cacheRead : undefined,
|
||||
cache_write: cacheWrite !== undefined && cacheWrite > 0 ? cacheWrite : undefined,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
base_model: existing?.base_model,
|
||||
|
||||
@@ -133,9 +133,6 @@ export function resolveRequestyBaseModel(id: string) {
|
||||
const bare = id.replace(REGION_SUFFIX, "");
|
||||
return (
|
||||
resolveModelMetadataBaseModel(bare) ??
|
||||
(bare.startsWith("claude-")
|
||||
? resolveModelMetadataBaseModel(`anthropic/${bare}`)
|
||||
: undefined) ??
|
||||
(ANTHROPIC_DOT_ZERO.test(bare)
|
||||
? resolveModelMetadataBaseModel(`${bare}-0`)
|
||||
: undefined)
|
||||
|
||||
@@ -88,9 +88,6 @@ export function buildTinfoilModel(
|
||||
if (existing.cost === undefined || existing.limit?.context === undefined) {
|
||||
throw new Error(`Tinfoil model ${model.id} has incomplete local pricing or limits required for sync`);
|
||||
}
|
||||
if (model.reasoning && existing.reasoning_options === undefined) {
|
||||
throw new Error(`Tinfoil model ${model.id} requires hand-authored reasoning_options; the catalog exposes no reasoning controls`);
|
||||
}
|
||||
|
||||
const { base_model: baseModel, base_model_omit: baseModelOmit, ...current } = existing;
|
||||
const cost = {
|
||||
@@ -105,8 +102,6 @@ export function buildTinfoilModel(
|
||||
};
|
||||
const values = {
|
||||
...current,
|
||||
reasoning: model.reasoning,
|
||||
reasoning_options: model.reasoning ? existing.reasoning_options : undefined,
|
||||
cost,
|
||||
limit,
|
||||
} as SyncedFullModel;
|
||||
|
||||
@@ -70,15 +70,13 @@ export const vercel = {
|
||||
},
|
||||
translateModel(model, context) {
|
||||
const existing = context.existing(model.id);
|
||||
const routeBase = freeRouteBase(model.id);
|
||||
const baseModel = existing?.base_model ?? resolveVercelBaseModel(model.id);
|
||||
const inherited = routeBase === undefined ? undefined : context.existing(routeBase);
|
||||
const baseModel = existing?.base_model ?? resolveCanonicalBaseModel(model.id);
|
||||
return {
|
||||
id: model.id,
|
||||
model: buildVercelModel(
|
||||
model,
|
||||
existing,
|
||||
inherited ?? (baseModel === undefined || baseModel === model.id ? undefined : context.existing(baseModel)),
|
||||
baseModel === undefined || baseModel === model.id ? undefined : context.existing(baseModel),
|
||||
),
|
||||
};
|
||||
},
|
||||
@@ -145,9 +143,7 @@ export function buildVercelModel(
|
||||
last_updated: existing?.last_updated ?? releaseDate,
|
||||
attachment: existing?.attachment ?? (tags.has("vision") || tags.has("file-input")),
|
||||
reasoning: existing?.reasoning ?? tags.has("reasoning"),
|
||||
reasoning_options: existing?.reasoning_options?.length
|
||||
? existing.reasoning_options
|
||||
: base?.reasoning_options,
|
||||
reasoning_options: existing?.reasoning_options ?? base?.reasoning_options,
|
||||
temperature: existing?.temperature,
|
||||
tool_call: model.type === "language"
|
||||
? existing?.tool_call ?? tags.has("tool-use")
|
||||
@@ -182,7 +178,7 @@ export function buildVercelModel(
|
||||
},
|
||||
};
|
||||
|
||||
const baseModel = existing?.base_model ?? resolveVercelBaseModel(model.id);
|
||||
const baseModel = existing?.base_model ?? resolveCanonicalBaseModel(model.id);
|
||||
if (baseModel === undefined) return synced;
|
||||
|
||||
return factorBaseModel(baseModel, {
|
||||
@@ -203,16 +199,6 @@ export function buildVercelModel(
|
||||
}, synced.limit, existing?.base_model_omit);
|
||||
}
|
||||
|
||||
function resolveVercelBaseModel(modelID: string) {
|
||||
const routeBase = freeRouteBase(modelID);
|
||||
return resolveCanonicalBaseModel(modelID)
|
||||
?? (routeBase === undefined ? undefined : resolveCanonicalBaseModel(routeBase));
|
||||
}
|
||||
|
||||
function freeRouteBase(modelID: string) {
|
||||
return modelID.endsWith("-free") ? modelID.slice(0, -"-free".length) : undefined;
|
||||
}
|
||||
|
||||
function dateFromTimestamp(timestamp: number) {
|
||||
return new Date(timestamp * 1000).toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
@@ -31,18 +31,6 @@ test("requires manual review for bulk additions", async () => {
|
||||
expect(decision.reasons).toContain("11 models created (limit 10)");
|
||||
});
|
||||
|
||||
test("requires manual review for Cloudflare AI Gateway deletions", async () => {
|
||||
const decision = await classifyAutoMerge([
|
||||
{
|
||||
status: "deleted",
|
||||
path: "providers/cloudflare-ai-gateway/models/openai/gpt-4.1.toml",
|
||||
},
|
||||
]);
|
||||
|
||||
expect(decision.safe).toBe(false);
|
||||
expect(decision.reasons).toContain("Cloudflare AI Gateway model deletions require manual review");
|
||||
});
|
||||
|
||||
test("requires manual review for added reasoning provider models", async () => {
|
||||
const withoutOptions = await classifyAutoMerge(
|
||||
[{ status: "created", path: "providers/test/models/reasoner.toml" }],
|
||||
@@ -94,7 +82,7 @@ test("does not inspect deleted models", async () => {
|
||||
});
|
||||
|
||||
test("allows reviewed providers with explicit reasoning options", async () => {
|
||||
for (const provider of ["crossmodel", "edenai", "empiriolabs", "hyper", "kilo", "llmgateway", "llmgateway-providers", "merge-gateway", "nano-gpt", "openrouter", "venice"]) {
|
||||
for (const provider of ["edenai", "empiriolabs", "hyper", "kilo", "llmgateway", "merge-gateway", "nano-gpt", "openrouter", "venice"]) {
|
||||
const decision = await classifyAutoMerge(
|
||||
[{ status: "updated", path: `providers/${provider}/models/reasoner.toml` }],
|
||||
async () => fullModel(true, 'reasoning_options = [{ type = "toggle" }]'),
|
||||
|
||||
@@ -1,433 +0,0 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import { syncProvider } from "../src/sync/index.js";
|
||||
import {
|
||||
buildCloudflareAiGatewayModel,
|
||||
cloudflareAiGateway,
|
||||
deriveReasoningOptions,
|
||||
} from "../src/sync/providers/cloudflare-ai-gateway.js";
|
||||
|
||||
test("builds Cloudflare AI Gateway overrides from catalog metadata", () => {
|
||||
const model = buildCloudflareAiGatewayModel(
|
||||
{
|
||||
model_id: "openai/gpt-5.4",
|
||||
task: "Text Generation",
|
||||
context_length: 1_050_000,
|
||||
pricing: {
|
||||
"Input <= 200k (per 1M)": 2.5,
|
||||
"Input > 200k (per 1M)": 5,
|
||||
"Output tokens (per 1M)": 15,
|
||||
"Cached input tokens (per 1M)": 0.25,
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
{
|
||||
reasoning_options: [{ type: "effort", values: ["none", "low", "medium", "high", "xhigh"] }],
|
||||
},
|
||||
);
|
||||
|
||||
expect(model).toEqual({
|
||||
base_model: "openai/gpt-5.4",
|
||||
reasoning_options: [{ type: "effort", values: ["none", "low", "medium", "high", "xhigh"] }],
|
||||
cost: { input: 2.5, output: 15, cache_read: 0.25 },
|
||||
limit: { context: 1_050_000 },
|
||||
provider: { npm: "@ai-sdk/openai" },
|
||||
});
|
||||
});
|
||||
|
||||
test("derives nested Cloudflare reasoning controls", () => {
|
||||
expect(deriveReasoningOptions({
|
||||
properties: {
|
||||
thinking: { type: "boolean" },
|
||||
reasoning: {
|
||||
properties: {
|
||||
effort: {
|
||||
anyOf: [{ enum: ["low", "medium", "high"] }],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})).toEqual([
|
||||
{ type: "toggle" },
|
||||
{ type: "effort", values: ["low", "medium", "high"] },
|
||||
]);
|
||||
});
|
||||
|
||||
test("ignores advertised reasoning controls for non-reasoning base models", () => {
|
||||
const model = buildCloudflareAiGatewayModel(
|
||||
{
|
||||
model_id: "openai/gpt-4.1",
|
||||
task: "Text Generation",
|
||||
context_length: 1_047_576,
|
||||
pricing: {
|
||||
"Input tokens (per 1M)": 2,
|
||||
"Output tokens (per 1M)": 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
properties: {
|
||||
reasoning_effort: { enum: ["low", "medium", "high"] },
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(model.reasoning_options).toBeUndefined();
|
||||
});
|
||||
|
||||
test("fails closed on unknown pricing fields", () => {
|
||||
expect(() => buildCloudflareAiGatewayModel({
|
||||
model_id: "openai/gpt-4.1",
|
||||
task: "Text Generation",
|
||||
context_length: 1_047_576,
|
||||
pricing: {
|
||||
"Input tokens (per 1M)": 2,
|
||||
"Output tokens (per 1M)": 8,
|
||||
"New billing unit": 1,
|
||||
},
|
||||
}, undefined)).toThrow('unmapped pricing key "New billing unit"');
|
||||
});
|
||||
|
||||
test("fails closed when Cloudflare pagination is incomplete", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalToken = process.env.CLOUDFLARE_API_TOKEN;
|
||||
const originalAccount = process.env.CLOUDFLARE_ACCOUNT_ID;
|
||||
process.env.CLOUDFLARE_API_TOKEN = "test";
|
||||
process.env.CLOUDFLARE_ACCOUNT_ID = "test";
|
||||
let page = 0;
|
||||
globalThis.fetch = async () => new Response(JSON.stringify(catalogPage(
|
||||
page++ === 0
|
||||
? [{
|
||||
model_id: "openai/gpt-4.1",
|
||||
task: "Text Generation",
|
||||
context_length: 1_047_576,
|
||||
pricing: {
|
||||
"Input tokens (per 1M)": 2,
|
||||
"Output tokens (per 1M)": 8,
|
||||
},
|
||||
}]
|
||||
: [],
|
||||
{ page, total_count: 2 },
|
||||
)));
|
||||
|
||||
try {
|
||||
await expect(cloudflareAiGateway.fetchModels()).rejects.toThrow("pagination ended at 1/2");
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
restoreEnv("CLOUDFLARE_API_TOKEN", originalToken);
|
||||
restoreEnv("CLOUDFLARE_ACCOUNT_ID", originalAccount);
|
||||
}
|
||||
});
|
||||
|
||||
test("rejects unsafe catalog model paths", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalToken = process.env.CLOUDFLARE_API_TOKEN;
|
||||
const originalAccount = process.env.CLOUDFLARE_ACCOUNT_ID;
|
||||
process.env.CLOUDFLARE_API_TOKEN = "test";
|
||||
process.env.CLOUDFLARE_ACCOUNT_ID = "test";
|
||||
globalThis.fetch = async () => new Response(JSON.stringify(catalogPage([{
|
||||
model_id: "../providers/openai/models/gpt-4.1",
|
||||
task: "Text Generation",
|
||||
context_length: 1_047_576,
|
||||
pricing: {
|
||||
"Input tokens (per 1M)": 2,
|
||||
"Output tokens (per 1M)": 8,
|
||||
},
|
||||
}])));
|
||||
|
||||
try {
|
||||
await expect(cloudflareAiGateway.fetchModels()).rejects.toThrow("safe relative provider/model path");
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
restoreEnv("CLOUDFLARE_API_TOKEN", originalToken);
|
||||
restoreEnv("CLOUDFLARE_ACCOUNT_ID", originalAccount);
|
||||
}
|
||||
});
|
||||
|
||||
test("rejects a catalog with no eligible proxied models", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalToken = process.env.CLOUDFLARE_API_TOKEN;
|
||||
const originalAccount = process.env.CLOUDFLARE_ACCOUNT_ID;
|
||||
process.env.CLOUDFLARE_API_TOKEN = "test";
|
||||
process.env.CLOUDFLARE_ACCOUNT_ID = "test";
|
||||
globalThis.fetch = async () => new Response(JSON.stringify(catalogPage([{
|
||||
model_id: "@cf/meta/llama-3.1-8b-instruct",
|
||||
task: "Text Generation",
|
||||
}])));
|
||||
|
||||
try {
|
||||
await expect(cloudflareAiGateway.fetchModels()).rejects.toThrow("no eligible proxied models");
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
restoreEnv("CLOUDFLARE_API_TOKEN", originalToken);
|
||||
restoreEnv("CLOUDFLARE_ACCOUNT_ID", originalAccount);
|
||||
}
|
||||
});
|
||||
|
||||
test("validates Cloudflare page metadata", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalToken = process.env.CLOUDFLARE_API_TOKEN;
|
||||
const originalAccount = process.env.CLOUDFLARE_ACCOUNT_ID;
|
||||
process.env.CLOUDFLARE_API_TOKEN = "test";
|
||||
process.env.CLOUDFLARE_ACCOUNT_ID = "test";
|
||||
globalThis.fetch = async () => new Response(JSON.stringify(catalogPage([], { page: 2, total_count: 0 })));
|
||||
|
||||
try {
|
||||
await expect(cloudflareAiGateway.fetchModels()).rejects.toThrow("expected page 1, got 2");
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
restoreEnv("CLOUDFLARE_API_TOKEN", originalToken);
|
||||
restoreEnv("CLOUDFLARE_ACCOUNT_ID", originalAccount);
|
||||
}
|
||||
});
|
||||
|
||||
test("retries transient Cloudflare responses", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalToken = process.env.CLOUDFLARE_API_TOKEN;
|
||||
const originalAccount = process.env.CLOUDFLARE_ACCOUNT_ID;
|
||||
process.env.CLOUDFLARE_API_TOKEN = "test";
|
||||
process.env.CLOUDFLARE_ACCOUNT_ID = "test";
|
||||
let catalogRequests = 0;
|
||||
globalThis.fetch = async (input) => {
|
||||
if (String(input).endsWith("/schema")) return new Response(null, { status: 404 });
|
||||
catalogRequests++;
|
||||
if (catalogRequests === 1) return new Response(null, { status: 503, headers: { "retry-after": "0" } });
|
||||
return new Response(JSON.stringify(catalogPage([{
|
||||
model_id: "openai/gpt-4.1",
|
||||
task: "Text Generation",
|
||||
context_length: 1_047_576,
|
||||
pricing: {
|
||||
"Input tokens (per 1M)": 2,
|
||||
"Output tokens (per 1M)": 8,
|
||||
},
|
||||
}])));
|
||||
};
|
||||
|
||||
try {
|
||||
expect(await cloudflareAiGateway.fetchModels()).toHaveLength(1);
|
||||
expect(catalogRequests).toBe(2);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
restoreEnv("CLOUDFLARE_API_TOKEN", originalToken);
|
||||
restoreEnv("CLOUDFLARE_ACCOUNT_ID", originalAccount);
|
||||
}
|
||||
});
|
||||
|
||||
test("replaces a stale generated base-model mapping", async () => {
|
||||
const providersDir = path.join(import.meta.dirname, "..", "..", "..", "providers");
|
||||
const providerDir = await mkdtemp(path.join(providersDir, ".base-model-sync-"));
|
||||
const modelsDir = path.join(providerDir, "models");
|
||||
await mkdir(modelsDir);
|
||||
const file = path.join(modelsDir, "model.toml");
|
||||
await writeFile(file, 'base_model = "anthropic/claude-opus-4-6"\n');
|
||||
|
||||
try {
|
||||
const provider = {
|
||||
id: "base-model-test",
|
||||
name: "Base-model test",
|
||||
modelsDir,
|
||||
async fetchModels() {
|
||||
return [{ id: "model" }];
|
||||
},
|
||||
parseModels(raw: unknown) {
|
||||
return raw as Array<{ id: string }>;
|
||||
},
|
||||
translateModel(model: { id: string }) {
|
||||
return { id: model.id, model: { base_model: "openai/gpt-4.1" } };
|
||||
},
|
||||
};
|
||||
await syncProvider(provider);
|
||||
expect(await readFile(file, "utf8")).toContain('base_model = "openai/gpt-4.1"');
|
||||
} finally {
|
||||
await rm(providerDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("reconciles authoritative generated headers", async () => {
|
||||
const providersDir = path.join(import.meta.dirname, "..", "..", "..", "providers");
|
||||
const providerDir = await mkdtemp(path.join(providersDir, ".cloudflare-ai-gateway-sync-"));
|
||||
const modelsDir = path.join(providerDir, "models");
|
||||
await mkdir(modelsDir);
|
||||
const file = path.join(modelsDir, "gpt-4.1.toml");
|
||||
await writeFile(file, "# Old note\n\nbase_model = \"openai/gpt-4.1\"\n");
|
||||
|
||||
try {
|
||||
const provider = {
|
||||
id: "cloudflare-ai-gateway-test",
|
||||
name: "Cloudflare AI Gateway test",
|
||||
modelsDir,
|
||||
authoritativeHeaders: true,
|
||||
async fetchModels() {
|
||||
return [{ id: "gpt-4.1" }];
|
||||
},
|
||||
parseModels() {
|
||||
return [{ id: "gpt-4.1" }];
|
||||
},
|
||||
translateModel(model) {
|
||||
return {
|
||||
id: model.id,
|
||||
model: { base_model: "openai/gpt-4.1" },
|
||||
header: "# New note\n\n",
|
||||
};
|
||||
},
|
||||
};
|
||||
const result = await syncProvider(provider);
|
||||
|
||||
expect(result.updated).toBe(1);
|
||||
expect(await readFile(file, "utf8")).toStartWith("# New note\nbase_model");
|
||||
expect((await syncProvider(provider)).updated).toBe(0);
|
||||
} finally {
|
||||
await rm(providerDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("refuses to write through a symlinked model directory", async () => {
|
||||
const providersDir = path.join(import.meta.dirname, "..", "..", "..", "providers");
|
||||
const providerDir = await mkdtemp(path.join(providersDir, ".sync-symlink-"));
|
||||
const outsideDir = await mkdtemp(path.join(providersDir, ".sync-outside-"));
|
||||
const modelsDir = path.join(providerDir, "models");
|
||||
await mkdir(modelsDir);
|
||||
await symlink(outsideDir, path.join(modelsDir, "linked"));
|
||||
|
||||
try {
|
||||
const provider = {
|
||||
id: "symlink-test",
|
||||
name: "Symlink test",
|
||||
modelsDir,
|
||||
async fetchModels() {
|
||||
return [{ id: "linked/model" }];
|
||||
},
|
||||
parseModels(raw: unknown) {
|
||||
return raw as Array<{ id: string }>;
|
||||
},
|
||||
translateModel(model: { id: string }) {
|
||||
return { id: model.id, model: { base_model: "openai/gpt-4.1" } };
|
||||
},
|
||||
};
|
||||
await expect(syncProvider(provider)).rejects.toThrow("Refusing to sync through symlink");
|
||||
expect(await Bun.file(path.join(outsideDir, "model.toml")).exists()).toBe(false);
|
||||
} finally {
|
||||
await rm(providerDir, { recursive: true, force: true });
|
||||
await rm(outsideDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("refuses a symlinked models root", async () => {
|
||||
const providersDir = path.join(import.meta.dirname, "..", "..", "..", "providers");
|
||||
const providerDir = await mkdtemp(path.join(providersDir, ".sync-root-"));
|
||||
const outsideDir = await mkdtemp(path.join(providersDir, ".sync-root-outside-"));
|
||||
const modelsDir = path.join(providerDir, "models");
|
||||
await symlink(outsideDir, modelsDir);
|
||||
|
||||
try {
|
||||
const provider = testSyncProvider(modelsDir, "model");
|
||||
await expect(syncProvider(provider)).rejects.toThrow("Refusing to sync through symlink");
|
||||
expect(await Bun.file(path.join(outsideDir, "model.toml")).exists()).toBe(false);
|
||||
} finally {
|
||||
await rm(providerDir, { recursive: true, force: true });
|
||||
await rm(outsideDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("refuses a symlinked metadata file", async () => {
|
||||
const providersDir = path.join(import.meta.dirname, "..", "..", "..", "providers");
|
||||
const providerDir = await mkdtemp(path.join(providersDir, ".sync-metadata-"));
|
||||
const outsideDir = await mkdtemp(path.join(providersDir, ".sync-metadata-outside-"));
|
||||
const modelsDir = path.join(providerDir, "models");
|
||||
const namespace = `sync-symlink-${path.basename(providerDir).replaceAll(/[^a-z0-9-]/g, "")}`;
|
||||
const metadataDir = path.join(providersDir, "..", "models", namespace);
|
||||
const outsideFile = path.join(outsideDir, "model.toml");
|
||||
await mkdir(modelsDir);
|
||||
await mkdir(metadataDir);
|
||||
await writeFile(outsideFile, "sentinel\n");
|
||||
await symlink(outsideFile, path.join(metadataDir, "model.toml"));
|
||||
|
||||
try {
|
||||
const provider = {
|
||||
...testSyncProvider(modelsDir, "provider-model"),
|
||||
metadataNamespace: namespace,
|
||||
translateModel(model: { id: string }) {
|
||||
return {
|
||||
id: model.id,
|
||||
model: {
|
||||
name: "Provider symlink test",
|
||||
description: "Provider model used to test safe sync paths",
|
||||
release_date: "2026-01-01",
|
||||
last_updated: "2026-01-01",
|
||||
attachment: false,
|
||||
reasoning: false,
|
||||
tool_call: false,
|
||||
open_weights: false,
|
||||
modalities: { input: ["text"], output: ["text"] },
|
||||
limit: { context: 1_000, output: 100 },
|
||||
cost: { input: 1, output: 2 },
|
||||
},
|
||||
metadata: {
|
||||
id: `${namespace}/model`,
|
||||
model: {
|
||||
name: "Symlink test",
|
||||
description: "Metadata used to test safe sync paths",
|
||||
release_date: "2026-01-01",
|
||||
last_updated: "2026-01-01",
|
||||
attachment: false,
|
||||
reasoning: false,
|
||||
tool_call: false,
|
||||
open_weights: false,
|
||||
modalities: { input: ["text"], output: ["text"] },
|
||||
limit: { context: 1_000, output: 100 },
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
await expect(syncProvider(provider)).rejects.toThrow("Refusing to sync through symlink");
|
||||
expect(await readFile(outsideFile, "utf8")).toBe("sentinel\n");
|
||||
} finally {
|
||||
await rm(providerDir, { recursive: true, force: true });
|
||||
await rm(outsideDir, { recursive: true, force: true });
|
||||
await rm(metadataDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
function testSyncProvider(modelsDir: string, id: string) {
|
||||
return {
|
||||
id: "symlink-test",
|
||||
name: "Symlink test",
|
||||
modelsDir,
|
||||
async fetchModels() {
|
||||
return [{ id }];
|
||||
},
|
||||
parseModels(raw: unknown) {
|
||||
return raw as Array<{ id: string }>;
|
||||
},
|
||||
translateModel(model: { id: string }) {
|
||||
return { id: model.id, model: { base_model: "openai/gpt-4.1" } };
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function catalogPage(
|
||||
result: Array<Record<string, unknown>>,
|
||||
resultInfo: Partial<{ page: number; per_page: number; total_count: number; total_pages: number }> = {},
|
||||
) {
|
||||
const page = resultInfo.page ?? 1;
|
||||
const perPage = resultInfo.per_page ?? 50;
|
||||
const totalCount = resultInfo.total_count ?? result.length;
|
||||
return {
|
||||
success: true,
|
||||
result,
|
||||
result_info: {
|
||||
page,
|
||||
per_page: perPage,
|
||||
count: result.length,
|
||||
total_count: totalCount,
|
||||
total_pages: resultInfo.total_pages ?? Math.max(1, Math.ceil(totalCount / perPage)),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function restoreEnv(name: string, value: string | undefined) {
|
||||
if (value === undefined) delete process.env[name];
|
||||
else process.env[name] = value;
|
||||
}
|
||||
@@ -1,51 +1,6 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { buildEmpiriolabsModel, resolveEmpiriolabsBaseModel } from "../src/sync/providers/empiriolabs.js";
|
||||
|
||||
test.each([
|
||||
{
|
||||
name: "toggle-only",
|
||||
parameters: [{ name: "enable_thinking" }],
|
||||
expected: [{ type: "toggle" }],
|
||||
},
|
||||
{
|
||||
name: "toggle and effort without none",
|
||||
parameters: [
|
||||
{ name: "enable_thinking" },
|
||||
{ name: "reasoning_effort", options: ["low", "high"] },
|
||||
],
|
||||
expected: [{ type: "toggle" }, { type: "effort", values: ["low", "high"] }],
|
||||
},
|
||||
{
|
||||
name: "effort with none instead of a redundant toggle",
|
||||
parameters: [
|
||||
{ name: "enable_thinking" },
|
||||
{ name: "reasoning_effort", options: ["none", "low", "high"] },
|
||||
],
|
||||
expected: [{ type: "effort", values: ["none", "low", "high"] }],
|
||||
},
|
||||
{
|
||||
name: "effort with none preserves the reasoning budget",
|
||||
parameters: [
|
||||
{ name: "enable_thinking" },
|
||||
{ name: "reasoning_effort", options: ["none", "low", "high"] },
|
||||
{ name: "thinking_budget", min: 1_024, max: 32_768 },
|
||||
],
|
||||
expected: [
|
||||
{ type: "effort", values: ["none", "low", "high"] },
|
||||
{ type: "budget_tokens", min: 1_024, max: 32_768 },
|
||||
],
|
||||
},
|
||||
])("syncs EmpirioLabs reasoning controls: $name", ({ parameters, expected }) => {
|
||||
const model = buildEmpiriolabsModel({
|
||||
id: "qwen3-5-9b",
|
||||
context_length: 262_144,
|
||||
capabilities: { reasoning: true },
|
||||
supported_parameters: parameters,
|
||||
}, undefined);
|
||||
|
||||
expect(model?.reasoning_options).toEqual(expected);
|
||||
});
|
||||
import { resolveEmpiriolabsBaseModel } from "../src/sync/providers/empiriolabs.js";
|
||||
|
||||
test("resolves existing lab metadata without a hardcoded map", () => {
|
||||
expect(resolveEmpiriolabsBaseModel("muse-glimmer-30b")).toBe("meta/muse-glimmer-30b");
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import {
|
||||
buildGitHubCopilotCost,
|
||||
githubCopilotModelSlug,
|
||||
githubCopilot,
|
||||
parseGitHubCopilotPricing,
|
||||
type GitHubCopilotPricingRow,
|
||||
} from "../src/sync/providers/github-copilot.js";
|
||||
import type { ExistingModel } from "../src/sync/index.js";
|
||||
|
||||
function row(overrides: Partial<GitHubCopilotPricingRow>): GitHubCopilotPricingRow {
|
||||
return {
|
||||
model: "GPT-5.6 Terra",
|
||||
provider: "openai",
|
||||
release_status: "GA",
|
||||
category: "Versatile",
|
||||
input: "$2.00",
|
||||
cached_input: "$0.20",
|
||||
output: "$12.00",
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
test("slugifies display names into catalog filenames", () => {
|
||||
expect(githubCopilotModelSlug("GPT-5.6 Sol[^gpt-56-sol-promo]")).toBe("gpt-5.6-sol");
|
||||
expect(githubCopilotModelSlug("GPT-5 mini")).toBe("gpt-5-mini");
|
||||
expect(githubCopilotModelSlug("GPT-5.3-Codex")).toBe("gpt-5.3-codex");
|
||||
expect(githubCopilotModelSlug("Claude Opus 4.8 (fast mode) (preview)")).toBe("claude-opus-4.8-fast-mode-preview");
|
||||
expect(githubCopilotModelSlug("MAI-Code-1.1-Flash")).toBe("mai-code-1.1-flash");
|
||||
expect(githubCopilotModelSlug("Kimi K2.7 Code")).toBe("kimi-k2.7-code");
|
||||
});
|
||||
|
||||
test("groups tier rows under one model", () => {
|
||||
const models = parseGitHubCopilotPricing([
|
||||
row({ threshold: "≤ 272K", tier: "Default" }),
|
||||
row({ threshold: "> 272K", tier: "Long context", input: "$4.00", cached_input: "$0.40", output: "$18.00" }),
|
||||
row({ model: "Claude Sonnet 5", provider: "anthropic", input: "$2.00", output: "$10.00", cache_write: "$2.50" }),
|
||||
]);
|
||||
expect(models.map((model) => model.slug)).toEqual(["gpt-5.6-terra", "claude-sonnet-5"]);
|
||||
expect(models[0]?.rows).toHaveLength(2);
|
||||
});
|
||||
|
||||
test("builds flat cost with cache_write and Not applicable handling", () => {
|
||||
const [model] = parseGitHubCopilotPricing([
|
||||
row({ model: "GPT-5.4 mini", input: "$0.75", cached_input: "$0.075", output: "$4.50", cache_write: "Not applicable" }),
|
||||
]);
|
||||
expect(buildGitHubCopilotCost(model!)).toEqual({
|
||||
input: 0.75,
|
||||
output: 4.5,
|
||||
cache_read: 0.075,
|
||||
cache_write: undefined,
|
||||
tiers: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
test("builds long-context tiers from threshold rows", () => {
|
||||
const [model] = parseGitHubCopilotPricing([
|
||||
row({ threshold: "≤ 272K", tier: "Default", cache_write: "$2.50" }),
|
||||
row({ threshold: "> 272K", tier: "Long context", input: "$4.00", cached_input: "$0.40", output: "$18.00", cache_write: "$5.00" }),
|
||||
]);
|
||||
expect(buildGitHubCopilotCost(model!)).toEqual({
|
||||
input: 2,
|
||||
output: 12,
|
||||
cache_read: 0.2,
|
||||
cache_write: 2.5,
|
||||
tiers: [{
|
||||
tier: { type: "context", size: 272_000 },
|
||||
input: 4,
|
||||
output: 18,
|
||||
cache_read: 0.4,
|
||||
cache_write: 5,
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
||||
test("rejects malformed tables instead of writing garbage", () => {
|
||||
const build = (rows: GitHubCopilotPricingRow[]) => {
|
||||
const models = parseGitHubCopilotPricing(rows);
|
||||
return models.map((model) => buildGitHubCopilotCost(model));
|
||||
};
|
||||
// Unknown tier label.
|
||||
expect(() => build([row({ tier: "Standard" })])).toThrow(/Unknown pricing tier/u);
|
||||
// Two default rows for one model.
|
||||
expect(() => build([row({}), row({})])).toThrow(/exactly one default pricing row/u);
|
||||
// Long-context row without a parseable threshold.
|
||||
expect(() => build([
|
||||
row({ threshold: "≤ 272K", tier: "Default" }),
|
||||
row({ threshold: "272K+", tier: "Long context" }),
|
||||
])).toThrow(/Unparseable long-context threshold/u);
|
||||
// Price strings are schema-validated before translation.
|
||||
expect(() => build([row({ input: "$1,000.00" })])).toThrow();
|
||||
expect(() => build([row({ input: "Included" })])).toThrow();
|
||||
});
|
||||
|
||||
function translationContext(files: Record<string, ExistingModel>) {
|
||||
return {
|
||||
existing: (id: string) => files[id],
|
||||
authored: (id: string) => files[id],
|
||||
};
|
||||
}
|
||||
|
||||
const authoredTerra: ExistingModel = {
|
||||
base_model: "openai/gpt-5.6-terra",
|
||||
cost: { input: 1, output: 1, cache_read: 1 },
|
||||
};
|
||||
|
||||
test("updates cost on the authored file and preserves audio rates", () => {
|
||||
const [model] = parseGitHubCopilotPricing([row({ cache_write: "$2.50" })]);
|
||||
const translated = githubCopilot.translateModel(model!, translationContext({
|
||||
"gpt-5.6-terra": {
|
||||
...authoredTerra,
|
||||
cost: { input: 1, output: 1, reasoning: 3, cache_read: 1, input_audio: 1.5, output_audio: 6 },
|
||||
},
|
||||
}));
|
||||
expect(translated?.id).toBe("gpt-5.6-terra");
|
||||
expect(translated?.model.cost).toMatchObject({
|
||||
input: 2,
|
||||
output: 12,
|
||||
reasoning: 3,
|
||||
cache_read: 0.2,
|
||||
cache_write: 2.5,
|
||||
input_audio: 1.5,
|
||||
output_audio: 6,
|
||||
});
|
||||
expect((translated?.model as ExistingModel).base_model).toBe("openai/gpt-5.6-terra");
|
||||
});
|
||||
|
||||
test("clears authored tiers and cache_write the table no longer lists", () => {
|
||||
const [model] = parseGitHubCopilotPricing([row({ cache_write: "Not applicable" })]);
|
||||
const translated = githubCopilot.translateModel(model!, translationContext({
|
||||
"gpt-5.6-terra": {
|
||||
...authoredTerra,
|
||||
cost: {
|
||||
input: 1,
|
||||
output: 1,
|
||||
cache_read: 1,
|
||||
cache_write: 9,
|
||||
tiers: [{ tier: { type: "context", size: 272_000 }, input: 9, output: 9 }],
|
||||
},
|
||||
},
|
||||
}));
|
||||
const cost = translated?.model.cost;
|
||||
expect(cost?.input).toBe(2);
|
||||
// Stale authored values must not survive the spread; the runner strips the
|
||||
// explicit undefineds before writing.
|
||||
expect(cost?.cache_write).toBeUndefined();
|
||||
expect(cost?.tiers).toBeUndefined();
|
||||
});
|
||||
|
||||
test("resolves preview and alias filenames", () => {
|
||||
const preview = parseGitHubCopilotPricing([
|
||||
row({ model: "Gemini 3.1 Pro", provider: "google", release_status: "Public preview" }),
|
||||
]);
|
||||
expect(githubCopilot.translateModel(preview[0]!, translationContext({
|
||||
"gemini-3.1-pro-preview": authoredTerra,
|
||||
}))?.id).toBe("gemini-3.1-pro-preview");
|
||||
|
||||
const alias = parseGitHubCopilotPricing([row({ model: "MAI-Code-1-Flash", provider: "microsoft" })]);
|
||||
expect(githubCopilot.translateModel(alias[0]!, translationContext({
|
||||
"mai-code-1-flash-picker": authoredTerra,
|
||||
}))?.id).toBe("mai-code-1-flash-picker");
|
||||
|
||||
// An exact slug match wins over both fallbacks.
|
||||
expect(githubCopilot.translateModel(preview[0]!, translationContext({
|
||||
"gemini-3.1-pro": authoredTerra,
|
||||
"gemini-3.1-pro-preview": authoredTerra,
|
||||
}))?.id).toBe("gemini-3.1-pro");
|
||||
expect(githubCopilot.translateModel(alias[0]!, translationContext({
|
||||
"mai-code-1-flash": authoredTerra,
|
||||
"mai-code-1-flash-picker": authoredTerra,
|
||||
}))?.id).toBe("mai-code-1-flash");
|
||||
});
|
||||
|
||||
test("skips ignored rows silently and unmatched rows with an ID", () => {
|
||||
const [fastMode] = parseGitHubCopilotPricing([
|
||||
row({ model: "Claude Opus 4.8 (fast mode) (preview)", provider: "anthropic" }),
|
||||
]);
|
||||
expect(githubCopilot.translateModel(fastMode!, translationContext({}))).toBeUndefined();
|
||||
expect(githubCopilot.sourceID(fastMode!)).toBeUndefined();
|
||||
|
||||
const [unmatched] = parseGitHubCopilotPricing([row({ model: "Brand New Model" })]);
|
||||
expect(githubCopilot.translateModel(unmatched!, translationContext({}))).toBeUndefined();
|
||||
expect(githubCopilot.sourceID(unmatched!)).toBe("brand-new-model");
|
||||
});
|
||||
|
||||
const pricingYaml = `
|
||||
- model: 'GPT-5.6 Sol[^gpt-56-sol-promo]'
|
||||
provider: openai
|
||||
release_status: GA
|
||||
category: Powerful
|
||||
threshold: '≤ 272K'
|
||||
tier: Default
|
||||
input: $2.00
|
||||
cached_input: $0.20
|
||||
output: $10.00
|
||||
cache_write: $2.50
|
||||
|
||||
- model: 'GPT-5.6 Sol[^gpt-56-sol-promo]'
|
||||
provider: openai
|
||||
release_status: GA
|
||||
category: Powerful
|
||||
threshold: '> 272K'
|
||||
tier: 'Long context'
|
||||
input: $4.00
|
||||
cached_input: $0.40
|
||||
output: $15.00
|
||||
cache_write: $5.00
|
||||
`;
|
||||
|
||||
test("parses rows straight from the docs YAML format", () => {
|
||||
const models = parseGitHubCopilotPricing(Bun.YAML.parse(pricingYaml));
|
||||
expect(models).toHaveLength(1);
|
||||
expect(models[0]?.slug).toBe("gpt-5.6-sol");
|
||||
expect(buildGitHubCopilotCost(models[0]!)).toEqual({
|
||||
input: 2,
|
||||
output: 10,
|
||||
cache_read: 0.2,
|
||||
cache_write: 2.5,
|
||||
tiers: [{
|
||||
tier: { type: "context", size: 272_000 },
|
||||
input: 4,
|
||||
output: 15,
|
||||
cache_read: 0.4,
|
||||
cache_write: 5,
|
||||
}],
|
||||
});
|
||||
});
|
||||
@@ -1,191 +0,0 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { groups, providers, syncProvider, type ExistingModel } from "../src/sync/index.js";
|
||||
import { fetchMetaModels, meta, parseMetaModels } from "../src/sync/providers/meta.js";
|
||||
|
||||
// Public docs format; intentionally exclude account-scoped API responses.
|
||||
const models = `
|
||||
## Muse Spark {#muse-spark}
|
||||
|
||||
| Model ID | Tier | Input modalities | Output modalities | Context window |
|
||||
| :---- | :---- | :---- | :---- | :---- |
|
||||
| \`muse-spark-1.2\` | [Standard](/docs/pricing-rate-limits#standard-tier) | Text, image, video, audio, PDF | Text | 1,048,576 tokens |
|
||||
| \`muse-spark-1.2-contributor\` | [Contributor](/docs/pricing-rate-limits#contributor-tier) | Text, image, video, audio, PDF | Text | 1,048,576 tokens |
|
||||
|
||||
## Muse Image
|
||||
|
||||
| Model ID | Family | Input | Output |
|
||||
| :---- | :---- | :---- | :---- |
|
||||
| \`muse-image-1.0\` | Muse Image | Text, image | Image |
|
||||
`;
|
||||
|
||||
const pricing = `
|
||||
### Standard tier {#standard-tier}
|
||||
|
||||
| Usage | Price per 1M tokens |
|
||||
| :---- | :---- |
|
||||
| Cached input | $0.15 |
|
||||
| Input | $1.25 |
|
||||
| Output | $4.25 |
|
||||
|
||||
### Contributor tier {#contributor-tier}
|
||||
|
||||
| Usage | Price per 1M tokens |
|
||||
| :---- | :---- |
|
||||
| Cached input | $0.002 |
|
||||
| Input | $0.10 |
|
||||
| Output | $0.20 |
|
||||
|
||||
### Image generation
|
||||
|
||||
Muse Image costs $0.01 per image, not per token.
|
||||
`;
|
||||
|
||||
const source = { models, pricing };
|
||||
|
||||
test("Meta sync is registered for direct and hourly runs", () => {
|
||||
expect(providers.meta).toBe(meta);
|
||||
expect(groups.direct).toContain("meta");
|
||||
expect(meta.skipCreates).toBe(true);
|
||||
expect(meta.deleteMissing).toBe(false);
|
||||
});
|
||||
|
||||
test("parses public text models, tier prices in USD/MTok, and context windows", () => {
|
||||
expect(parseMetaModels(source)).toEqual([
|
||||
{ id: "muse-spark-1.2", context: 1_048_576, cost: { input: 1.25, output: 4.25, cache_read: 0.15 } },
|
||||
{ id: "muse-spark-1.2-contributor", context: 1_048_576, cost: { input: 0.1, output: 0.2, cache_read: 0.002 } },
|
||||
]);
|
||||
expect(parseMetaModels({ ...source, pricing: pricing.replace("$0.002", "$0") })[1]?.cost.cache_read).toBe(0);
|
||||
expect(parseMetaModels({ ...source, models: models.replaceAll("1,048,576", "1048576") })[0]?.context).toBe(1_048_576);
|
||||
});
|
||||
|
||||
test("rejects incomplete or changed docs rather than guessing prices or limits", () => {
|
||||
for (const bad of [
|
||||
{ ...source, models: "<html>Unavailable</html>" },
|
||||
{ ...source, pricing: "" },
|
||||
{ ...source, models: models.replace("1,048,576 tokens", "Unknown") },
|
||||
{ ...source, models: models.replace("1,048,576 tokens", "0 tokens") },
|
||||
{ ...source, models: models.replace("1,048,576 tokens", "1,04,8576 tokens") },
|
||||
{ ...source, models: models.replace("#standard-tier)", "#unknown-tier)") },
|
||||
{ ...source, models: models.replace("`muse-spark-1.2`", "`../private`") },
|
||||
{ ...source, pricing: pricing.replace("$1.25", "€1.25") },
|
||||
{ ...source, pricing: pricing.replace("$1.25", "$-1") },
|
||||
{ ...source, pricing: pricing.replace("Price per 1M tokens", "Price per 1K tokens") },
|
||||
{ ...source, pricing: pricing.replace("| Output | $4.25 |", "") },
|
||||
{ ...source, pricing: pricing.replace("| Output | $4.25 |", "| Output | $4.25 |\n| Input | $2 |") },
|
||||
{ ...source, models: models.replace("muse-spark-1.2-contributor", "muse-spark-1.2") },
|
||||
{ ...source, models: models.replace("| :---- | :---- | :---- | :---- | :---- |", "| broken |") },
|
||||
]) {
|
||||
expect(() => parseMetaModels(bad)).toThrow();
|
||||
}
|
||||
});
|
||||
|
||||
test("updates only authoritative fields without expanding inherited metadata", () => {
|
||||
const authored: ExistingModel = {
|
||||
base_model: "meta/muse-spark-1.2",
|
||||
base_model_omit: ["limit.input"],
|
||||
reasoning_options: [{ type: "effort", values: ["minimal", "low", "medium", "high", "xhigh"] }],
|
||||
cost: { input: 9, output: 9, cache_read: 9, input_audio: 2, reasoning: 3 },
|
||||
status: "beta",
|
||||
};
|
||||
const existing: ExistingModel = {
|
||||
...authored,
|
||||
name: "Muse Spark 1.2",
|
||||
reasoning: true,
|
||||
limit: { context: 1_048_576, output: 131_072 },
|
||||
modalities: { input: ["text", "image", "pdf", "video"], output: ["text"] },
|
||||
};
|
||||
const model = parseMetaModels(source)[0]!;
|
||||
const context = { authored: () => authored, existing: () => existing };
|
||||
const translated = meta.translateModel(model, context)!;
|
||||
expect(translated.model).toEqual({
|
||||
...authored,
|
||||
limit: undefined,
|
||||
cost: { input: 1.25, output: 4.25, cache_read: 0.15, input_audio: 2, reasoning: 3 },
|
||||
});
|
||||
expect(meta.translateModel({ ...model, context: 2_000_000 }, context)?.model.limit).toEqual({ context: 2_000_000 });
|
||||
expect(authored.cost?.input).toBe(9);
|
||||
});
|
||||
|
||||
test("unknown documented models are reported, never synthesized", () => {
|
||||
const model = parseMetaModels(source)[0]!;
|
||||
expect(meta.translateModel(model, { authored: () => undefined, existing: () => undefined })).toBeUndefined();
|
||||
expect(meta.sourceID(model)).toBe(model.id);
|
||||
expect(meta.skippedNotice([model.id]).join(" ")).toContain(model.id);
|
||||
});
|
||||
|
||||
test("fetches only public docs without credentials and rejects HTTP failures", async () => {
|
||||
const urls: string[] = [];
|
||||
const fetcher = (async (url: string, init?: RequestInit) => {
|
||||
urls.push(url);
|
||||
expect(init).toBeUndefined();
|
||||
return new Response(url.endsWith("/models.md") ? models : pricing);
|
||||
}) as typeof fetch;
|
||||
expect(await fetchMetaModels(fetcher)).toEqual(source);
|
||||
expect(urls).toEqual(["https://dev.meta.ai/docs/models.md", "https://dev.meta.ai/docs/pricing-rate-limits.md"]);
|
||||
const failing = (async () => new Response("Unavailable", { status: 503 })) as typeof fetch;
|
||||
await expect(fetchMetaModels(failing)).rejects.toThrow("Meta docs request failed: 503");
|
||||
});
|
||||
|
||||
test("runner preserves inherited controls, retains absent models, and is idempotent", async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "models-dev-meta-"));
|
||||
const modelsDir = path.join(root, "providers", "meta", "models");
|
||||
const filename = path.join(modelsDir, "muse-spark-1.2.toml");
|
||||
const original = `# Keep this authored source comment.
|
||||
base_model = "meta/muse-spark-1.2"
|
||||
base_model_omit = ["limit.input"]
|
||||
reasoning_options = [{ type = "effort", values = ["minimal", "low", "medium", "high", "xhigh"] }]
|
||||
[cost]
|
||||
input = 9
|
||||
output = 9
|
||||
cache_read = 9
|
||||
`;
|
||||
const absent = path.join(modelsDir, "muse-spark-1.1.toml");
|
||||
try {
|
||||
await Bun.write(path.join(root, "models", "meta", "muse-spark-1.2.toml"), `
|
||||
name = "Muse Spark 1.2"
|
||||
description = "Test fixture"
|
||||
release_date = "2026-01-01"
|
||||
last_updated = "2026-01-01"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
open_weights = false
|
||||
[limit]
|
||||
context = 1048576
|
||||
input = 1048576
|
||||
output = 131072
|
||||
[modalities]
|
||||
input = ["text", "image", "pdf", "video"]
|
||||
output = ["text"]
|
||||
`);
|
||||
await Bun.write(filename, original);
|
||||
await Bun.write(absent, original);
|
||||
const provider = { ...meta, modelsDir, fetchModels: async () => source };
|
||||
const dry = await syncProvider(provider, { dryRun: true, openIssues: false });
|
||||
expect(dry.updated).toBe(1);
|
||||
expect(await Bun.file(filename).text()).toBe(original);
|
||||
const first = await syncProvider(provider, { openIssues: false });
|
||||
expect(first).toMatchObject({ created: 0, updated: 1, deleted: 0, unchanged: 1 });
|
||||
expect(first.notices.join(" ")).toContain("muse-spark-1.2-contributor");
|
||||
expect(await Bun.file(absent).text()).toBe(original);
|
||||
const text = await Bun.file(filename).text();
|
||||
expect(text).toStartWith("# Keep this authored source comment.");
|
||||
const result = Bun.TOML.parse(text);
|
||||
expect(result.base_model).toBe("meta/muse-spark-1.2");
|
||||
expect(result.base_model_omit).toEqual(["limit.input"]);
|
||||
expect(result.reasoning_options).toEqual(Bun.TOML.parse(original).reasoning_options);
|
||||
expect(result.limit).toBeUndefined();
|
||||
expect(result.cost).toEqual({ input: 1.25, output: 4.25, cache_read: 0.15 });
|
||||
const second = await syncProvider(provider, { openIssues: false });
|
||||
expect(second).toMatchObject({ created: 0, updated: 0, deleted: 0, unchanged: 2 });
|
||||
expect(await Bun.file(filename).text()).toBe(text);
|
||||
await expect(syncProvider({ ...provider, fetchModels: async () => ({ ...source, pricing: "" }) })).rejects.toThrow();
|
||||
expect(await Bun.file(filename).text()).toBe(text);
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
@@ -1,55 +0,0 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { formatToml } from "../src/sync/index.js";
|
||||
import { buildOvhcloudModel, type OvhcloudModel } from "../src/sync/providers/ovhcloud.js";
|
||||
|
||||
function model(pricing?: OvhcloudModel["pricing"]): OvhcloudModel {
|
||||
return {
|
||||
id: "example-model",
|
||||
name: "Example Model",
|
||||
created: Date.parse("2026-09-02T00:00:00Z") / 1_000,
|
||||
context_length: 262_144,
|
||||
pricing,
|
||||
};
|
||||
}
|
||||
|
||||
test.each([
|
||||
{ label: "absent pricing", pricing: undefined },
|
||||
{ label: "empty pricing", pricing: {} },
|
||||
{ label: "blank rates", pricing: { prompt: "", completion: "" } },
|
||||
{ label: "whitespace rates", pricing: { prompt: " ", completion: "\t" } },
|
||||
{ label: "explicit zero rates", pricing: { prompt: "0", completion: "0" } },
|
||||
])("OVHcloud serializes zero costs for $label", ({ pricing }) => {
|
||||
const result = buildOvhcloudModel(model(pricing), undefined);
|
||||
const content = formatToml({ id: "example-model", ...result });
|
||||
|
||||
expect(Bun.TOML.parse(content).cost).toEqual({ input: 0, output: 0 });
|
||||
});
|
||||
|
||||
test("OVHcloud converts paid and cache rates to per-million costs", () => {
|
||||
const result = buildOvhcloudModel(model({
|
||||
prompt: "0.00000047",
|
||||
completion: "0.00000319",
|
||||
input_cache_reads: "0.00000009",
|
||||
input_cache_writes: "0.00000012",
|
||||
}), undefined);
|
||||
|
||||
expect(result.cost).toEqual({ input: 0.47, output: 3.19, cache_read: 0.09, cache_write: 0.12 });
|
||||
});
|
||||
|
||||
test.each([
|
||||
{ pricing: { prompt: "0.00000047" }, expected: { input: 0.47, output: 0 } },
|
||||
{ pricing: { completion: "0.00000319" }, expected: { input: 0, output: 3.19 } },
|
||||
])("OVHcloud preserves a supplied rate when the other is missing: %j", ({ pricing, expected }) => {
|
||||
const result = buildOvhcloudModel(model(pricing), undefined);
|
||||
const content = formatToml({ id: "example-model", ...result });
|
||||
|
||||
expect(Bun.TOML.parse(content).cost).toEqual(expected);
|
||||
});
|
||||
|
||||
test("OVHcloud replaces prior costs with zeros when pricing is absent", () => {
|
||||
const result = buildOvhcloudModel(model(), { cost: { input: 0.47, output: 3.19 } });
|
||||
const content = formatToml({ id: "example-model", ...result });
|
||||
|
||||
expect(Bun.TOML.parse(content).cost).toEqual({ input: 0, output: 0 });
|
||||
});
|
||||
@@ -1,51 +0,0 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { buildRequestyModel, RequestyModel, resolveRequestyBaseModel } from "../src/sync/providers/requesty.js";
|
||||
|
||||
test.each([
|
||||
["claude-fable-5.1", "anthropic/claude-fable-5-1"],
|
||||
["claude-fable-5.1@eu", "anthropic/claude-fable-5-1"],
|
||||
["claude-sonnet-4.6", "anthropic/claude-sonnet-4-6"],
|
||||
["claude-sonnet-4", "anthropic/claude-sonnet-4-0"],
|
||||
["claude-opus-4-7", "anthropic/claude-opus-4-7"],
|
||||
["gemini-3.8-flash@eu", "google/gemini-3.8-flash"],
|
||||
["qwen3.8-2.4T-A95B@eu", "alibaba/qwen3.8-2.4t-a95b"],
|
||||
])("resolves Requesty %s to %s", (id, expected) => {
|
||||
expect(resolveRequestyBaseModel(id)).toBe(expected);
|
||||
});
|
||||
|
||||
test("does not invent a base model for unknown Claude releases", () => {
|
||||
expect(resolveRequestyBaseModel("claude-fable-999.1@eu")).toBeUndefined();
|
||||
});
|
||||
|
||||
test.each(["claude-fable-5.1", "claude-fable-5.1@eu"])(
|
||||
"keeps %s override-only",
|
||||
(id) => {
|
||||
const model = buildRequestyModel(RequestyModel.parse({
|
||||
id,
|
||||
created: Date.parse("2026-09-01") / 1_000,
|
||||
description: "Requesty description",
|
||||
context_window: 1_000_000,
|
||||
max_output_tokens: 128_000,
|
||||
supports_vision: true,
|
||||
supports_reasoning: true,
|
||||
supports_tool_calling: true,
|
||||
supports_output_json_schema: true,
|
||||
input_price: 0.00001,
|
||||
output_price: 0.00005,
|
||||
cached_price: 0.00000025,
|
||||
caching_price: 0.0000125,
|
||||
}));
|
||||
|
||||
expect(JSON.parse(JSON.stringify(model))).toEqual({
|
||||
base_model: "anthropic/claude-fable-5-1",
|
||||
...(id.endsWith("@eu") ? { name: "Claude Fable 5.1 (EU)" } : {}),
|
||||
structured_output: true,
|
||||
reasoning_options: [
|
||||
{ type: "effort", values: ["none", "low", "medium", "high", "max"] },
|
||||
{ type: "budget_tokens" },
|
||||
],
|
||||
cost: { input: 10, output: 50, cache_read: 0.25, cache_write: 12.5 },
|
||||
});
|
||||
},
|
||||
);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -68,10 +68,7 @@ export interface CostTier extends Cost {
|
||||
|
||||
/** Pricing for a provider's model, including context-size tiers. */
|
||||
export interface ModelCost extends Cost {
|
||||
/**
|
||||
* Legacy compatibility field for context-tier pricing.
|
||||
* @deprecated Use `tiers` to read the exact context threshold.
|
||||
*/
|
||||
/** Legacy compatibility field: pricing applied beyond 200K context. Prefer `tiers`. */
|
||||
context_over_200k?: Cost
|
||||
/** Context-size-based pricing tiers. */
|
||||
tiers?: CostTier[]
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# Sources (accessed 2026-08-31):
|
||||
# - Model card, limits (1M context, 999,990 max output), capabilities, GLM-5.3 base:
|
||||
# https://docs.abliteration.ai/models
|
||||
# - Reasoning modes and per-endpoint request fields:
|
||||
# https://docs.abliteration.ai/capabilities/thinking
|
||||
# - Pricing ($5 per 1M tokens input/output, $0.50 per 1M cached input):
|
||||
# https://docs.abliteration.ai/pricing
|
||||
# https://abliteration.ai/pricing
|
||||
# - Launch announcement (GLM-5.3 base, FP8 hosting, benchmarks):
|
||||
# https://abliteration.ai/blog/introducing-abliterated-model-large-v2
|
||||
name = "Abliterated Model Large V2"
|
||||
description = "GLM-5.3 model abliterated and finetuned for cyber, ML red teaming, and agent testing"
|
||||
release_date = "2026-08-29"
|
||||
last_updated = "2026-08-31"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
temperature = true
|
||||
open_weights = false
|
||||
|
||||
# Three distinct reasoning depths: low, high, max (default: max).
|
||||
# Reasoning cannot be disabled on this model: "none" and {"thinking": false}
|
||||
# map to low and hide the trace, so there is no toggle option. Other ladder
|
||||
# values are accepted aliases: minimal -> low, medium -> high, xhigh -> max.
|
||||
[[reasoning_options]]
|
||||
type = "effort" # API: {"reasoning_effort": "<value>"} on /v1/chat/completions
|
||||
values = ["low", "high", "max"]
|
||||
|
||||
[cost]
|
||||
input = 5.00
|
||||
output = 5.00
|
||||
cache_read = 0.50
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
input = 1_000_000
|
||||
output = 999_990
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M14.25 2 6 13h4.5L9.75 22 18 11h-4.5L14.25 2z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 148 B |
@@ -1,28 +0,0 @@
|
||||
# Passthrough to the official DeepSeek API.
|
||||
# Toggle: `thinking.type = enabled|disabled`; effort: `reasoning_effort = low|high|max`
|
||||
# (Flash maps requested low→low). https://api-docs.deepseek.com/guides/thinking_mode/
|
||||
# Off-peak rate from the CURRENT DeepSeek price sheet effective 2026-08-16
|
||||
# (flash $0.22/$0.007/$0.66, pro $0.66/$0.022/$1.98 off-peak) plus a flat 10%;
|
||||
# peak (weekdays 01:00-04:00 and 06:00-10:00 UTC, Beijing-time weekends
|
||||
# off-peak) is 2x. https://api-docs.deepseek.com/quick_start/pricing/
|
||||
# (accessed 2026-08-29; note first-party catalog entries predate 2026-08-16).
|
||||
# Toggle verified end-to-end on this host 2026-08-29.
|
||||
# Reasoning tokens billed at the output rate.
|
||||
base_model = "deepseek/deepseek-v4-flash-vision-exp"
|
||||
name = "DeepSeek V4 Flash Vision (Exp)"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["low", "high", "max"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.242
|
||||
output = 0.726
|
||||
reasoning = 0.726
|
||||
cache_read = 0.0077
|
||||
@@ -1,28 +0,0 @@
|
||||
# Passthrough to the official DeepSeek API.
|
||||
# Toggle: `thinking.type = enabled|disabled`; effort: `reasoning_effort = low|high|max`
|
||||
# (Flash maps requested low→low). https://api-docs.deepseek.com/guides/thinking_mode/
|
||||
# Off-peak rate from the CURRENT DeepSeek price sheet effective 2026-08-16
|
||||
# (flash $0.22/$0.007/$0.66, pro $0.66/$0.022/$1.98 off-peak) plus a flat 10%;
|
||||
# peak (weekdays 01:00-04:00 and 06:00-10:00 UTC, Beijing-time weekends
|
||||
# off-peak) is 2x. https://api-docs.deepseek.com/quick_start/pricing/
|
||||
# (accessed 2026-08-29; note first-party catalog entries predate 2026-08-16).
|
||||
# Toggle verified end-to-end on this host 2026-08-29.
|
||||
# Reasoning tokens billed at the output rate.
|
||||
base_model = "deepseek/deepseek-v4-flash-0731"
|
||||
name = "DeepSeek V4 Flash"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["low", "high", "max"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.242
|
||||
output = 0.726
|
||||
reasoning = 0.726
|
||||
cache_read = 0.0077
|
||||
@@ -1,29 +0,0 @@
|
||||
# Passthrough to the official DeepSeek API.
|
||||
# Toggle: `thinking.type = enabled|disabled`; effort: `reasoning_effort = high|max`
|
||||
# (Pro maps requested low→high, so low is not a real level).
|
||||
# https://api-docs.deepseek.com/guides/thinking_mode/
|
||||
# Off-peak rate from the CURRENT DeepSeek price sheet effective 2026-08-16
|
||||
# (flash $0.22/$0.007/$0.66, pro $0.66/$0.022/$1.98 off-peak) plus a flat 10%;
|
||||
# peak (weekdays 01:00-04:00 and 06:00-10:00 UTC, Beijing-time weekends
|
||||
# off-peak) is 2x. https://api-docs.deepseek.com/quick_start/pricing/
|
||||
# (accessed 2026-08-29; note first-party catalog entries predate 2026-08-16).
|
||||
# Toggle verified end-to-end on this host 2026-08-29.
|
||||
# Reasoning tokens billed at the output rate.
|
||||
base_model = "deepseek/deepseek-v4-pro-0813"
|
||||
name = "DeepSeek V4 Pro"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["high", "max"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.726
|
||||
output = 2.178
|
||||
reasoning = 2.178
|
||||
cache_read = 0.0242
|
||||
@@ -1,18 +0,0 @@
|
||||
# Passthrough to the Fireworks fast router (~2x standard throughput).
|
||||
# Effort: `reasoning_effort = none|high|max`; "none" disables thinking
|
||||
# (`chat_template_kwargs = {"thinking": false}` also works as an alternate).
|
||||
# Verified end-to-end on this host 2026-08-29.
|
||||
base_model = "zhipuai/glm-5.2"
|
||||
name = "GLM 5.2 Fast"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["none", "high", "max"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 2.31
|
||||
output = 7.26
|
||||
cache_read = 0.231
|
||||
@@ -1,18 +0,0 @@
|
||||
# Passthrough to Fireworks serverless.
|
||||
# Effort: `reasoning_effort = none|high|max`; "none" disables thinking
|
||||
# (`chat_template_kwargs = {"thinking": false}` also works as an alternate).
|
||||
# Verified end-to-end on this host 2026-08-29.
|
||||
base_model = "zhipuai/glm-5.2"
|
||||
name = "GLM 5.2"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["none", "high", "max"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 1.54
|
||||
output = 4.84
|
||||
cache_read = 0.154
|
||||
@@ -1,24 +0,0 @@
|
||||
# Passthrough to Fireworks serverless (accounts/fireworks/models/glm-5p3-flash).
|
||||
# Thinking-only model: reasoning cannot be disabled. Same surface as the
|
||||
# Fireworks peer entry: effort high|max (Fireworks collapses requested
|
||||
# low/medium to high; the wire accepts them but they select no distinct tier,
|
||||
# and "none" is rejected with a 400 — verified live 2026-08-30). Image input
|
||||
# verified; video/pdf are not supported on this host. Costs are the Fireworks
|
||||
# rate ($0.15/$0.029/$0.50) plus a flat 10%.
|
||||
base_model = "zhipuai/glm-5.3-flash"
|
||||
name = "GLM 5.3 Flash"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["high", "max"]
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.165
|
||||
output = 0.55
|
||||
cache_read = 0.0319
|
||||
@@ -1,20 +0,0 @@
|
||||
# Passthrough to the official MiMo API (api.xiaomimimo.com); same model as
|
||||
# mimo-v2.5-pro served at up to ~1000 tok/s, 3x price for speed.
|
||||
# Toggle: `thinking.type = enabled|disabled`, as providers/xiaomi; verified
|
||||
# end-to-end on this host 2026-08-29.
|
||||
# RMB upstream (pro CNY 3/0.025/6, ultraspeed CNY 9/0.075/18 per MTok)
|
||||
# converted at 6.5 CNY/USD (operator rate set 2026-07, spot ~6.79; buffer
|
||||
# covers FX drift), then a flat 10% markup; rounded to 4dp. Checked 2026-08-29.
|
||||
base_model = "xiaomi/mimo-v2.5-pro-ultraspeed"
|
||||
name = "MiMo V2.5 Pro UltraSpeed"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle"
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 1.5231
|
||||
output = 3.0462
|
||||
cache_read = 0.0127
|
||||
@@ -1,19 +0,0 @@
|
||||
# Passthrough to the official MiMo API (api.xiaomimimo.com).
|
||||
# Toggle: `thinking.type = enabled|disabled`, as providers/xiaomi; verified
|
||||
# end-to-end on this host 2026-08-29.
|
||||
# RMB upstream (pro CNY 3/0.025/6, ultraspeed CNY 9/0.075/18 per MTok)
|
||||
# converted at 6.5 CNY/USD (operator rate set 2026-07, spot ~6.79; buffer
|
||||
# covers FX drift), then a flat 10% markup; rounded to 4dp. Checked 2026-08-29.
|
||||
base_model = "xiaomi/mimo-v2.5-pro"
|
||||
name = "MiMo V2.5 Pro"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle"
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.5077
|
||||
output = 1.0154
|
||||
cache_read = 0.0042
|
||||
@@ -1,27 +0,0 @@
|
||||
# Passthrough to Fireworks serverless.
|
||||
# Toggle: `reasoning_effort = "none"` disables thinking (also accepts
|
||||
# `chat_template_kwargs = {"thinking": false}`); verified end-to-end on this
|
||||
# host 2026-08-29. The Alibaba first-party effort levels and budget_tokens are
|
||||
# not exposed by this host.
|
||||
# Host deltas vs the lab base: image input verified end-to-end 2026-08-23
|
||||
# (video/pdf not supported on this host); output capped at 32,768.
|
||||
base_model = "alibaba/qwen3.8-max"
|
||||
name = "Qwen 3.8 Max"
|
||||
attachment = false
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle"
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
|
||||
[limit]
|
||||
output = 32_768
|
||||
|
||||
[cost]
|
||||
input = 2.2
|
||||
output = 6.6
|
||||
cache_read = 0.275
|
||||
@@ -1,11 +0,0 @@
|
||||
name = "above.dev"
|
||||
env = ["ABOVE_API_KEY"]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
# OpenAI-compatible gateway selling upstream cost plus a flat 10% on every
|
||||
# token class, with the full upstream cache-hit discount passed through.
|
||||
# DeepSeek models use time-of-day pricing (peak = 2x, weekdays 01:00-04:00 and
|
||||
# 06:00-10:00 UTC; weekends off-peak); costs below are the off-peak rate.
|
||||
# Every response reports its exact cost in the `x-cost-usd` header.
|
||||
# https://above.dev/llms.txt
|
||||
api = "https://api.above.dev/v1"
|
||||
doc = "https://above.dev/docs"
|
||||
@@ -1,4 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img">
|
||||
<title>AgentRouter</title>
|
||||
<path d="M11.8 5C7.8 4.2 3 9.6 4.2 15.6c.4 3 3 4.6 6.6 3-1.8-3-2.6-7.8 1-13.6Zm.4 14c4 .8 8.8-4.6 7.6-10.6-.4-3-3-4.6-6.6-3 1.8 3 2.6 7.8-1 13.6ZM12 9.5c.2 1.5 1 2.3 2.5 2.5-1.5.2-2.3 1-2.5 2.5-.2-1.5-1-2.3-2.5-2.5 1.5-.2 2.3-1 2.5-2.5Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 370 B |
@@ -1,8 +0,0 @@
|
||||
# Catalog and endpoint support: https://agentrouter.org/api/pricing
|
||||
# AgentRouter publishes relative token ratios, not USD prices, so cost is intentionally omitted.
|
||||
base_model = "anthropic/claude-opus-4-8"
|
||||
reasoning_options = [{ type = "effort", values = ["low", "medium", "high", "xhigh", "max"] }]
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/anthropic"
|
||||
api = "https://agentrouter.org/v1"
|
||||
@@ -1,8 +0,0 @@
|
||||
# Catalog and endpoint support: https://agentrouter.org/api/pricing
|
||||
# AgentRouter publishes relative token ratios, not USD prices, so cost is intentionally omitted.
|
||||
base_model = "anthropic/claude-opus-5"
|
||||
reasoning_options = [{ type = "effort", values = ["low", "medium", "high", "xhigh", "max"] }]
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/anthropic"
|
||||
api = "https://agentrouter.org/v1"
|
||||
@@ -1,4 +0,0 @@
|
||||
# Catalog and endpoint support: https://agentrouter.org/api/pricing
|
||||
# AgentRouter publishes relative token ratios, not USD prices, so cost is intentionally omitted.
|
||||
base_model = "openai/gpt-5.6-sol"
|
||||
reasoning_options = [{ type = "effort", values = ["none", "low", "medium", "high", "xhigh", "max"] }]
|
||||
@@ -1,5 +0,0 @@
|
||||
name = "AgentRouter"
|
||||
env = ["AGENTROUTER_API_KEY"]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
api = "https://agentrouter.org/v1"
|
||||
doc = "https://agentrouter.org/docs/opencode.html"
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="currentColor"><path d="M 111.50 70.50 L 81.50 99.00 L 68.50 114.00 L 49.50 140.00 L 36.00 163.00 L 26.00 183.50 L 13.00 218.50 L 5.50 250.00 L 1.50 282.00 L 0.00 285.50 L 0.00 739.50 L 1.50 742.00 L 4.50 769.00 L 9.50 792.00 L 18.00 820.00 L 26.50 841.00 L 37.00 862.50 L 49.50 883.50 L 64.50 904.50 L 81.50 924.50 L 99.00 942.00 L 121.00 960.50 L 141.50 975.00 L 170.50 991.50 L 194.50 1002.00 L 225.50 1012.50 L 246.00 1017.50 L 282.00 1022.50 L 282.50 1023.50 L 750.00 1023.00 L 745.50 1022.50 L 772.50 1018.50 L 799.00 1012.50 L 818.50 1006.50 L 841.00 997.50 L 864.00 986.00 L 882.50 975.00 L 904.50 959.50 L 923.00 944.00 L 944.00 923.00 L 964.00 898.50 L 981.50 872.00 L 996.00 844.50 L 1006.00 819.50 L 1013.00 797.50 L 1018.50 773.00 L 1022.50 741.00 L 1023.50 740.50 L 1023.50 285.50 L 1022.50 285.00 L 1021.50 270.00 L 1016.00 238.00 L 1010.00 216.00 L 999.00 186.00 L 990.00 167.00 L 975.00 141.00 L 959.50 119.00 L 944.00 100.50 L 923.50 80.00 L 907.00 66.00 L 879.50 46.50 L 862.50 36.50 L 842.00 26.50 L 807.50 13.50 L 774.50 5.50 L 744.00 1.00 L 747.50 0.00 L 278.00 0.50 L 281.00 1.00 L 255.50 4.50 L 227.50 10.50 L 207.50 16.50 L 185.50 25.00 L 144.00 47.00 Z M 693.50 241.00 L 680.50 244.50 L 674.50 247.50 L 665.00 254.50 L 660.00 260.00 L 654.00 270.00 L 651.00 278.50 L 649.50 286.50 L 649.50 297.00 L 651.50 306.50 L 656.00 316.50 L 664.00 327.00 L 671.00 333.00 L 681.00 338.50 L 689.00 341.00 L 707.50 342.00 L 716.50 340.00 L 724.50 336.50 L 733.00 330.50 L 741.00 322.00 L 744.50 317.00 L 749.50 305.00 L 751.00 297.00 L 751.00 285.50 L 748.50 274.50 L 744.00 265.00 L 737.50 256.50 L 732.00 251.50 L 724.50 246.50 L 713.00 242.00 L 703.50 240.50 Z M 741.50 384.00 L 735.50 379.00 L 730.50 377.00 L 716.00 377.00 L 706.50 378.50 L 684.00 386.00 L 672.00 392.50 L 661.50 400.50 L 651.00 412.50 L 631.00 446.00 L 598.50 492.00 L 571.50 525.50 L 535.50 565.50 L 501.50 599.00 L 463.50 631.50 L 429.00 655.50 L 395.50 673.50 L 372.00 682.50 L 348.50 687.50 L 325.00 687.50 L 305.50 683.00 L 291.00 676.00 L 275.00 664.00 L 263.50 651.50 L 254.50 639.00 L 245.00 622.00 L 243.50 622.00 L 238.00 642.00 L 233.50 666.50 L 231.50 686.00 L 231.00 708.00 L 232.50 726.50 L 236.50 744.50 L 241.50 756.50 L 248.50 767.00 L 256.00 774.50 L 265.00 780.50 L 272.50 784.00 L 289.00 788.50 L 306.50 790.50 L 329.50 790.50 L 355.00 788.00 L 384.00 780.50 L 414.50 769.00 L 443.50 754.00 L 477.50 731.50 L 508.00 706.50 L 545.00 670.50 L 571.00 641.50 L 591.50 616.00 L 622.50 573.50 L 647.00 536.50 L 670.00 499.00 L 703.50 440.50 L 704.00 443.00 L 671.00 601.00 L 668.00 608.50 L 658.00 619.50 L 649.00 625.00 L 638.50 627.00 L 608.50 628.50 L 606.50 631.00 L 606.50 636.50 L 619.50 647.50 L 629.50 658.00 L 637.50 669.00 L 646.00 684.50 L 651.50 698.00 L 657.00 716.50 L 660.00 731.50 L 663.00 757.00 L 665.00 762.50 L 672.00 769.50 L 681.00 773.00 L 688.00 772.50 L 697.00 768.00 L 706.50 758.00 L 712.50 743.50 L 713.00 731.50 L 710.50 701.00 L 711.50 694.50 L 715.00 686.50 L 721.00 679.50 L 726.00 676.00 L 749.50 665.50 L 768.50 652.50 L 776.50 645.00 L 784.50 635.00 L 793.00 618.00 L 792.00 615.00 L 787.00 614.50 L 759.50 622.50 L 734.50 626.50 L 722.50 626.00 L 718.50 623.50 L 715.50 619.50 L 715.00 613.50 L 718.00 589.00 L 746.00 402.00 L 745.50 392.50 Z" fill-rule="evenodd" clip-rule="evenodd"/></svg>
|
||||
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -1,28 +0,0 @@
|
||||
name = "Agnes 2.0 Flash"
|
||||
description = "Fast and efficient model for agent workflows, tool calling, coding, and image understanding."
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
temperature = true
|
||||
release_date = "2026-05-25"
|
||||
last_updated = "2026-05-25"
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 0
|
||||
output = 0
|
||||
|
||||
[limit]
|
||||
context = 512_000
|
||||
output = 65_536
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle" # API: {"chat_template_kwargs": {"enable_thinking": true}}
|
||||
@@ -1,28 +0,0 @@
|
||||
name = "Agnes 2.5 Flash"
|
||||
description = "Upgraded model with improved coding, agent workflows, tool calling, and multimodal understanding."
|
||||
release_date = "2026-07"
|
||||
last_updated = "2026-07"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
temperature = true
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 0
|
||||
output = 0
|
||||
|
||||
[limit]
|
||||
context = 512_000
|
||||
output = 65_536
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle" # API: {"chat_template_kwargs": {"enable_thinking": true}}
|
||||
@@ -1,29 +0,0 @@
|
||||
name = "Agnes 2.5 Pro Alpha"
|
||||
description = "Paid reasoning model for advanced coding, scientific reasoning, long-context analysis, agentic workflows, and multimodal understanding."
|
||||
release_date = "2026-07-24"
|
||||
last_updated = "2026-07-24"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
temperature = true
|
||||
open_weights = true
|
||||
|
||||
[cost]
|
||||
input = 0.45
|
||||
output = 0.90
|
||||
cache_read = 0.0038
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 65_536
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "toggle" # API: {"chat_template_kwargs": {"enable_thinking": true}}
|
||||
@@ -1,5 +0,0 @@
|
||||
name = "Agnes AI"
|
||||
env = ["AGNES_API_KEY"]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
doc = "https://agnes-ai.com/doc"
|
||||
api = "https://apihub.agnes-ai.com/v1"
|
||||
@@ -1,22 +0,0 @@
|
||||
# Source: GET https://api.aiand.com/v1/models (USD list prices; accessed
|
||||
# 2026-08-29). GET /v1/models reports context_window = 262144, input = $0.40,
|
||||
# output = $3.00, cached_input = $0.20 per 1M tokens.
|
||||
# Modalities: text, image, video, and document (PDF) supported per catalog
|
||||
# capabilities (vision|video|document).
|
||||
# reasoning_effort verified by live probe on 2026-08-29: accepts none, low,
|
||||
# medium, xhigh (200); rejects minimal, high, max with 400 ("Supported
|
||||
# values: none, low, medium, xhigh"). effort=none returns no
|
||||
# reasoning_content (off).
|
||||
base_model = "alibaba/qwen3.8-27b"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["none", "low", "medium", "xhigh"]
|
||||
|
||||
[cost]
|
||||
input = 0.4
|
||||
output = 3
|
||||
cache_read = 0.2
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video", "pdf"]
|
||||
@@ -1,21 +0,0 @@
|
||||
# Source: GET https://api.aiand.com/v1/models (USD list prices; accessed
|
||||
# 2026-08-29). GET /v1/models reports context_window = 1048576 (shared base
|
||||
# model uses 1_000_000), so the exact figure is overridden here.
|
||||
# Lab / peer relays (zhipuai, zai, OpenRouter, Kilo) use always-on effort
|
||||
# low|high|max. ai&'s deployment differs: live reasoning_effort probe on
|
||||
# 2026-08-29 accepts none|low|xhigh|max (200); rejects minimal|medium|high
|
||||
# with 400 ("Supported values: none, low, xhigh, max"). effort=none returns
|
||||
# no reasoning_content (off); xhigh|max return reasoning_content.
|
||||
base_model = "zhipuai/glm-5.3"
|
||||
|
||||
[[reasoning_options]]
|
||||
type = "effort"
|
||||
values = ["none", "low", "xhigh", "max"]
|
||||
|
||||
[cost]
|
||||
input = 1
|
||||
output = 4
|
||||
cache_read = 0.3
|
||||
|
||||
[limit]
|
||||
context = 1_048_576
|
||||
@@ -1,13 +0,0 @@
|
||||
# Toggle: enable_thinking = true|false
|
||||
# Effort: reasoning_effort = low|high|max
|
||||
# AIHubMix effort levels returned HTTP 200 (validated 2026-08-31T04:17:24Z).
|
||||
base_model = "deepseek/deepseek-v4-flash-0731"
|
||||
reasoning_options = [{ type = "toggle" }, { type = "effort", values = ["low", "high", "max"] }]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.142
|
||||
output = 0.284
|
||||
cache_read = 0.0284
|
||||
@@ -1,13 +0,0 @@
|
||||
# Toggle: enable_thinking = true|false
|
||||
# Effort: reasoning_effort = high|max
|
||||
# AIHubMix effort levels returned HTTP 200 (validated 2026-08-31T04:17:24Z).
|
||||
base_model = "deepseek/deepseek-v4-pro-0813"
|
||||
reasoning_options = [{ type = "toggle" }, { type = "effort", values = ["high", "max"] }]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.6918
|
||||
output = 2.0754
|
||||
cache_read = 0.023058
|
||||
@@ -1,17 +0,0 @@
|
||||
base_model = "zhipuai/glm-5.3-flash"
|
||||
reasoning_options = [{ type = "effort", values = ["low", "high", "max"] }]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.11268
|
||||
output = 0.39438
|
||||
cache_read = 0.02817
|
||||
|
||||
[limit]
|
||||
output = 128_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
output = ["text"]
|
||||
@@ -1,13 +0,0 @@
|
||||
base_model = "zhipuai/glm-5.3"
|
||||
reasoning_options = [{ type = "effort", values = ["low", "high", "max"] }]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 1.1268
|
||||
output = 3.9438
|
||||
cache_read = 0.2817
|
||||
|
||||
[limit]
|
||||
output = 128_000
|
||||
@@ -1,7 +0,0 @@
|
||||
base_model = "xai/grok-4.6"
|
||||
reasoning_options = [{ type = "effort", values = ["low", "medium", "high", "xhigh"] }]
|
||||
|
||||
[cost]
|
||||
input = 2
|
||||
output = 6
|
||||
cache_read = 0.5
|
||||
@@ -1,22 +0,0 @@
|
||||
# Toggle: enable_thinking = true|false
|
||||
# Budget: thinking_budget = integer reasoning tokens
|
||||
base_model = "alibaba/qwen3.7-flash"
|
||||
attachment = false
|
||||
reasoning_options = [{ type = "toggle" }, { type = "budget_tokens", max = 262_144 }]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.0282
|
||||
output = 0.1128
|
||||
cache_read = 0.00564
|
||||
cache_write = 0.03525
|
||||
|
||||
[limit]
|
||||
context = 991_000
|
||||
output = 64_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -1,21 +0,0 @@
|
||||
# AIHubMix Models API reports text,image input (queried 2026-08-31T04:06:29Z).
|
||||
# OpenAI-compatible HTTPS image input returned HTTP 200 (validated 2026-08-31T04:08:19Z).
|
||||
base_model = "alibaba/qwen3.8-2.4t-a95b"
|
||||
attachment = true
|
||||
reasoning_options = [{ type = "effort", values = ["low", "medium", "xhigh"] }]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 2
|
||||
output = 6
|
||||
cache_read = 0.5
|
||||
|
||||
[limit]
|
||||
context = 262_000
|
||||
output = 262_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
Loaded 100 of 2113 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user