@ai-sdk/gateway
4.0.150 · 18 Nov 2026Apache-2.047.3M / weekRepositoryHomepagenpmAtom feed
4.0.152 is the newest release of 4.x.
In short
4 breaking16 new22 fixed6 internal
- Breaking
Remove CommonJS exports from all packages. All packages are now ESM-only (
"type": "module"). Consumers usingrequire()must switch to ESMimportsyntax. - Breaking
Start v7 pre-release
- Breaking
Make provider implementations code patterns more consistent, including renaming certain exported symbols
- Breaking
Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
Release note
Major Changes
- Breaking
Remove CommonJS exports from all packages. All packages are now ESM-only (
"type": "module"). Consumers usingrequire()must switch to ESMimportsyntax. - Breaking
Start v7 pre-release
- Breaking
Make provider implementations code patterns more consistent, including renaming certain exported symbols
For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
Patch Changes
Add
qwen3.7-maxmodel ID to Alibaba and AI Gateway.provider/anthropic: Add support for
claude-opus-4-8Feat (provider/gateway): add sort options
Feat (provider/gateway): add get-generation support
gateway: Enable retry support for gateway errors
Bump
@vercel/oidcdependency to 3.2.0provider/openai: Add GPT-5.4 model support
Feat (provider/gateway): add disallowPromptTraining gateway provider option
gateway: Surface provider warnings in embedding and reranking responses
Feat (provider/gateway): add Exa search tool support
Fix (provider/gateway): add 'reranking' to modelType validation schema and type so getAvailableModels() accepts reranking models from the gateway API
provider/gateway: Add speech and transcription model support
provider/gateway: Map
forbiddenerror responses to GatewayForbiddenError instead of GatewayInternalServerErrorgateway: Mint short-lived client secrets for experimental realtime
gateway.experimental_realtime.getToken()now mints a single-use, short-lived
client secret (vcst_) via the Gateway'sPOST /v1/realtime/client-secrets
endpoint instead of returning the long-lived Gateway credential. The customer's
server callsgetToken()and hands the returned token to the browser, which
opens the realtime WebSocket with it through the existingai-gateway-auth.<token>subprotocol — the API key / OIDC token never reaches
the client.expiresAfterSecondsis forwarded to the mint endpoint and the
returnedexpiresAtis surfaced on the result.The server-environment guard moves from realtime model construction to minting:
the browser can now build the realtime event codec it needs to drive the
transport, while minting (which requires the Gateway credential) stays
server-side.gateway: Add experimental realtime model support
Adds
gateway.experimental_realtime()for bidirectional audio/text realtime
sessions routed through the AI Gateway. Like every other Gateway modality, the
client speaks the normalized AI SDK realtime protocol and the Gateway
translates to/from the upstream provider server-side, soGatewayRealtimeModel
is a thin identity codec. Gateway realtime is server-side only for v0 and throws
if used in a browser because it returns the resolved Gateway auth token rather
than a minted ephemeral client secret. Because the browserWebSocketAPI
cannot set request headers, the Gateway auth token is carried via theSec-WebSocket-Protocolsubprotocol (the same workaround used for OpenAI) and
the model id rides the?ai-model-id=query — the WS transport of theai-model-idheader used by the HTTP routes. The model id is passed through
verbatim; the Gateway owns resolution. Provider options (including BYOK) flow
through the normalizedsession.update, exactly as they ride the request body
on the non-realtime routes.The versioned subprotocol auth contract is centralized so the client and the
Gateway server share one definition:getGatewayRealtimeProtocols(client
encode) andgetGatewayRealtimeAuthToken(server decode), plus theGATEWAY_REALTIME_SUBPROTOCOL/GATEWAY_AUTH_SUBPROTOCOL_PREFIXconstants.GatewayProviderOptionsdocuments the stable client-facing option fields while
remaining open to service-owned options. Runtime validation lives in the Gateway
service so the server can evolve without requiring an SDK release for every new
option.Add
serviceTier: 'flex' | 'priority'toGatewayProviderOptions.provider/gateway: Add optional Vercel team scoping for Gateway authentication. The existing
apiKeyoption can be used with AI Gateway API keys, Vercel personal access tokens, and Vercel app access tokens.Feat (provider/gateway): add hipaaCompliant gateway provider option
Feat (provider/gateway): add spend reporting support
Trigger release for all packages after provenance setup
provider/google: Add
gemini-embedding-2-previewand fix multimodal embedding support withembedManyFeat (provider/gateway): make model list resilient to unknown model types
gateway: Accept deprecated warnings in image, speech, transcription, and video responses
Feat (provider/gateway): add quotaEntityId gateway provider option
- Breaking
Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
Feat (provider/gateway): add reranking model support with
rerankingModel()andreranking()methodsFix (packages/gateway): clarify sort docs
Trigger initial canary release
gateway: Encode inline v4 file part bytes as { type: 'data' } instead of a data: URL
provider: Change file part data property to be tagged with a type and remove the image part type
provider/google: Add
gemini-3.5-flashgateway: base64-encode inline Uint8Array data on reasoning-file and tool-result file parts
Trigger initial beta release
provider/anthropic: Add support for
claude-fable-5and thefallbacksAPI parametergateway: Add GatewayFailedDependencyError (424)
Feat (video): add first-class
generateAudiocall optionAdd workflow serialization support to all provider models.
@ai-sdk/provider-utils: NewserializeModel()helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.All providers:
headersis now optional in provider config types. This is non-breaking — existing code that passesheaderscontinues to work. Custom provider implementations that construct model configs manually can now omitheaders, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.All provider model classes now include
WORKFLOW_SERIALIZEandWORKFLOW_DESERIALIZEstatic methods, enabling them to cross workflow step boundaries without serialization errors.provider/anthropic: Add support for Opus 4.7 and relevant API enhancements
provider/openai: Add gpt-image-2 model support
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.