import type { Context, Model, ThinkingLevel } from "@earendil-works/pi-ai";
import type { Api } from "@earendil-works/pi-ai";
import type { Attachment } from "../attachments.js";
import type { OpenAiReasoningEffort } from "../model-options.js";
import type { LlmTokenUsage } from "../types.js";
/**
 * Decide the model and `reasoning` option to pass into the pi-ai Anthropic
 * adapter. Shared by non-streaming and streaming text dispatch.
 *
 * pi-ai enables extended thinking whenever the caller passes a `reasoning`
 * option (provided `model.reasoning` is true). So:
 *
 * - Registered models with `reasoning: true` (Claude 4+): forward `reasoning`.
 *   Registered Claude 4.x models also carry `compat.forceAdaptiveThinking`, so
 *   pi-ai emits the adaptive thinking form their backends expect.
 * - Registered models with `reasoning: false` (Claude 3 / 3.5): drop
 *   `reasoning` entirely; forwarding it would have pi-ai send a `thinking`
 *   block to an API that rejects it.
 * - Synthetic custom-gateway models (registry miss plus explicit
 *   `ANTHROPIC_BASE_URL` in front of newer Claude versions):
 *   `createSyntheticModel` hard-codes `reasoning: false` and sets no `compat`,
 *   so we flip a copy to `reasoning: true` AND set
 *   `compat.forceAdaptiveThinking`. Without the latter, pi-ai sends
 *   `thinking: { type: "enabled", budget_tokens }`, which Anthropic-on-Bedrock
 *   gateways reject (they require `thinking: { type: "adaptive" }` +
 *   `output_config.effort`). Setting it makes the synthetic model emit the same
 *   adaptive form that registered Claude 4.x models already do.
 */
export declare function prepareAnthropicReasoning({ baseModel, isSyntheticCustomGateway, reasoningEffort, }: {
    baseModel: Model<Api>;
    isSyntheticCustomGateway: boolean;
    reasoningEffort?: OpenAiReasoningEffort;
}): {
    model: Model<Api>;
    reasoning?: ThinkingLevel;
};
export declare function normalizeAnthropicModelAccessError(error: unknown, modelId: string): Error | null;
export declare function completeAnthropicText({ modelId, apiKey, context, temperature, maxOutputTokens, reasoningEffort, signal, anthropicBaseUrlOverride, }: {
    modelId: string;
    apiKey: string;
    context: Context;
    temperature?: number;
    maxOutputTokens?: number;
    reasoningEffort?: OpenAiReasoningEffort;
    signal: AbortSignal;
    anthropicBaseUrlOverride?: string | null;
}): Promise<{
    text: string;
    usage: LlmTokenUsage | null;
}>;
export declare function completeAnthropicDocument({ modelId, apiKey, promptText, document, system, maxOutputTokens, timeoutMs, fetchImpl, anthropicBaseUrlOverride, }: {
    modelId: string;
    apiKey: string;
    promptText: string;
    document: Attachment;
    system?: string;
    maxOutputTokens?: number;
    timeoutMs: number;
    fetchImpl: typeof fetch;
    anthropicBaseUrlOverride?: string | null;
}): Promise<{
    text: string;
    usage: LlmTokenUsage | null;
}>;
