import { OpenAIRealtimeWS } from 'openai/realtime/ws'; import type { SapOpenAiRealtimeInput } from './types.ts'; /** * Rewrites a realtime WebSocket URL for SAP AI Core compatibility. * * Ensures the path ends in `/v1/realtime` and strips all query params except * `api-version` (unsupported params like `deployment=` are forwarded by ws-proxy to * Azure upstream and can cause connection failures). * @param url - The URL to rewrite in place. * @returns The rewritten URL. * @throws If the URL path does not end in `/realtime`. * @internal */ export declare function rewriteRealtimeUrl(url: URL): URL; /** * A pre-configured OpenAI Realtime API (speech-to-speech) client for SAP AI Core. * * Only `gpt-realtime` is supported. Session configuration must use the GA `session.update` schema * (`output_modalities`, nested `audio`), not the preview schema. * * Use {@link SapOpenAiRealtimeWs.createClient} to create an instance. * @experimental This class is experimental and may change at any time without prior notice. */ export declare class SapOpenAiRealtimeWs extends OpenAIRealtimeWS { static readonly create: never; static readonly azure: never; private _url; /** * @param context - The SAP OpenAI context. * @param options - The realtime input options. * @returns The WebSocket client options. */ private static buildWsOptions; /** * Creates a pre-configured {@link SapOpenAiRealtimeWs} client and opens the WebSocket connection to SAP AI Core. * Resolves the deployment, fetches a bearer token, and sets the SAP-specific headers automatically. * @param options - Options including model deployment, destination, and client type. A plain model name string is accepted as shorthand for `{ deployment: modelName }`. * @returns A promise that resolves to a connected {@link SapOpenAiRealtimeWs} instance. * @example * ```ts * import { SapOpenAiRealtimeWs } from '@sap-ai-sdk/openai/realtime'; * * const client = await SapOpenAiRealtimeWs.createClient('gpt-realtime'); * client.on('session.created', () => { * client.send({ * type: 'session.update', * session: { type: 'realtime', output_modalities: ['audio'] } * }); * }); * ``` */ static createClient(options: SapOpenAiRealtimeInput): Promise; } //# sourceMappingURL=realtime-client.d.ts.map