/**
 * Shared helpers for LLM-backed compatibility routes (OpenAI / Anthropic).
 *
 * The generator cache is module-scoped so different compatibility routes
 * (e.g. /oai-compat and /anthropic-messages) reuse the same warm generator
 * for a given model instead of duplicating contexts.
 */
export declare const LLM_TYPES: string[];
export type GeneratorCacheEntry = {
    id: string;
    type: string;
    config: any;
    repoId: string;
    initialized: boolean;
    activeRequests: number;
};
export declare function cancelReaderBestEffort(reader: {
    cancel: () => Promise<unknown>;
}): void;
export declare function releaseGenerator(backend: any, entry: GeneratorCacheEntry | null | undefined, logPrefix?: string): Promise<void>;
/**
 * Get the LLM backend API for a generator type.
 */
export declare function getLlmBackend(backend: any, type: string): any;
/**
 * Get or create a cached generator for the requested model.
 *
 * If `requestedModel` matches a configured generator's `model.repo_id`,
 * that config is used; otherwise the first LLM generator is selected and
 * its repo_id is overridden with the requested model.
 */
export declare function getOrCreateGenerator(backend: any, config: any, requestedModel?: string, logPrefix?: string): Promise<GeneratorCacheEntry>;
/**
 * Extract token counts from a backend completion result event.
 *
 * The buttress backend reports counts under `timings.prompt_n`,
 * `timings.cache_n`, and `timings.predicted_n` (with `tokens_evaluated`
 * historically mirroring predicted_n on the result root). We tolerate
 * the legacy `prompt_tokens`/`tokens_predicted` field names too in case
 * a future backend variant promotes them to the root.
 */
export declare function extractTokenCounts(eventData: Record<string, any>): {
    promptTokens: number;
    cachedTokens: number;
    completionTokens: number;
};
/**
 * Extract token usage in OpenAI format from backend event data.
 */
export declare function extractUsage(eventData: Record<string, any>): {
    prompt_tokens: number;
    completion_tokens: number;
    total_tokens: number;
};
