import { BaseProvider, type ProviderInfo } from './base.js'; import type { ProviderCallContext } from '../types/lifecycle.js'; import type { CompletionRequest } from '../types/messages.js'; import type { NexusResponse, NexusStream } from '../types/response.js'; import type { OpenAIProviderConfig } from '../types/config.js'; /** OpenAI's Chat Completions API, and any server compatible with it. */ export declare class OpenAIProvider extends BaseProvider { /** Provider name and locality. */ readonly info: ProviderInfo; private client?; private config; constructor(config: OpenAIProviderConfig); private getClient; /** * The conversation in chat form. An assistant turn carries its tool calls, and each result goes * back as a `tool` message under the call's id. The chat API takes only text in a tool message, * so the images, audio, and documents a tool returned follow the run of tool messages as one user * message. Chat completions takes audio only on its audio models, such as `gpt-4o-audio-preview` * and `gpt-audio`, so audio goes as audio only to a model named for it; any other model gets its * transcript or a placeholder. */ private formatMessages; private formatContentPart; /** Runs one completion. */ complete(request: CompletionRequest, context?: ProviderCallContext): Promise; /** Streams one completion. */ stream(request: CompletionRequest, context?: ProviderCallContext): NexusStream; private createChatParams; /** * Whether the server reports token log probabilities, so a request that asks for them sends * `logprobs`. Groq and Mistral refuse the option, so it is not sent to them; a model that cannot * report them is told so by declaring `logprobs: false`. */ protected reportsLogprobs(): boolean; /** * Whether to ask for usage totals on the final streamed chunk. * * Enabled for OpenAI and Azure by default, where `stream_options` is part of the API. Other * OpenAI-compatible servers vary, so they opt in through `streamUsage` rather than risking a * rejected request. */ protected includeStreamUsage(): boolean; private mapFinishReason; private completeResponses; private streamResponses; private createResponsesParams; private requiresResponsesApi; /** * The conversation as Responses input items: a tool call is a `function_call` item, its result a * `function_call_output` item under the same call id, and the images and documents a tool * returned follow as one user message. */ private formatResponsesInput; /** An image or a document as a Responses input part. The Responses API takes no audio input. */ private responsesPart; private formatResponsesTools; private extractChatToolCalls; private extractResponsesText; private extractResponsesToolCalls; private isResponseFunctionCall; private mapResponsesFinishReason; private createMeta; private requestOptions; private withProviderModel; private stripConfiguredPrefix; private flushToolCalls; }