openai
Version:
The official TypeScript library for the OpenAI API
33 lines • 1.76 kB
TypeScript
import * as WS from 'ws';
import { NodeWebSocket } from "../../internal/ws-adapter-node.js";
import { ResponsesWSBase, type ResponsesWSBaseOptions } from "./ws-base.js";
import { OpenAI } from "../../client.js";
export type { WebSocketStreamOptions } from "../../internal/ws.js";
export type { ResponsesWSReconnectOptions } from "./ws-base.js";
/**
* Native Node WebSocket options.
*
* `maxPayload` defaults to 0 (unlimited). Set a byte limit supported by `ws` to cap incoming messages.
* `perMessageDeflate` defaults to false, including with a finite payload limit.
* Set it to true or a `ws` configuration object to enable compression.
*/
export interface ResponsesWSClientOptions extends WS.ClientOptions, ResponsesWSBaseOptions {
/** Basic authentication forwarded by the Node `ws` transport. */
auth?: string;
}
export declare class ResponsesWS extends ResponsesWSBase<NodeWebSocket> {
private _wsOptions;
private _credentials;
constructor(client: OpenAI, options?: ResponsesWSClientOptions | null | undefined);
protected _authHeaders(apiKey?: string | null): Record<string, string>;
/**
* Whether credentials passed to the Node transport use the SDK key.
* The SDK recognizes its key, including copies and additions in credential headers.
* Override and return true if your socket hook signs or otherwise irreversibly transforms it.
* Explicit caller options and header removals still take precedence on reconnect.
*/
protected _usesSDKAPIKey(authHeaders: Record<string, string>): boolean;
protected _createSocket(url: URL, authHeaders: Record<string, string>): NodeWebSocket;
protected _prepareReconnectSocket(): Promise<(url: URL) => NodeWebSocket>;
}
//# sourceMappingURL=ws.d.ts.map