/** * BrowserAnthropicProvider — fetch-based Anthropic adapter for browsers. * * Pattern: Adapter (GoF). Zero peer dependencies — uses global `fetch`. * Role: Outer ring. Same `LLMProvider` contract as `AnthropicProvider`, * but skips `@anthropic-ai/sdk` (which doesn't bundle cleanly * for browser). Aimed at playgrounds / prototypes where the * user supplies their own key. * Emits: N/A. * * Anthropic requires the `anthropic-dangerous-direct-browser-access: true` * header for direct browser-to-API calls. This is intentional — production * apps should proxy through a backend. * * ─── Limitations ──────────────────────────────────────────────────── * * • Multi-modal NOT supported. * • Browser CORS — works because Anthropic explicitly allows the * dangerous-direct header. Future API changes could require a proxy. */ import type { LLMCallHooks, LLMChunk, LLMProvider, LLMRequest, LLMResponse } from '../types.js'; export interface BrowserAnthropicProviderOptions { /** API key. REQUIRED — browser providers don't read env vars. */ readonly apiKey: string; /** Default model when `LLMRequest.model` is `'anthropic'`. */ readonly defaultModel?: string; /** Default max tokens. Default 4096. */ readonly defaultMaxTokens?: number; /** Override the API URL (proxies, edge deployments, mocks). */ readonly apiUrl?: string; /** * May the model ask for several tools at once in a single reply? * Mirror of `AnthropicProviderOptions.parallelToolCalls` — see there * for the full rationale. * * Anthropic's default is `true` (batching allowed). `false` caps the * model at one tool per reply, which keeps every tool result on its * own agent iteration so per-iteration analysis can attribute and * ablate each source separately. `true`/omitted sends nothing. * * @default undefined (Anthropic's default — batching allowed) */ readonly parallelToolCalls?: boolean; /** @internal Custom fetch implementation for tests / workers. */ readonly _fetch?: typeof fetch; } export declare function browserAnthropic(options: BrowserAnthropicProviderOptions): LLMProvider; export declare class BrowserAnthropicProvider implements LLMProvider { readonly name = "browser-anthropic"; private readonly inner; constructor(options: BrowserAnthropicProviderOptions); complete(req: LLMRequest, hooks?: LLMCallHooks): Promise; stream(req: LLMRequest, hooks?: LLMCallHooks): AsyncIterable; } //# sourceMappingURL=BrowserAnthropicProvider.d.ts.map