import type { Api, Model, SimpleStreamOptions, StreamOptions, ThinkingBudgets, ThinkingLevel } from "../types.js";
export interface ProviderLifecycleHooks<TRequest = unknown, TResponse = unknown> {
    onBeforeRequest?: (request: TRequest) => void | Promise<void>;
    onAfterResponse?: (response: TResponse) => void | Promise<void>;
    onError?: (error: unknown) => void | Promise<void>;
}
export interface RetryPolicy {
    maxAttempts: number;
    baseDelayMs: number;
    maxDelayMs?: number;
    /**
     * When present, abort is checked between attempts and before each backoff
     * sleep. A live request is short-circuited the moment its signal fires —
     * but the presence of a signal no longer suppresses transient retries.
     */
    signal?: AbortSignal;
    shouldRetry?: (error: unknown, attempt: number) => boolean;
    /**
     * Returns the server-requested cooldown (e.g. a parsed `Retry-After`
     * header) in milliseconds, or `null` when the error carries no such hint.
     * When provided, it takes priority over exponential backoff (still clamped
     * by `maxDelayMs`).
     */
    getRetryAfterMs?: (error: unknown) => number | null;
}
export declare class SimpleOptionsProviderError extends Error {
    readonly code: "rate_limit" | "timeout" | "network" | "validation" | "auth" | "unknown";
    readonly cause?: unknown | undefined;
    constructor(message: string, code?: "rate_limit" | "timeout" | "network" | "validation" | "auth" | "unknown", cause?: unknown | undefined);
}
export declare function normalizeProviderError(error: unknown): SimpleOptionsProviderError;
export declare function executeWithRetry<T>(operation: () => Promise<T>, policy: RetryPolicy): Promise<T>;
export declare function buildBaseOptions(model: Model<Api>, options?: SimpleStreamOptions, apiKey?: string): StreamOptions;
export declare function clampReasoning(effort: ThinkingLevel | undefined): Exclude<ThinkingLevel, "xhigh"> | undefined;
export declare function mapThinkingLevel(level: ThinkingLevel | undefined, provider?: "supports-xhigh" | "clamp-xhigh"): ThinkingLevel | Exclude<ThinkingLevel, "xhigh"> | undefined;
export declare function adjustMaxTokensForThinking(baseMaxTokens: number, modelMaxTokens: number, reasoningLevel: ThinkingLevel, customBudgets?: ThinkingBudgets): {
    maxTokens: number;
    thinkingBudget: number;
};
