Generate LLM Gateway model meta from its /v1/models catalog in the daily sync #1865
Closed
tombeckenham opened this issue ·0 comments
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 field | catalog field |
|---|---|
context_window | context_length (1048576) |
max_completion_tokens | max_output (524288) |
pricing.input.normal / cached | pricing.prompt / pricing.input_cache_read (per token, ×1e6) |
pricing.output.normal | pricing.completion |
supports.input | architecture.input_modalities |
features (tools, reasoning, vision, streaming) | supported_parameters, providers[].tools / .reasoning / .vision / .streaming |
reasoning levels | providers[].reasoning_efforts (["low","medium","high","xhigh","max"]) |
| json / structured output | json_output, structured_outputs |
Proposal#
- Add
scripts/fetch-llmgateway-models.tsandscripts/convert-llmgateway-models.ts. Model them on the OpenRouter pair, since the row shape is close to OpenRouter's. Run them withnode, nottsx. - 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. - Skip the
customrow. Emit unprefixed ids only. Theprovider/prefix keeps working at runtime. - Add the fetch to
generate:models:fetch. Addscripts/llmgateway.models.jsonto thegit addlist in.github/workflows/sync-models.yml. - Add a unit test for the row → meta mapping, covering pricing scale, reasoning efforts and the skipped
customrow. - Changeset: minor for
@tanstack/ai-llmgateway. The list grows, which is additive. Updatedocs/adapters/llmgateway.mdso 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.
AlemTuzlak closed this
Sign in to join this conversation.