export type AnthropicHeaderOptions = { apiKey: string; baseUrl?: string; isOAuth?: boolean; extraBetas?: string[]; stream?: boolean; modelHeaders?: Record; isCloudflareAiGateway?: boolean; claudeCodeSessionId?: string; claudeCodeBetas?: readonly string[]; /** Allow explicit fingerprint headers to replace OAuth defaults on non-official endpoints. */ allowAnthropicHeaderOverrides?: boolean; /** Leave Claude Code's `x-app` and browser-access headers off API-key requests. */ omitClaudeCodeAppHeaders?: boolean; }; export declare function buildBetaHeader(baseBetas: readonly string[], extraBetas: readonly string[]): string; /** * Merge an extra Anthropic beta into a caller-provided `anthropic-beta` header, * preserving the caller's key casing and deduping the tokens. Returns a * single-entry header record for a per-request `headers` override — used to * attach a required beta to injected SDK clients that bypass the client-level * beta construction. */ export declare function mergeAnthropicBetaHeader(callerHeaders: Record, beta: string): Record; export declare const midConversationSystemClearAtBeta = "mid-conversation-system-clear-at-2026-08-21"; export declare const midConversationToolChangesBeta = "mid-conversation-tool-changes-2026-07-01"; export declare const midConversationOutputConfigBeta = "mid-conversation-output-config-2026-07-01"; export declare const contextManagementBeta = "context-management-2025-06-27"; export declare const structuredOutputsBeta = "structured-outputs-2025-12-15"; export declare const fallbackCreditBeta = "fallback-credit-2026-06-01"; export declare const promptCachingScopeBeta = "prompt-caching-scope-2026-01-05"; export declare const extendedCacheTtlBeta = "extended-cache-ttl-2025-04-11"; export declare const fineGrainedToolStreamingBeta = "fine-grained-tool-streaming-2025-05-14"; export declare const interleavedThinkingBeta = "interleaved-thinking-2025-05-14"; export declare const fastModeBeta = "fast-mode-2026-02-01"; export declare const taskBudgetBeta = "task-budgets-2026-03-13"; export declare const effortBeta = "effort-2025-11-24"; export declare const serverSideFallbackBeta = "server-side-fallback-2026-06-01"; /** Gates the request `thread` field (see `anthropic-threads.ts`); rides only on requests that carry it. */ export declare const messageThreadsBeta = "message-threads-2026-08-12"; export declare function buildClaudeCodeBetas({ agentRequest, thinkingRequest, disableStrictTools, supportsContextManagement, dropPromptCacheBetas, }: { agentRequest: boolean; thinkingRequest: boolean; disableStrictTools?: boolean; supportsContextManagement?: boolean; /** * Withhold the prompt-cache betas: this endpoint rejected `cache_control`, * so a request that carries no breakpoint must not advertise caching it * cannot use. This deviates from Claude Code's header fingerprint, which is * acceptable here precisely because an endpoint that refuses the field is * not the first-party API the fingerprint exists to match. */ dropPromptCacheBetas?: boolean; }): readonly string[]; export declare function buildAnthropicHeaders(options: AnthropicHeaderOptions): Record; /** Maps Node's platform identifier to the Stainless wire value. */ export declare function mapStainlessOs(platform: string): "MacOS" | "Windows" | "Linux" | "FreeBSD" | `Other::${string}`; /** Maps Node's architecture identifier to the Stainless wire value. */ export declare function mapStainlessArch(arch: string): "x64" | "arm64" | "x86" | `other::${string}`; /** Static headers emitted by Claude Code's CLI runtime. */ export declare const claudeCodeHeaders: { "X-Stainless-Arch": "arm64" | "x64" | "x86" | `other::${string}`; "X-Stainless-Lang": string; "X-Stainless-OS": "FreeBSD" | "Linux" | "MacOS" | "Windows" | `Other::${string}`; "X-Stainless-Package-Version": string; "X-Stainless-Retry-Count": string; "X-Stainless-Runtime": string; "X-Stainless-Runtime-Version": string; "X-Stainless-Timeout": string; }; /** * Returns env-supplied custom headers (`ANTHROPIC_CUSTOM_HEADERS`) when they * should be forwarded to the upstream endpoint. * * Foundry mode forwards them unconditionally. Outside Foundry, they're applied * only when the configured base URL is a non-Anthropic host — i.e. an * enterprise/corporate gateway that may require its own proprietary auth * header. Stock `api.anthropic.com` would reject unknown headers, so they're * omitted there. */ export declare function resolveAnthropicCustomHeadersForBaseUrl(baseUrl: string | undefined): Record | undefined; /** * Merge headers case-insensitively; later sources win and preserve their key casing. * Undefined sources are ignored. Differently cased duplicates are removed so the * Headers constructor cannot join competing values comma-separated on the wire. */ export declare function mergeHeaders(...headerSources: (Record | undefined)[]): Record; export declare function normalizeExtraBetas(betas?: string[] | string): string[];