import Anthropic from "@anthropic-ai/sdk"; import type { AnthropicConfig } from "@anthropic-ai/sdk/core/credentials"; import { type CallableProviderAdapter, type JsonValue, type LanguageModel, type ModelCapabilities } from "@zhivex-ai/core/provider"; export interface AnthropicProviderOptions { /** Static API key or an async provider invoked before every request. */ apiKey?: string | AnthropicApiKeyProvider | null; /** Static OAuth/WIF bearer token. Defaults to ANTHROPIC_AUTH_TOKEN. */ authToken?: string | null; /** Refreshable OAuth/WIF access-token provider. */ credentials?: AnthropicAccessTokenProvider | null; /** Explicit Anthropic profile/WIF configuration. */ config?: AnthropicCredentialConfig | null; /** Named profile from ANTHROPIC_CONFIG_DIR. */ profile?: string | null; /** Workspace selected by a multi-workspace API key. */ workspaceId?: string | null; baseURL?: string; /** * Messages API version sent as the `anthropic-version` header. * Defaults to `2023-06-01`. Set `2026-10-21` to opt into that version. * On `2026-10-21` the adapter rejects `temperature`, `top_p`, and `top_k` * (including defaults) and rejects direct assistant documents and non-empty * citations on user text blocks before the request. * @see https://platform.claude.com/docs/en/api/migration-2026-10-21 */ anthropicVersion?: string; fetch?: typeof globalThis.fetch; allowUnsafeEndpoints?: boolean; } export type AnthropicApiKeyProvider = () => Promise; export interface AnthropicAccessToken { token: string; /** Unix epoch seconds. null means the token does not expire. */ expiresAt: number | null; } export type AnthropicAccessTokenProvider = (options?: { forceRefresh?: boolean; }) => Promise; export type AnthropicCredentialConfig = AnthropicConfig; export interface AnthropicCompactionConfig { type: "summarize"; instructions?: string; } export interface AnthropicLanguageModelOptions { /** Request a signed summary without generating a conversation reply. */ compaction?: AnthropicCompactionConfig; speed?: "standard" | "fast"; top_p?: number; top_k?: number; stop_sequences?: string[]; metadata?: Record; tool_choice?: { type: "auto" | "none" | "any" | "tool"; name?: string; }; thinking?: AnthropicThinkingConfig; output_config?: AnthropicOutputConfig; fallbacks?: AnthropicFallbackConfig[] | "default"; /** Additional Anthropic beta feature names to send through the anthropic-beta header. */ betas?: string[]; /** * Preserves prompt-cache prefixes when an application changes its tool list between turns. * Currently supported only by Claude Opus 5. */ midConversationToolChanges?: boolean; /** * End-customer profile ID, sent as the `anthropic-user-profile-id` header. * Omit it to leave the request unattributed. This is not a general header map. * @see https://platform.claude.com/docs/en/manage-claude/user-profiles */ userProfileId?: string; [key: string]: unknown; } export interface AnthropicThinkingConfig { type: "adaptive" | "between_tools" | "disabled" | "enabled"; budget_tokens?: number; display?: "omitted" | "summarized" | "updates"; block_binding?: { prefix_mismatch_behavior: "error" | "drop_block"; }; } export interface AnthropicOutputConfig { effort?: "high" | "low" | "max" | "medium" | "xhigh"; format?: { type: "json_schema"; schema: Record; }; task_budget?: { type: "tokens"; total: number; remaining?: number; }; [key: string]: unknown; } export interface AnthropicFallbackConfig { model: string; max_tokens?: number; thinking?: AnthropicThinkingConfig; } /** Transport hook for hosts serving the Anthropic Messages protocol. * The host owns authentication, endpoint routing, and beta availability. * When `userProfileId` is set, forward it as the `anthropic-user-profile-id` header. */ export interface AnthropicMessagesTransport { send(body: string, signal: AbortSignal, withMcpToolset: boolean, withFilesApi: boolean, betas: string[], userProfileId?: string): Promise; } /** Reuse Claude message/tool/stream mapping with a host-specific transport. * This helper does not load Anthropic credentials or make HTTP calls itself. * Hosts must constrain capabilities and requests to their supported surface. */ export declare const createAnthropicMessagesModel: (options: { modelId: string; transport: AnthropicMessagesTransport; provider?: string; capabilities?: Partial; /** * Messages API version this host sends. Omit it to keep `2023-06-01` rules. * Pass `2026-10-21` only when the host actually sends that version. * On Amazon Bedrock that version exists only for Claude 4.7 and later. * Vertex Claude stays on body `anthropic_version: "vertex-2023-10-16"` and does not pass this option. */ anthropicVersion?: string; }) => LanguageModel; /** Native Beta resources, preserving Anthropic permission policies and event payloads. */ export type AnthropicManagedAgentsClient = Pick; export declare const createAnthropic: (options?: AnthropicProviderOptions) => CallableProviderAdapter> & { rawFetch: typeof globalThis.fetch; managedAgents: AnthropicManagedAgentsClient; }; export interface AnthropicWebSearchToolConfig { type?: "web_search_20260209" | "web_search_20250305"; max_uses?: number; allowed_domains?: string[]; blocked_domains?: string[]; user_location?: { type: "approximate"; city?: string; region?: string; country?: string; timezone?: string; }; } export interface AnthropicCodeExecutionToolConfig { name?: string; type?: "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521"; } export interface AnthropicMcpServerConfig { type?: "url"; url: string; name: string; authorization_token?: string; } export interface AnthropicMcpToolConfig { enabled?: boolean; defer_loading?: boolean; } export interface AnthropicMcpToolsetConfig { server: AnthropicMcpServerConfig; default_config?: AnthropicMcpToolConfig; configs?: Record; cache_control?: Record; } export interface AnthropicMcpToolUseBlock { type: "mcp_tool_use"; id: string; name: string; server_name: string; input: JsonValue; } export interface AnthropicMcpToolResultBlock { type: "mcp_tool_result"; tool_use_id: string; is_error?: boolean; content: JsonValue; server_name?: string; } export declare const anthropicWebSearchTool: (config?: AnthropicWebSearchToolConfig) => import("@zhivex-ai/core/provider").HostedToolDefinition; export declare const anthropicCodeExecutionTool: (config?: AnthropicCodeExecutionToolConfig) => import("@zhivex-ai/core/provider").HostedToolDefinition; export declare const anthropicMcpToolset: (config: AnthropicMcpToolsetConfig) => import("@zhivex-ai/core/provider").HostedToolDefinition; //# sourceMappingURL=index.d.ts.map