@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
37 lines • 1.5 kB
TypeScript
export interface CreateOpenAIWebSocketFetchOptions {
/**
* WebSocket endpoint URL.
* @default 'wss://api.openai.com/v1/responses'
*/
url?: string;
/**
* Additional headers sent when establishing the WebSocket connection.
* Authorization and OpenAI-Beta are managed internally.
*/
headers?: Record<string, string>;
/**
* Convert an `api-key` request header into `Authorization: Bearer ...` for
* providers whose WebSocket endpoint authenticates API keys as bearer tokens.
*/
apiKeyAsBearer?: boolean;
/**
* Move an `api-key` request header into the WebSocket URL query string for
* providers whose WebSocket endpoint authenticates API keys through a query
* parameter. Entra ID and OpenAI bearer-token auth should leave this disabled.
*/
apiKeyQueryParam?: string | false;
/**
* Optional beta header sent when establishing the WebSocket connection.
* @default 'responses_websockets=2026-02-06'
*/
betaHeader?: string | false;
}
export type OpenAIWebSocketFetch = ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) & {
close(): void;
};
/**
* Creates a `fetch` function that routes OpenAI Responses API streaming
* requests through a persistent WebSocket connection instead of HTTP.
*/
export declare function createOpenAIWebSocketFetch(options?: CreateOpenAIWebSocketFetchOptions): OpenAIWebSocketFetch;
//# sourceMappingURL=openai-websocket-fetch.d.ts.map