import { AIContentBlock, AIMessage, AIRequest, AuthError, FatalError, QuotaExhaustedError, RateLimitError, TransientError } from "./index.js";
//#region src/openai-compat.d.ts
type OpenAiCompatCreds = {
  apiKey: string;
  baseUrl?: string;
  fetch?: typeof fetch;
};
type OpenAiChatMessage = {
  role: 'system' | 'user' | 'assistant';
  content: string | Array<{
    type: string;
    text?: string;
    image_url?: {
      url: string;
    };
  }>;
};
type OpenAiChatResponse = {
  model: string;
  choices: Array<{
    message: {
      content: string | null;
    };
    finish_reason: string | null;
  }>;
  usage?: {
    prompt_tokens: number;
    completion_tokens: number;
  };
};
declare function mapMessagesToOpenAi(messages: AIMessage[]): OpenAiChatMessage[];
declare function mapContentToOpenAi(content: string | AIContentBlock[]): string | Array<{
  type: string;
  text?: string;
  image_url?: {
    url: string;
  };
}>;
declare function mapOpenAiResponse(body: OpenAiChatResponse, provider: string, model: string): {
  content: string;
  model: string;
  provider: string;
  usage: {
    promptTokens: number;
    completionTokens: number;
  };
  finishReason: string | undefined;
};
declare function classifyOpenAiCompatError(status: number, message: string, provider: string): RateLimitError | TransientError | QuotaExhaustedError | AuthError | FatalError;
declare function makeOpenAiCompatAdapter(creds: OpenAiCompatCreds): {
  provider: string;
  supportsImage: boolean;
  call(req: AIRequest): Promise<{
    content: string;
    model: string;
    provider: string;
    usage: {
      promptTokens: number;
      completionTokens: number;
    };
    finishReason: string | undefined;
  }>;
};
//#endregion
export { OpenAiCompatCreds, classifyOpenAiCompatError, makeOpenAiCompatAdapter, mapContentToOpenAi, mapMessagesToOpenAi, mapOpenAiResponse };