import { OpenAI } from 'openai'; import type { LLMCompletionMessage, LLMCompletionResult, LLMInstanceOptions, LLMModel, LLMModelUsage, LLMProviders, LLMSendMessageOptions, LLMStructuredResult } from '../../LLMService.typedefs'; import { type LLMLoggerInterface } from '../../utilities/logger'; import { type LLMReporterInterface } from '../../utilities/reporter'; import { LLMCompletionService } from '../../services'; import { type LLMSchemaInterface, type InferSchema } from '../../utilities/schema'; type OpenAICompatibleProvider = LLMProviders.OpenAI | LLMProviders.LLMAPI; export declare class OpenAICompatibleCompletionService | undefined> extends LLMCompletionService { constructor(provider: Provider, logger: LLMLoggerInterface | undefined, reporter: Reporter, options?: LLMInstanceOptions[Provider]); get instance(): OpenAI; sendMessage(options: LLMSendMessageOptions & { schema: S; }): Promise>>; sendMessage(options: LLMSendMessageOptions): Promise; countTokens(messages: LLMCompletionMessage[], _model: LLMModel): Promise; protected sendTextMessage(options: LLMSendMessageOptions): Promise; protected sendStructuredMessage(options: LLMSendMessageOptions & { schema: LLMSchemaInterface; }): Promise; /** * Builds the provider-native message array 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 and truncating messages is local * work, and its failure is a configuration error rather than a provider one. */ protected prepareRequestMessages(options: LLMSendMessageOptions): Promise; /** * The seam a compatible provider overrides to reject a completion the base * class has no reason to doubt. A throw lands on the request's own error * path, so the rejection is traced as the failure it is instead of arriving * beside a recorded success. */ protected assertCompletionAccepted(_options: { request: LLMSendMessageOptions; usage: LLMModelUsage; }): void; /** * The seam a compatible provider overrides when its wire dialect differs from * OpenAI's own for a content part the gateway supports. */ protected buildChatMessages(options: { messages: LLMCompletionMessage[]; model: LLMModel; }): OpenAI.ChatCompletionMessageParam[]; /** * The chat-completions API counts reasoning inside `completion_tokens`, so * the reasoning half is subtracted back out rather than left on top: the * gateway prices `outputTextTokens` and `outputReasoningTokens` separately * and would otherwise bill the same thinking twice. */ protected extractUsageFromCompletion(completion: OpenAI.ChatCompletion): { inputTextTokens: number; inputCachedTextTokens: number; outputTextTokens: number; outputReasoningTokens: number; }; } export {};