@tanstack/ai-llmgateway has 325 recorded weekly downloads on npm, a decrease of 45.9% over the past 30 days, ranking #2362 of 3,247 tracked listings.
About @tanstack/ai-llmgateway
@tanstack/ai-llmgateway
LLM Gateway adapter for TanStack AI — one OpenAI-compatible endpoint that routes chat, tool calling, and structured outputs to hundreds of models across many providers.
Installation
npm install @tanstack/ai-llmgateway
# or
pnpm add @tanstack/ai-llmgateway
# or
yarn add @tanstack/ai-llmgateway
Setup
Get your API key from the LLM Gateway dashboard and set it as an environment variable:
export LLM_GATEWAY_API_KEY="llmgtwy_..."
Usage
Text/Chat Adapter
import { llmGatewayText } from '@tanstack/ai-llmgateway'
import { chat } from '@tanstack/ai'
const stream = chat({
adapter: llmGatewayText('gpt-5.6-terra'),
messages: [
{ role: 'user', content: 'Explain quantum computing in simple terms' },
],
threadId: 'thread-1',
})
With Explicit API Key
import { createLLMGatewayText } from '@tanstack/ai-llmgateway'
const adapter = createLLMGatewayText('gpt-5.6-terra', 'llmgtwy_api_key')
Self-Hosted Gateways
LLM Gateway is open source and self-hostable — point baseURL at your own deployment:
import { createLLMGatewayText } from '@tanstack/ai-llmgateway'
const adapter = createLLMGatewayText('gpt-5.6-terra', 'llmgtwy_api_key', {
baseURL: 'https://gateway.example.com/v1',
})
Models
Any model listed on llmgateway.io/models works — pass its id as the model name. A curated set of flagship models additionally carries per-model type metadata (input modalities, provider options) with autocomplete, including gpt-5.6-terra, claude-sonnet-5, gemini-pro-latest, kimi-k3, glm-5.2, deepseek-v4-pro, and more (see LLMGATEWAY_CHAT_MODELS).
Model ids accept an optional provider/ prefix to pin routing to a specific provider:
import { llmGatewayText } from '@tanstack/ai-llmgateway'
llmGatewayText('kimi-k3') // gateway picks the best available provider
llmGatewayText('moonshot/kimi-k3') // always routed to Moonshot
Features
- ✅ Streaming chat completions
- ✅ Structured output (JSON Schema)
- ✅ Function/tool calling
- ✅ Multimodal input (text + images for vision models)
- ✅ Reasoning output (
reasoning_contentdeltas from reasoning models) - ✅ Summarization (
llmGatewaySummarize)
Tree-Shakeable Adapters
This package uses tree-shakeable adapters, so you only import what you need:
// Text/chat only
import { llmGatewayText } from '@tanstack/ai-llmgateway'
// Summarization only
import { llmGatewaySummarize } from '@tanstack/ai-llmgateway'
Documentation
Description from the npm listing.
- ai
- ai-sdk
- typescript
- tanstack
- llmgateway
- llm-gateway
- adapter
- llm
- gateway
- chat
- streaming
- tool-calling
- structured-outputs
- model-router
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm AI SDKs plugins
All 20 @tanstack/ai-llmgateway alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@tanstack/ai-llmgateway. First seen Oct 16, 2026; last successful collection Nov 18, 2026. See the methodology.