import OpenAI from 'openai';
import type { GrawkusConfig, Message } from './types.js';
import type { Tool } from './tools/types.js';
import { type RetryConfig } from './retry.js';
export declare function getClient(config: GrawkusConfig): OpenAI;
/**
 * Same as getClient but explicitly reports the active key in use, so
 * callers (streamChat) can attribute success/failure back to the
 * specific key for rotation health-tracking.
 */
export declare function getClientWithKey(config: GrawkusConfig): {
    client: OpenAI;
    activeKey: string;
};
export declare function resetClient(): void;
/** Re-export so callers (index.ts /keys) can introspect pool status. */
export { reportFailure, reportSuccess, poolSize } from './key-rotation.js';
export declare function toolsToFunctions(tools: Tool[]): OpenAI.Chat.ChatCompletionTool[];
export declare function toolsToResponsesTools(tools: Tool[]): Array<Record<string, unknown>>;
export declare function messagesToResponsesInput(messages: Message[]): Array<Record<string, unknown>>;
export declare function messagesToResponsesInstructions(messages: Message[]): string;
export declare function buildCodexResponsesRequest(config: GrawkusConfig, messages: Message[], tools: Tool[]): Record<string, unknown>;
export declare function shouldRequestChatStreamUsage(config: Pick<GrawkusConfig, 'baseURL'>, env?: NodeJS.ProcessEnv): boolean;
export declare function buildChatCompletionsRequest(config: GrawkusConfig, messages: Message[], tools: Tool[]): Record<string, unknown>;
export declare function resolveChatRetryConfig(_config: Pick<GrawkusConfig, 'baseURL'>, env?: NodeJS.ProcessEnv): RetryConfig;
type StreamChatEvent = {
    type: 'text' | 'thinking' | 'tool_call' | 'done';
    content?: string;
    toolCalls?: OpenAI.Chat.ChatCompletionMessageFunctionToolCall[];
    usage?: {
        prompt: number;
        completion: number;
        total: number;
    };
};
export declare function streamChat(config: GrawkusConfig, messages: Message[], tools: Tool[], signal?: AbortSignal): AsyncGenerator<StreamChatEvent>;
