/** * OpenAI model provider implementation. * * Supports both the Responses API (default) and the Chat Completions API. * Selected via the `api` option at construction time. * * @see https://platform.openai.com/docs/api-reference/responses * @see https://platform.openai.com/docs/api-reference/chat */ import { Model } from '../model.js'; import type { StreamOptions } from '../model.js'; import type { Message } from '../../types/messages.js'; import type { ModelStreamEvent } from '../streaming.js'; import type { OpenAIApi, OpenAIModelConfig, OpenAIModelOptions } from './types.js'; /** * OpenAI model provider. * * Defaults to the Responses API. Pass `api: 'chat'` to use Chat Completions. * The `api` field is construction-only — it cannot be changed via * {@link OpenAIModel.updateConfig}. * * @example * ```typescript * // Responses API (default) * const model = new OpenAIModel({ modelId: 'gpt-5.4', apiKey: 'sk-...' }) * ``` * * @example * ```typescript * // Chat Completions * const model = new OpenAIModel({ api: 'chat', modelId: 'gpt-5.4', apiKey: 'sk-...' }) * ``` * * @example * ```typescript * // Responses API with built-in web search * const model = new OpenAIModel({ * modelId: 'gpt-5.4', * params: { tools: [{ type: 'web_search' }] }, * }) * ``` */ export declare class OpenAIModel extends Model { private readonly _api; private _config; private _client; constructor(options: OpenAIModelOptions); /** * The OpenAI API mode this model operates in (`'chat'` or `'responses'`). * Set at construction and immutable; exposed for debugging and serialization. */ get api(): OpenAIApi; /** * Whether this model manages conversation state server-side. * * `true` only for `api: 'responses'` with `stateful === true`. Chat Completions * is always stateless, and Responses defaults to stateless. */ get stateful(): boolean; /** * Updates the model configuration. * * `api` and `stateful` are construction-only — if present in `modelConfig`, * they are stripped with a warning. Changing either at runtime would * invalidate the invariants the agent builds on top of `stateful` (message * history management, `previous_response_id` chaining). */ updateConfig(modelConfig: OpenAIModelConfig & { api?: OpenAIApi; }): void; getConfig(): OpenAIModelConfig; stream(messages: Message[], options?: StreamOptions): AsyncIterable; private _streamChat; private _streamResponses; private _rewrapError; } //# sourceMappingURL=model.d.ts.map