🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@ai-sdk/gateway

Package Overview
Dependencies
Maintainers
3
Versions
573
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/gateway - npm Package Compare versions

Comparing version
4.0.20
to
4.0.21
+32
-1
dist/index.d.ts

@@ -5,3 +5,3 @@ import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, Experimental_RealtimeFactoryV4, TypeValidationError } from '@ai-sdk/provider';

type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-spark-1.1' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.7-fast' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-spark-1.1' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});

@@ -753,2 +753,9 @@ /**

/**
* Experimental streaming-transcription entry point. Callable like
* `transcription(modelId)`, plus `getToken` for minting a short-lived
* client secret (`vcst_`) a browser can use to open the streaming
* transcription WebSocket without holding the Gateway credential.
*/
experimental_transcription: GatewayTranscriptionFactory;
/**
* Gateway-specific tools executed server-side.

@@ -758,2 +765,26 @@ */

}
type GatewayTranscriptionFactoryGetTokenOptions = {
model: GatewayTranscriptionModelId;
/** Token lifetime in seconds. Gateway default is 60s (max 300s). */
expiresAfterSeconds?: number;
};
type GatewayTranscriptionFactoryGetTokenResult = {
/** The minted `vcst_` client secret. */
token: string;
/** WebSocket URL of the streaming transcription surface for this model. */
url: string;
/** Token expiry, epoch seconds. */
expiresAt?: number;
};
/**
* Streaming-transcription factory: callable like `transcription(modelId)`,
* plus a server-side `getToken` that mints a transcription-bound short-lived
* client secret (`vcst_`). The browser connects with
* `createGateway({ apiKey: token }).transcription(modelId)` — the token rides
* the same auth subprotocol an API key does, without exposing the credential.
*/
interface GatewayTranscriptionFactory {
(modelId: GatewayTranscriptionModelId): TranscriptionModelV4;
getToken(options: GatewayTranscriptionFactoryGetTokenOptions): Promise<GatewayTranscriptionFactoryGetTokenResult>;
}
interface GatewayProviderSettings {

@@ -760,0 +791,0 @@ /**

+1
-1
{
"name": "@ai-sdk/gateway",
"private": false,
"version": "4.0.20",
"version": "4.0.21",
"type": "module",

@@ -6,0 +6,0 @@ "license": "Apache-2.0",

@@ -38,3 +38,5 @@ export type GatewayModelId =

| 'anthropic/claude-opus-4.7'
| 'anthropic/claude-opus-4.7-fast'
| 'anthropic/claude-opus-4.8'
| 'anthropic/claude-opus-4.8-fast'
| 'anthropic/claude-sonnet-4'

@@ -41,0 +43,0 @@ | 'anthropic/claude-sonnet-4.5'

@@ -39,3 +39,6 @@ import {

import { GatewaySpeechModel } from './gateway-speech-model';
import { GatewayTranscriptionModel } from './gateway-transcription-model';
import {
GatewayTranscriptionModel,
toGatewayTranscriptionUrl,
} from './gateway-transcription-model';
import { GatewayRealtimeModel } from './gateway-realtime-model';

@@ -179,2 +182,10 @@ import type { GatewayEmbeddingModelId } from './gateway-embedding-model-settings';

/**
* Experimental streaming-transcription entry point. Callable like
* `transcription(modelId)`, plus `getToken` for minting a short-lived
* client secret (`vcst_`) a browser can use to open the streaming
* transcription WebSocket without holding the Gateway credential.
*/
experimental_transcription: GatewayTranscriptionFactory;
/**
* Gateway-specific tools executed server-side.

@@ -185,2 +196,32 @@ */

export type GatewayTranscriptionFactoryGetTokenOptions = {
model: GatewayTranscriptionModelId;
/** Token lifetime in seconds. Gateway default is 60s (max 300s). */
expiresAfterSeconds?: number;
};
export type GatewayTranscriptionFactoryGetTokenResult = {
/** The minted `vcst_` client secret. */
token: string;
/** WebSocket URL of the streaming transcription surface for this model. */
url: string;
/** Token expiry, epoch seconds. */
expiresAt?: number;
};
/**
* Streaming-transcription factory: callable like `transcription(modelId)`,
* plus a server-side `getToken` that mints a transcription-bound short-lived
* client secret (`vcst_`). The browser connects with
* `createGateway({ apiKey: token }).transcription(modelId)` — the token rides
* the same auth subprotocol an API key does, without exposing the credential.
*/
export interface GatewayTranscriptionFactory {
(modelId: GatewayTranscriptionModelId): TranscriptionModelV4;
getToken(
options: GatewayTranscriptionFactoryGetTokenOptions,
): Promise<GatewayTranscriptionFactoryGetTokenResult>;
}
export interface GatewayProviderSettings {

@@ -303,3 +344,3 @@ /**

// Mints a short-lived realtime client secret (`vcst_`) via the Gateway's
// Mints a short-lived client secret (`vcst_`) via the Gateway's
// `/v1/realtime/client-secrets` route, authenticated with the long-lived

@@ -309,9 +350,12 @@ // Gateway credential. Server-side only (asserted) — the credential never

// mint route lives at the gateway origin's `/v1/realtime/client-secrets`,
// not under the realtime `baseURL` path (which targets `/v4/ai`), so the
// URL is resolved against the origin.
const mintRealtimeClientSecret = async (params: {
// not under the `baseURL` path (which targets `/v4/ai`), so the URL is
// resolved against the origin. `routeKind` binds the token to a WebSocket
// surface; it is omitted for realtime (the gateway default) so older
// gateway deployments keep accepting realtime mints.
const mintClientSecret = async (params: {
modelId: string;
expiresAfterSeconds?: number;
routeKind?: 'transcription';
}): Promise<{ token: string; expiresAt?: number }> => {
assertGatewayRealtimeServerEnvironment();
assertGatewayClientSecretServerEnvironment();
const auth = await getRealtimeAuthToken();

@@ -326,2 +370,3 @@ const headers = createAuthHeaders(auth);

model: params.modelId,
...(params.routeKind != null && { routeKind: params.routeKind }),
...(params.expiresAfterSeconds != null && {

@@ -539,2 +584,26 @@ expiresIn: params.expiresAfterSeconds,

provider.transcription = createTranscriptionModel;
// Callable like `transcription(modelId)`; `getToken` mints a
// transcription-bound client secret (server-side only) the browser uses to
// connect via `createGateway({ apiKey: token }).transcription(modelId)`.
provider.experimental_transcription = Object.assign(
(modelId: GatewayTranscriptionModelId) => createTranscriptionModel(modelId),
{
getToken: async (
tokenOptions: GatewayTranscriptionFactoryGetTokenOptions,
): Promise<GatewayTranscriptionFactoryGetTokenResult> => {
const secret = await mintClientSecret({
modelId: tokenOptions.model,
routeKind: 'transcription',
...(tokenOptions.expiresAfterSeconds != null && {
expiresAfterSeconds: tokenOptions.expiresAfterSeconds,
}),
});
return {
token: secret.token,
url: toGatewayTranscriptionUrl(baseURL, tokenOptions.model),
...(secret.expiresAt != null && { expiresAt: secret.expiresAt }),
};
},
},
) as GatewayTranscriptionFactory;

@@ -544,4 +613,4 @@ // No server-environment guard here: building the realtime model is just the

// needs to drive the transport with a server-minted client secret. The
// server-only boundary is enforced on minting itself
// (`mintRealtimeClientSecret`), which requires the Gateway credential.
// server-only boundary is enforced on minting itself (`mintClientSecret`),
// which requires the Gateway credential.
const createRealtimeModel = (modelId: GatewayRealtimeModelId) =>

@@ -552,3 +621,3 @@ new GatewayRealtimeModel(modelId, {

teamIdOrSlug: options.teamIdOrSlug,
createClientSecret: mintRealtimeClientSecret,
createClientSecret: mintClientSecret,
});

@@ -603,8 +672,8 @@ provider.experimental_realtime = Object.assign(

function assertGatewayRealtimeServerEnvironment(): void {
function assertGatewayClientSecretServerEnvironment(): void {
if (typeof globalThis.window !== 'undefined') {
throw new Error(
'AI Gateway realtime client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() from your server and pass the returned token to the client.',
'AI Gateway client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() or gateway.experimental_transcription.getToken() from your server and pass the returned token to the client.',
);
}
}

@@ -184,3 +184,6 @@ import {

*/
function toGatewayTranscriptionUrl(baseURL: string, modelId: string): string {
export function toGatewayTranscriptionUrl(
baseURL: string,
modelId: string,
): string {
const url = new URL(`${baseURL.replace(/^http/, 'ws')}/transcription-model`);

@@ -187,0 +190,0 @@ url.searchParams.set('ai-model-id', modelId);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display