Skip to content

Use Vercel AI Gateway with a free model as the default LLM provider - #4

Merged
lijnati merged 1 commit into
mainfrom
vercel-ai-gateway-default
Oct 23, 2026
Merged

lijnati merged 1 commit into
mainfrom
vercel-ai-gateway-default

Conversation

@lijnati

@lijnati lijnati commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Makes the Vercel AI Gateway the default LLM provider, using the free nvidia/nemotron-3.5-lightning-free model (served free by NVIDIA, supports tool calling). It authenticates with AI_GATEWAY_API_KEY, or on Vercel deployments with the injected VERCEL_OIDC_TOKEN, so no key is needed there.

OpenAI, Anthropic, Google and OpenAI-compatible providers remain available through LLM_PROVIDER and their keys. When LLM_PROVIDER is unset, the provider is auto-detected from the keys present, gateway first. LLM_MODEL overrides the default model for any provider (e.g. reflection/beam-free on the gateway).

Type of change

  • Bug fix
  • New feature (e.g. a new agent tool or UI)
  • Refactor / cleanup
  • Docs
  • Other:

How was it tested?

  • pnpm lint, pnpm typecheck, pnpm test and pnpm build pass locally
  • Tried it in the browser (pnpm 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 check
  • Added or updated tests for new logic in src/lib/ (tests/model.test.ts, 9 cases for resolveModelConfig)

Screenshots

Not relevant (no UI changes).

Safety checklist (if this touches transactions or tools)

  • No new tool can sign or broadcast transactions
  • The sender still comes from the connected wallet, not from LLM input
  • No API keys or RPC URLs are exposed to the browser or in error messages (AI_GATEWAY_API_KEY is server-side only; /api/status still returns only provider and model names)

- 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.
@lijnati
lijnati merged commit f419f9e into main Oct 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant