Protected_Protected_Protected_Protected ReadonlydiscoveryProtected ReadonlylanguageProtected ReadonlyloggerProtected ReadonlymodelCached /v1/models lookups keyed by ${baseURL}::${model}::${headers}, so a header change re-fetches through the
new headers. Successful lookups are kept for the process lifetime; failed lookups are evicted so the next call retries.
ProtectedcalculateProtectedcreateProtectedderiveAdaptive thinking (effort) is preferred when available; older 4.x models only support the legacy extended thinking (budget) API.
ProtectedderiveServer-side compaction (compact_20260112) is available on Claude Opus and Sonnet 4.6 and later.
Heuristic over the model id; override to read the capability from the /v1/models endpoint or for custom endpoints.
ProtectedderiveFetches the models Anthropic currently offers from its /v1/models endpoint, retrying
transient connection failures and persisting a snapshot for offline use.
Requires an API key. Returns an empty result when no key is configured. On a live-fetch
failure it falls back to the cached snapshot (fromCache: true) when one exists, and only
throws when there is no cache to fall back to.
ProtectedfetchReports where the effective API key comes from (preference, environment, or none).
ProtectedlistIterates the (auto-paginated) /v1/models endpoint. Overridable for testing.
ProtectedresolvemaxTokens falls back to DEFAULT_MAX_TOKENS since the Messages API requires it.
ProtectedretrieveAllows or refuses the use of an API key found in the environment. Refused by default: an
environment key is only used once the user has confirmed it, and setting this back to false
stops it being used immediately, wherever it would have been used.
ProtectedtoMaps the endpoint's entries onto DiscoveredModels, deduplicating defensively and adding the undated alias of every release-pinned id. The endpoint lists the newest models first, an order worth preserving for anything that registers them in sequence.
Whether a key found in the environment may be used. Withheld until the user confirms it, so the gate sits on the key itself: every path that reaches for one — discovery, a custom endpoint, a manually configured model — is covered, and revoking the consent takes effect at once.