Skip to content
Source
Sign inSign up
TanStack/ai

Generate LLM Gateway model meta from its /v1/models catalog in the daily sync #1865

Closedtombeckenham opened this issue 0 comments
tombeckenhamcommented

Problem

@tanstack/ai-llmgateway is the only gateway adapter whose model list is curated by hand. packages/ai-llmgateway/src/model-meta.ts lists 16 models, but LLM Gateway serves about 300. As a result:

  • New models only reach users when someone opens a PR to add them, for example #1836 (MiniMax M3.1 Flash).
  • Prices and limits drift. The file header says "they may drift; the models page is the source of truth".
  • To use any model outside the 16, users must pass the id "with a type assertion".

OpenRouter and Vercel AI Gateway are already generated by the daily sync-models.yml workflow.

Source

LLM Gateway publishes its own catalog at https://api.llmgateway.io/v1/models. It needs no key and returns 298 rows. modelschemas has no llmgateway rows, so this first-party endpoint is the source.

Each row carries everything the hand-written meta holds today. Here is the row for minimax-m3.1-flash:

model-meta fieldcatalog field
context_windowcontext_length (1048576)
max_completion_tokensmax_output (524288)
pricing.input.normal / cachedpricing.prompt / pricing.input_cache_read (per token, ×1e6)
pricing.output.normalpricing.completion
supports.inputarchitecture.input_modalities
features (tools, reasoning, vision, streaming)supported_parameters, providers[].tools / .reasoning / .vision / .streaming
reasoning levelsproviders[].reasoning_efforts (["low","medium","high","xhigh","max"])
json / structured outputjson_output, structured_outputs

Proposal

  1. Add scripts/fetch-llmgateway-models.ts and scripts/convert-llmgateway-models.ts. Model them on the OpenRouter pair, since the row shape is close to OpenRouter's. Run them with node, not tsx.
  2. Generate LLMGATEWAY_CHAT_MODELS, the per-model meta, the input-modality map, the tool-capability map and the reasoning map from the catalog. Delete the hand-written entries.
  3. Skip the custom row. Emit unprefixed ids only. The provider/ prefix keeps working at runtime.
  4. Add the fetch to generate:models:fetch. Add scripts/llmgateway.models.json to the git add list in .github/workflows/sync-models.yml.
  5. Add a unit test for the row → meta mapping, covering pricing scale, reasoning efforts and the skipped custom row.
  6. Changeset: minor for @tanstack/ai-llmgateway. The list grows, which is additive. Update docs/adapters/llmgateway.md so it no longer calls the list curated.

Order

Land this after #1863. This sync runs in the same workflow, so it fails daily until the ElevenLabs fix is in.

Related: #1836, #1863.

  1. AlemTuzlak closed this

Sign in to join this conversation.