Skip to content
PluginStats

ai-gateway-proxy weekly downloads statistics

By sferarc · npm · AI SDKs

Forwards AI SDK gateway calls to the Vercel AI Gateway, with API key or Vercel OIDC authentication and request hooks

View on npm Fresh · Nov 6, 2026

ai-gateway-proxy has 3,117 recorded weekly downloads on npm, ranking #1399 of 2,865 tracked listings.

Weekly downloads
3,117
Official API · Nov 4, 2026
7-day growth
—
Insufficient history
30-day growth
—
Insufficient history
90-day growth
—
Insufficient history
Rank
#1399
Among tracked npm listings

About ai-gateway-proxy

ai-gateway-proxy

For apps whose AI SDK code runs where a Vercel AI Gateway key must not live: a browser, a mobile or desktop app, or code a third party runs. The client calls a route in your app, and ai-gateway-proxy forwards the call to the gateway from your server.

  • The gateway credential stays on the server: the proxy authenticates with an API key or Vercel OIDC and never sends it to the client (Authentication).
  • You decide who may call: your route can check the caller's session or token before handing the call to the proxy (Protecting the route).
  • Each call can be capped, metered, rewritten or refused: beforeRequest, afterResponse and onError handle language model calls, and beforeRawRequest and afterRawResponse the other calls (embedding, image, video, speech, transcription, reranking, decision, batch start) (Example: cap, meter and mask, Refusing a call, Raw hooks).
  • Streams are forwarded as they arrive: each SSE event reaches the client as the gateway sends it, and afterResponse gets the aggregated result when the stream finishes (afterResponse).

The handler takes a Fetch Request and returns a Response, so it plugs into Next.js, Hono, SvelteKit, Astro and React Router directly, into Nuxt through h3's toWebRequest, and into Express or node:http through a small adapter (Quick Start).

When you do not need it

If every model call already runs on your own server, such as in a route handler, a server action or a background job, call the gateway there with the AI SDK's AI Gateway provider and skip the proxy. That provider reads AI_GATEWAY_API_KEY or the Vercel OIDC token on the server itself, so the key never leaves it, and any check or metering is your own code around generateText or streamText.

The proxy is for the other cases: a client that must not hold the key, or calls from several clients that you want to check, cap or meter in one place.

It does not carry every gateway call either. Streaming speech, streaming transcription and realtime open WebSockets, which the HTTP-only handler cannot carry, and the credits, spend report, generation info and getToken calls go to your app's origin instead of the route (Protecting the route lists each one).

Installation

npm install ai-gateway-proxy

To have a coding agent set it up, install the agent skill with npx skills add sferarc/ai-gateway-proxy. It covers when the proxy is needed, the route per framework, the client, protecting the route and metering, without loading this README.

Quick Start

Next.js App Router

Create a catch-all route at app/api/ai/[...segments]/route.ts:

import { createGatewayProxy } from "ai-gateway-proxy";

export const { GET, POST, PUT, DELETE, PATCH } = createGatewayProxy();

The handler reads the path from the route's segments param. For a differently named catch-all, such as app/api/ai/[...path]/route.ts, pass createGatewayProxy({ segmentsParam: "path" }).

examples/nextjs is a runnable App Router app built on this route: it checks the caller as in Protecting the route, caps each caller's output tokens with beforeRequest, charging the cap until afterResponse reports the usage so a cancelled stream still counts, and streams from the browser with streamText.

Hono

For frameworks without catch-all route params, use the extractPath option:

import { Hono } from "hono";
import { createGatewayProxy } from "ai-gateway-proxy";

const app = new Hono();

