import type { Brain } from "../core/types.js"; import { type StreamEngineConfig } from "./stream-engine.js"; export interface AnthropicBrainConfig extends StreamEngineConfig { /** Base URL of the Anthropic(-compatible) API. Default `https://api.anthropic.com`. Overridden by model.baseUrl. */ baseUrl?: string; /** API key (`x-api-key`). Overridden by per-call options.apiKey / getApiKeyAndHeaders. */ apiKey?: string; /** `anthropic-version` header. Default `2023-06-01`. */ version?: string; /** Extra headers merged into every request (e.g. `anthropic-beta`). */ headers?: Record; /** Custom fetch (tests / proxies). Defaults to global fetch. */ fetchImpl?: typeof fetch; /** `max_tokens` when the call/model doesn't specify one (Anthropic requires it). Default 4096. */ defaultMaxTokens?: number; /** * Insert `cache_control: {type:"ephemeral"}` prompt-cache breakpoints on the last system block and * the last tool, so the (stable) system + tools prefix is cached across requests. Default true. */ cacheBreakpoints?: boolean; /** * Detect **degenerate repetition** (the model looping on the same char/phrase forever) mid-stream * and cut it off — the turn ends `error` ("degenerate repetition"). Default true. */ detectRepetition?: boolean; /** * Extended-thinking budget as a fraction of `max_tokens` when reasoning is on. Default 0.5. * The budget is always clamped to `[1024, max_tokens - 1]` (Anthropic requires it strictly below * `max_tokens`, ≥ 1024). Lower it to leave more room for the answer with verbose reasoning models. */ thinkingBudgetShare?: number; /** * Fixed extended-thinking budget in tokens (overrides `thinkingBudgetShare`). Still clamped to * `[1024, max_tokens - 1]`. Use when you want a constant reasoning budget regardless of max_tokens. */ thinkingBudgetTokens?: number; } /** * Create a Brain for the Anthropic Messages API (`/v1/messages`) with **prompt caching** and * **extended-thinking replay**. Translates the unified Context into an Anthropic request and the * streamed response back into the unified AssistantMessageEvent protocol. The connect/retry/timeout/ * read-loop machinery lives in the shared {@link runStreamingBrain} engine (design/32); this adapter * owns the Anthropic request shaping + typed content-block SSE parsing + finalization. */ export declare function createAnthropicBrain(config?: AnthropicBrainConfig): Brain; //# sourceMappingURL=anthropic.d.ts.map