import { OpenAI } from 'openai'; import type { LLMCompletionMessage, LLMCompletionResult, LLMInstanceOptions, LLMModel, LLMModelUsage, LLMSendMessageOptions, LLMStructuredResult } from '../../../LLMService.typedefs'; import { LLMProviders } from '../../../LLMService.typedefs'; import { type LLMLoggerInterface } from '../../../utilities/logger'; import { type LLMReporterInterface } from '../../../utilities/reporter'; import { OpenAICompatibleCompletionService } from '../../../providers/OpenAICompatible/OpenAICompatibleCompletion.service'; import { type LLMSchemaInterface } from '../../../utilities/schema'; export declare class LLMAPICompletionService | undefined> extends OpenAICompatibleCompletionService { constructor(logger: LLMLoggerInterface | undefined, reporter: Reporter, options?: LLMInstanceOptions[LLMProviders.LLMAPI]); get instance(): OpenAI; private combineInstructions; protected buildChatMessages(options: { messages: LLMCompletionMessage[]; model: LLMModel; }): OpenAI.ChatCompletionMessageParam[]; protected sendTextMessage(options: LLMSendMessageOptions): Promise; protected sendStructuredMessage(options: LLMSendMessageOptions & { schema: LLMSchemaInterface; }): Promise; /** * A route handed audio it never fetched still answers, fluently and from * nothing, so the reported audio token count is the only thing separating a * real read from a fabrication. */ protected assertCompletionAccepted(options: { request: LLMSendMessageOptions; usage: LLMModelUsage; }): void; /** * Audio tokens are counted inside `prompt_tokens`, so the audio half is moved * out of the text half rather than added on top: the gateway prices text and * audio input separately and would otherwise bill the recording twice. */ protected extractUsageFromCompletion(completion: OpenAI.ChatCompletion): { inputTextTokens: number; inputAudioTokens: number; inputCachedTextTokens: number; outputTextTokens: number; outputReasoningTokens: number; }; /** * Builds the provider-native message array and the response format before the * request is attempted, so the success and the error path trace the same * transcript rather than one of them falling back to a raw * `{ message, history }` object. It runs outside the request's `try` on * purpose: combining messages and rendering the schema is local work, and its * failure is a configuration error rather than a provider one. */ private prepareStructuredRequest; }