const proxy = createGatewayProxy({
  extractPath: (request) => {
    const url = new URL(request.url);
    return url.pathname.replace(/^\/api\/ai\//, "");
  },
});

app.all("/api/ai/*", (c) => proxy(c.req.raw));
SvelteKit

Create a rest route at src/routes/api/ai/[...path]/+server.ts. SvelteKit passes params.path as one string such as language-model, which segmentsParam reads once the params are wrapped in a promise:

import { createGatewayProxy } from "ai-gateway-proxy";
import type { RequestHandler } from "./$types";

const proxy = createGatewayProxy({ segmentsParam: "path" });

export const fallback: RequestHandler = ({ request, params }) =>
  proxy(request, { params: Promise.resolve(params) });

fallback answers every method the file does not export a handler for, so the POST model calls and the GET reads such as getAvailableModels both reach the proxy.

Astro

Create a rest route at src/pages/api/ai/[...path].ts. Astro also passes params.path as one string:

import type { APIRoute } from "astro";
import { createGatewayProxy } from "ai-gateway-proxy";

export const prerender = false;

const proxy = createGatewayProxy({ segmentsParam: "path" });

export const ALL: APIRoute = ({ request, params }) =>
  proxy(request, { params: Promise.resolve(params) });

The route runs on demand, so the project needs a server adapter. prerender = false keeps it from being built as a static file under the default static output; with output: "server" it can go.

React Router

In React Router framework mode, a route module that exports loader and action and no component answers requests directly. Create app/routes/ai-proxy.ts:

import { createGatewayProxy } from "ai-gateway-proxy";
import type { Route } from "./+types/ai-proxy";

const proxy = createGatewayProxy({ segmentsParam: "*" });

export const loader = ({ request, params }: Route.LoaderArgs) =>
  proxy(request, { params: Promise.resolve(params) });…

Description from the npm listing.

  • ai
  • ai-sdk
  • ai-gateway
  • vercel
  • proxy
  • oidc
  • vercel-ai-gateway
  • nextjs
  • hono
  • sveltekit
  • astro
  • react-router
  • nuxt
  • express
  • route-handler
  • streaming
  • llm
  • metering
  • hooks

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

ai-gateway-proxy weekly downloads on npm, last 90 days: 3,117 weekly downloads as of Nov 4, 2026.ai-gateway-proxyWeekly downloads on npm · Last 90 days3,117downloads / week2.8K2.9K3K3.1K3.2K3.3K3.4K3.5KAug 6Aug 21Sep 5Sep 20Oct 5Oct 20Nov 4downloads / weekNov 4, 2026 – Nov 4, 2026 · 1 observations · Updated Nov 4, 2026pluginstats.com
ai-gateway-proxy weekly downloads on npm, last 90 days: 3,117 weekly downloads as of Nov 4, 2026.

7/30/90-day growth

ai-gateway-proxy weekly downloads growth on npm: 7-day growth unavailable, 30-day growth unavailable, 90-day growth unavailable.ai-gateway-proxyWeekly downloads growth on npm3,117downloads / week now7-day growthinsufficient historyInsufficient history30-day growthinsufficient historyInsufficient history90-day growthinsufficient historyInsufficient historyGrowth vs. nearest observation to each baseline date · Updated Nov 4, 2026pluginstats.com
ai-gateway-proxy weekly downloads growth on npm: 7-day growth unavailable, 30-day growth unavailable, 90-day growth unavailable.

Ranking history

ai-gateway-proxy npm ranking history: currently #1399 (by weekly downloads).ai-gateway-proxynpm ranking · by weekly downloads · Last 90 days#1399current rank#1397#1398#1399#1400#1401Aug 8Aug 23Sep 7Sep 22Oct 7Oct 22Nov 6rankNov 6, 2026 – Nov 6, 2026 · 1 observations · Updated Nov 4, 2026pluginstats.com
ai-gateway-proxy npm ranking history: currently #1399 (by weekly downloads).

Listing placement

All npm2,864 listings · 144 pages · 1,433 shown · page 79, #9 (overall #1,569)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs316 listings · 16 pages · page 7, #7 (overall #127)
AI SDKs: every listing in weekly downloads order

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 (1)
Recent weekly downloads observations for ai-gateway-proxy
Date (UTC)Weekly downloadsChange vs. previous
3,117—

Similar npm AI SDKs plugins

All 20 ai-gateway-proxy alternatives

Data 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/ai-gateway-proxy. First seen Nov 6, 2026; last successful collection Nov 6, 2026. See the methodology.