import { type Cache1hMode, type ClaudeCodeIdentity } from '@cortexkit/anthropic-auth-core'; export type FetchInput = string | URL | Request; /** * Merge headers from a Request object and/or a RequestInit headers value * into a single Headers instance. */ export declare function mergeHeaders(input: FetchInput, init?: RequestInit): Headers; /** * Merge incoming beta headers with the required OAuth betas, deduplicating. */ export declare function mergeBetaHeaders(headers: Headers): string; export declare function addFastModeBetaHeader(headers: Headers): Headers; /** * Set OAuth-required headers on the request: authorization, beta, user-agent. * Removes x-api-key since we're using OAuth. */ export declare function setOAuthHeaders(headers: Headers, accessToken: string, options?: { body?: Record | null; identity?: ClaudeCodeIdentity; }): Headers; /** * Add TOOL_PREFIX to tool names in the request body. * Prefixes both tool definitions and tool_use blocks in messages. */ export declare function prefixToolNames(parsed: Record): string; /** * Strip TOOL_PREFIX from tool names in streaming response text. */ export declare function stripToolPrefix(text: string): string; /** * Check if TLS verification should be skipped for custom API endpoints. * Only effective when ANTHROPIC_BASE_URL is also set. */ export declare function isInsecure(): boolean; /** * Rewrite the request URL to add ?beta=true for /v1/messages requests. * When ANTHROPIC_BASE_URL is set, overrides the origin (protocol + host) * for all API requests flowing through the fetch wrapper. * Returns the modified input and URL (if applicable). */ export declare function rewriteUrl(input: FetchInput, options?: { baseURL?: string; }): { input: FetchInput; url: URL | null; }; /** * Sanitize a system-prompt block. Memoised: the prompt is stable within a * session, so the paragraph-filter + regex pass is skipped on cache hits. */ export declare function sanitizeSystemText(text: string): string; export declare function getSanitizeMemoStats(): import("./sanitize-memo").SanitizeMemoStats; type SystemBlock = { type: string; text: string; [k: string]: unknown; }; /** * Sanitize system prompt and prepend Claude Code identity. * Handles all Anthropic API system formats: undefined, string, or array of text blocks. */ export declare function prependClaudeCodeIdentity(system: unknown): SystemBlock[]; export type HybridMessageCacheAnchor = { fingerprint: string; messageIndex: number; messageCount: number; }; export declare function extractLatestHybridMessageCacheAnchor(bodyText: string): HybridMessageCacheAnchor | undefined; export declare function prepareFableCacheWarmSource(bodyText: string, fableModel?: string): { ok: true; bodyText: string; } | { ok: false; reason: string; }; /** * Rewrite the full request body: sanitize system prompt and prefix tool names. */ type RewritePerfCallback = (stage: string, data?: Record) => void; export declare function rewriteRequestBody(body: string, options?: { cache1hEnabled?: boolean; cache1hMode?: Cache1hMode; fastModeEnabled?: boolean; identity?: ClaudeCodeIdentity; perf?: RewritePerfCallback; hybridStandbyAnchor?: HybridMessageCacheAnchor; }): Promise; /** * Create a streaming response that strips the tool prefix from tool names. */ export declare function createStrippedStream(response: Response, options?: { perf?: RewritePerfCallback; onContentFilter?: () => boolean | undefined; onComplete?: (finishReason: string) => void; contentFilterModel?: unknown; }): Response; export {};