Packages

@ai-sdk/gateway

4.0.150 · 18 Nov 2026Apache-2.047.3M / weekRepositoryHomepagenpmAtom feed

Your version

4.0.0

major25 Jun 2026Where it was published

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 using require() must switch to ESM import syntax.

  • 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 using require() must switch to ESM import syntax.

  • 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-max model ID to Alibaba and AI Gateway.

  • provider/anthropic: Add support for claude-opus-4-8

  • Feat (provider/gateway): add sort options

  • Feat (provider/gateway): add get-generation support

  • gateway: Enable retry support for gateway errors

  • Bump @vercel/oidc dependency to 3.2.0

  • provider/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 forbidden error responses to GatewayForbiddenError instead of GatewayInternalServerError

  • gateway: 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's POST /v1/realtime/client-secrets
    endpoint instead of returning the long-lived Gateway credential. The customer's
    server calls getToken() and hands the returned token to the browser, which
    opens the realtime WebSocket with it through the existing
    ai-gateway-auth.<token> subprotocol — the API key / OIDC token never reaches
    the client. expiresAfterSeconds is forwarded to the mint endpoint and the
    returned expiresAt is 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, so GatewayRealtimeModel
    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 browser WebSocket API
    cannot set request headers, the Gateway auth token is carried via the
    Sec-WebSocket-Protocol subprotocol (the same workaround used for OpenAI) and
    the model id rides the ?ai-model-id= query — the WS transport of the
    ai-model-id header used by the HTTP routes. The model id is passed through
    verbatim; the Gateway owns resolution. Provider options (including BYOK) flow
    through the normalized session.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) and getGatewayRealtimeAuthToken (server decode), plus the
    GATEWAY_REALTIME_SUBPROTOCOL / GATEWAY_AUTH_SUBPROTOCOL_PREFIX constants.

    GatewayProviderOptions documents 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' to GatewayProviderOptions.

  • provider/gateway: Add optional Vercel team scoping for Gateway authentication. The existing apiKey option 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-preview and fix multimodal embedding support with embedMany

  • Feat (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() and reranking() methods

  • Fix (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-flash

  • gateway: base64-encode inline Uint8Array data on reasoning-file and tool-result file parts

  • Trigger initial beta release

  • provider/anthropic: Add support for claude-fable-5 and the fallbacks API parameter

  • gateway: Add GatewayFailedDependencyError (424)

  • Feat (video): add first-class generateAudio call option

  • Add workflow serialization support to all provider models.

    @ai-sdk/provider-utils: New serializeModel() 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: headers is now optional in provider config types. This is non-breaking — existing code that passes headers continues to work. Custom provider implementations that construct model configs manually can now omit headers, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.

    All provider model classes now include WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE static 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.