Skip to content
Source
Sign inSign up
TanStack/ai

feat(ai, adapters): a ./models catalog in each provider package #1887

Closedtombeckenhamwants to merge 5 commits intomodelschemas-for-updates fromfeat/adapter-model-catalogsopened View on GitHub

Showing 56 changed files with 147 additions and 2 deletions (loading 52).

x
0 of 56 viewed, 56 left
20 additions and 0 deletions.changeset/provider-model-catalogs.mdAdded
View file
@@ -0,0 +1,20 @@
+---
+'@tanstack/ai': minor
+'@tanstack/ai-anthropic': minor
+'@tanstack/ai-bedrock': minor
+'@tanstack/ai-cloudflare': minor
+'@tanstack/ai-gemini': minor
+'@tanstack/ai-grok': minor
+'@tanstack/ai-groq': minor
+'@tanstack/ai-mistral': minor
+'@tanstack/ai-openai': minor
+'@tanstack/ai-openrouter': minor
+'@tanstack/ai-vercel-gateway': minor
+'@tanstack/ai-vertex': minor
+---
+​
+Each provider package exports its model catalog at `./models`, for example `import { models } from '@tanstack/ai-anthropic/models'`. A record has the model's `id`, `name`, `input` modalities, `contextWindow`, `maxOutputTokens`, `prices`, and `reasoning` levels. `@tanstack/ai-openai` also exports `./azure-models`, and `@tanstack/ai-cloudflare` also exports `./gateway-models`.
+​
+`@tanstack/ai` adds the `ModelRecord` type and `modelCost(model, usage)`. `modelCost` prices one call from its `TokenUsage`, with long-context tiers and 1-hour cache writes. It returns `undefined` when the call used tokens that have no known price.
+​
+The data comes from modelschemas, and a daily job syncs it. A value that modelschemas does not list is `undefined`, never `0`.
12 additions and 2 deletions.github/workflows/sync-models.ymlModified
View file
@@ -54,6 +54,13 @@
env: