Repository navigation
Use Vercel AI Gateway with a free model as the default LLM provider - #4
Merged
Merged
Conversation
- Add a "gateway" provider (createGateway from the ai package), checked first when auto-detecting. It authenticates with AI_GATEWAY_API_KEY or, on Vercel deployments, the injected VERCEL_OIDC_TOKEN. - Default model: nvidia/nemotron-3.5-lightning-free (free, tool calling). - OpenAI, Anthropic, Google and OpenAI-compatible stay available via LLM_PROVIDER and their keys; LLM_MODEL overrides any default. - Add resolveModelConfig tests and update .env.example, README and CONTRIBUTING.
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.
What does this PR do?
Makes the Vercel AI Gateway the default LLM provider, using the free
nvidia/nemotron-3.5-lightning-freemodel (served free by NVIDIA, supports tool calling). It authenticates withAI_GATEWAY_API_KEY, or on Vercel deployments with the injectedVERCEL_OIDC_TOKEN, so no key is needed there.OpenAI, Anthropic, Google and OpenAI-compatible providers remain available through
LLM_PROVIDERand their keys. WhenLLM_PROVIDERis unset, the provider is auto-detected from the keys present, gateway first.LLM_MODELoverrides the default model for any provider (e.g.reflection/beam-freeon the gateway).Type of change
How was it tested?
pnpm lint,pnpm typecheck,pnpm testandpnpm buildpass locallypnpm dev) on Ethereum Sepolia — not done: the gateway host isn't reachable from the environment this was built in, so a live chat against the gateway still needs a manual checksrc/lib/(tests/model.test.ts, 9 cases forresolveModelConfig)Screenshots
Not relevant (no UI changes).
Safety checklist (if this touches transactions or tools)
AI_GATEWAY_API_KEYis server-side only;/api/statusstill returns only provider and model names)