Replace hardcoded model lists with dynamic gateway fetch#48
Merged
Conversation
Fetch the raw AI Gateway API directly to get model type and tags, eliminating all static FALLBACK_*_MODELS arrays. Language models with the "image-generation" tag (e.g. Gemini image models) are now automatically detected and routed through generateText instead of generateImage. Short-name expansion also uses the live model list.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Remove references to built-in fallback lists and update gateway unreachable behavior in docs. Update landing page copy to reflect live model discovery.
When piping an image via stdin to a language-based image model (e.g. Gemini), the image data was silently discarded. Now uses the messages format to include both image and text content.
- Cache gateway fetch with module-level promise (single fetch per process) - Add 5s timeout to gateway fetch via AbortSignal - Add creator (from owned_by), capabilities, and pricing to ModelEntry - Rename --provider flag to --creator (aligns with AI Gateway's creator/model-name convention, reserves "provider" for future multi-provider support) - Deduplicate --json output: flat array where each model appears once with all capabilities - Fix image.ts prompt assertion to only use ! in safe else branch - Remove no-op ?? undefined in model parsing
… up types - Don't permanently cache failed gateway fetches so retries are possible - Remove no-op ternary in groupByCreator call - Only send Google-specific providerOptions when the model creator is Google - Narrow resolveModels signature to Pick<ModelEntry, "id">[] and remove as-never casts in tests
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/v1/models) instead of maintaining static fallback arrays, so the model list never goes staleimage-generationtag from the gateway to dynamically detect language models that generate images (e.g. Gemini), routing them throughgenerateTextinstead ofgenerateImageflux-2-pro→bfl/flux-2-pro) now resolves against the live model list