Compare commits

..
Author SHA1 Message Date
Aiden Cline ef80d4df4e Infer PDF modality for xAI image models 2026-05-20 18:12:11 -05:00
Aiden Cline af0ef00109 Update xAI Grok PDF modalities 2026-05-20 18:06:33 -05:00
9 changed files with 11 additions and 19 deletions

No files matched your search

-6
View File
@@ -23,10 +23,6 @@ jobs:
title: "chore(sync): update aggregator model catalogs"
branch: automation/sync-models-aggregators
labels: automation,model-sync,sync-group:aggregators,provider:openrouter
- group: cloudflare
title: "chore(sync): update cloudflare model catalogs"
branch: automation/sync-models-cloudflare
labels: automation,model-sync,sync-group:cloudflare,provider:cloudflare-workers-ai
steps:
- name: Checkout code
@@ -46,8 +42,6 @@ jobs:
run: bun models:sync ${{ matrix.group }}
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID }}
CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN }}
- name: Validate models
run: bun validate
@@ -48,12 +48,10 @@ export const cloudflareWorkersAi = {
name: "Cloudflare Workers AI",
modelsDir: "providers/cloudflare-workers-ai/models",
async fetchModels() {
const accountID = process.env.CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID;
const token = process.env.CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN;
const accountID = process.env.CLOUDFLARE_ACCOUNT_ID;
const token = process.env.CLOUDFLARE_API_TOKEN ?? process.env.CLOUDFLARE_API_KEY;
if (accountID === undefined || token === undefined) {
throw new Error(
"Cloudflare Workers AI sync requires CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID and CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN",
);
throw new Error("Cloudflare Workers AI sync requires CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN");
}
const first = await fetchPage(accountID, token, 1);
+1
View File
@@ -128,6 +128,7 @@ function modalities(values: string[] | undefined, fallback: Modality[]) {
const result = (values ?? [])
.map((value) => value.toLowerCase())
.filter((value): value is Modality => allowed.has(value as Modality));
if (result.includes("image")) result.push("pdf");
return [...new Set(result.length > 0 ? result : fallback)];
}
@@ -24,5 +24,5 @@ context = 2_000_000
output = 30_000
[modalities]
input = ["text", "image"]
input = ["text", "image", "pdf"]
output = ["text"]
@@ -24,5 +24,5 @@ context = 2_000_000
output = 30_000
[modalities]
input = ["text", "image"]
input = ["text", "image", "pdf"]
output = ["text"]
@@ -24,5 +24,5 @@ context = 2_000_000
output = 30_000
[modalities]
input = ["text", "image"]
input = ["text", "image", "pdf"]
output = ["text"]
+1 -1
View File
@@ -24,5 +24,5 @@ context = 1_000_000
output = 30_000
[modalities]
input = ["text", "image"]
input = ["text", "image", "pdf"]
output = ["text"]
+1 -1
View File
@@ -19,5 +19,5 @@ context = 256_000
output = 256_000
[modalities]
input = ["text", "image"]
input = ["text", "image", "pdf"]
output = ["text"]
+2 -3
View File
@@ -117,9 +117,8 @@ OpenRouter is implemented in `packages/core/script/sync/openrouter.ts`.
Cloudflare Workers AI is implemented in `packages/core/script/sync/cloudflare-workers-ai.ts`.
- Source endpoint: `https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID/ai/models/search?format=openrouter`.
- Required auth: `CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID` and `CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN`.
- Use a dedicated token scoped to Workers AI read access so sync automation does not share deploy credentials.
- Source endpoint: `https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/models/search?format=openrouter`.
- Required auth: `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` (or `CLOUDFLARE_API_KEY`).
- The endpoint is parsed as Cloudflare's OpenRouter-like Workers AI metadata.
- Model IDs map directly to TOML paths under `providers/cloudflare-workers-ai/models`.
- This sync target does not manage `providers/cloudflare-ai-gateway`, because the AI Gateway `/compat/models` endpoint does not support `format=openrouter` and does not provide enough model metadata for authoritative catalog sync.