import type { LLMProvider, ChatRequest, ChatResponse, ProviderAuthState, ProviderModelSource, ProviderRuntimeMetadata, ProviderRuntimeMetadataDeps } from './interface.js'; import { type LiveModelDiscoveryResult } from './live-model-discovery.js'; import { type RetryConfig } from '../utils/retry.js'; export interface AnthropicCompatOptions { /** Unique provider identifier, e.g. 'my-anthropic-proxy' */ name: string; /** Base URL for the Anthropic Messages API, e.g. 'https://my-proxy.example.com/v1' */ baseURL: string; /** API key sent as the x-api-key header */ apiKey: string; /** Model ID to use when none is specified in ChatRequest */ defaultModel: string; /** List of model IDs exposed by this provider */ models: string[]; /** Optional extra HTTP headers sent with every request */ defaultHeaders?: Record | undefined; /** Optional env vars or secret keys that can satisfy auth for this provider. */ authEnvVars?: readonly string[] | undefined; /** Optional service names that expose service-owned OAuth for this provider. */ serviceNames?: readonly string[] | undefined; /** Optional provider aliases exposed to runtime metadata consumers. */ aliases?: readonly string[] | undefined; /** Optional subscription-provider identity when this provider can use a stored OAuth session. */ subscriptionProviderId?: string | undefined; /** Optional explicit stream protocol label for diagnostics. */ streamProtocol?: string | undefined; /** Optional auth header mode. Default: x-api-key. */ authHeaderMode?: 'x-api-key' | 'bearer' | undefined; /** Optional anonymous/local access posture. */ allowAnonymous?: boolean | undefined; anonymousConfigured?: boolean | undefined; anonymousDetail?: string | undefined; /** * Optional overrides for the transport-level retry backoff (maxRetries / * initialDelayMs / maxDelayMs). Defaults to withRetry's DEFAULT_CONFIG when * omitted. Exposed so operators can tune backoff and so tests can drive the * retry path with a deterministic zero-delay clock instead of real wall-clock * sleeps. */ retryConfig?: Partial | undefined; /** * How this backend's model list is discovered. * - 'anthropic-endpoint' (default): live discovery from the backend's * Anthropic-style GET {baseURL}/models listing, with `models` demoted * to a dated-static baseline used until the first successful fetch and * whenever live discovery fails. * - 'none': the backend has no model-listing API (verified per provider); * `models` is the complete dated-static list and no live fetch is made. */ modelListing?: 'anthropic-endpoint' | 'none' | undefined; /** Override the model-listing URL (defaults to `${baseURL}/models`). */ modelListingUrl?: string | undefined; /** The date the static `models` list was last verified, e.g. '2026-07-12'. */ modelsAsOf?: string | undefined; /** On-disk cache path for live-discovered model lists (TTL cached). */ modelsCachePath?: string | undefined; } /** * AnthropicCompatProvider, generic provider for endpoints that speak the * Anthropic Messages API (SSE streaming variant). Useful for self-hosted * proxies, Claude-compatible services, and any backend that follows the * Anthropic Messages API spec. * * Configured via a custom provider JSON file with `"type": "anthropic-compat"` * in the configured providers directory. */ export declare class AnthropicCompatProvider implements LLMProvider { readonly name: string; readonly credentialAuthority: "resolver"; readonly modelSource: ProviderModelSource; /** * Populated synchronously with the configured static list at construction * (never empty), then replaced by `refreshModels()` with the backend's * live listing when `modelListing` is 'anthropic-endpoint'. */ private _models; get models(): string[]; private baseURL; private apiKey; private defaultModel; private defaultHeaders; private readonly authEnvVars; private readonly serviceNames; private readonly aliases; private readonly subscriptionProviderId?; private readonly streamProtocol?; private readonly authHeaderMode; private readonly allowAnonymous; private readonly anonymousConfigured; private readonly anonymousDetail?; private readonly retryConfig?; private readonly modelListing; private readonly modelListingUrl; private readonly datedStaticModels; private readonly modelsAsOf; private readonly modelsCachePath; constructor(opts: AnthropicCompatOptions); isConfigured(): boolean; describeAuthState(): ProviderAuthState; /** * No dead-end 401: an unconfigured provider refuses the request BEFORE it * hits the wire, with copy that names the key it needs (mirrors * OpenAICompatProvider.assertConfiguredForChat). */ private assertConfiguredForChat; /** * Re-check this backend's live model listing (Anthropic-style GET * {baseURL}/models). Always resolves, falls back to the on-disk cache, * then the dated-static baseline, with the honest failure reason; never * blanks the model list. When the backend has no listing API * (`modelListing: 'none'`, verified per provider), reports the * dated-static source without a network call. */ refreshModels(force?: boolean): Promise; private fetchLiveModelIds; chat(params: ChatRequest): Promise; describeRuntime(deps: ProviderRuntimeMetadataDeps): Promise; } //# sourceMappingURL=anthropic-compat.d.ts.map