Liking cljdoc? Tell your friends :D

com.blockether.vis.ext.provider-anthropic

Anthropic providers.

Providers:

  • :anthropic - normal Anthropic API key provider. API key lives in Vis config.
  • :anthropic-coding-plan - Claude subscription OAuth provider. OAuth credentials live in ~/.vis/anthropic-auth.json.

Runtime calls hand the OAuth access token to svar; svar handles only the Anthropic Messages API wire differences for subscription tokens.

Anthropic providers.

Providers:
- `:anthropic` - normal Anthropic API key provider. API key lives in Vis config.
- `:anthropic-coding-plan` - Claude subscription OAuth provider. OAuth
  credentials live in `~/.vis/anthropic-auth.json`.

Runtime calls hand the OAuth access token to svar; svar handles only the
Anthropic Messages API wire differences for subscription tokens.
raw docstring

auth-instruction-linesclj

(auth-instruction-lines)
source

authenticated?clj

(authenticated?)
source

clear-limits-cache!clj

(clear-limits-cache!)

Clear the in-process Anthropic usage cache. Intended for tests and forced provider refreshes; normal callers should use limits.

Clear the in-process Anthropic usage cache. Intended for tests and
forced provider refreshes; normal callers should use `limits`.
sourceraw docstring

create-authorization-flowclj

(create-authorization-flow)

Create Anthropic Claude subscription OAuth PKCE flow data.

Create Anthropic Claude subscription OAuth PKCE flow data.
sourceraw docstring

detect-credentialsclj

(detect-credentials)

Detect persisted Anthropic OAuth credentials without network validation.

Detect persisted Anthropic OAuth credentials without network validation.
sourceraw docstring

force-refresh-token!clj

(force-refresh-token!)
(force-refresh-token! rejected-token)

Force an OAuth refresh-token exchange, persist the rotated credentials, and return {:token <new-access-token>}.

get-anthropic-token! only refreshes when the stored token is locally expired, so a token that is locally-valid but has been invalidated server-side (refresh-token rotation by another client/process) would otherwise never be replaced. The runtime's 401 recovery path calls this to break that deadlock. Goes through the single-flight refresh-and-persist!, so a STORM of 401s (every iteration's retry, the usage poll) collapses into one exchange instead of racing the rotating refresh token into HTTP 400.

rejected-token (optional) is the access token the server just 401'd: the single-flight reuse step will NOT hand it back, forcing a real exchange when the on-file token is still the dead one. Throws when there is no refresh token.

Force an OAuth refresh-token exchange, persist the rotated credentials,
and return `{:token <new-access-token>}`.

`get-anthropic-token!` only refreshes when the stored token is locally
expired, so a token that is locally-valid but has been invalidated
server-side (refresh-token rotation by another client/process) would
otherwise never be replaced. The runtime's 401 recovery path calls this
to break that deadlock. Goes through the single-flight
`refresh-and-persist!`, so a STORM of 401s (every iteration's retry, the
usage poll) collapses into one exchange instead of racing the rotating
refresh token into HTTP 400.

`rejected-token` (optional) is the access token the server just 401'd:
the single-flight reuse step will NOT hand it back, forcing a real
exchange when the on-file token is still the dead one. Throws when there
is no refresh token.
sourceraw docstring

get-anthropic-token!clj

(get-anthropic-token!)

Return a fresh Anthropic Claude subscription access token for Vis runtime.

Return a fresh Anthropic Claude subscription access token for Vis runtime.
sourceraw docstring

login!clj

(login! printer-fn)
(login! printer-fn
        {:keys [open-browser-fn manual-code-fn force?]
         :or {open-browser-fn open-browser! manual-code-fn prompt-for-code!}})

Run Anthropic Claude subscription OAuth and persist credentials.

Options:

  • :open-browser-fn (fn [url] boolean) override for tests/frontends.
  • :manual-code-fn (fn [printer-fn] string|nil) collector.
  • :force? starts fresh even if credentials already exist.
Run Anthropic Claude subscription OAuth and persist credentials.

Options:
- `:open-browser-fn` `(fn [url] boolean)` override for tests/frontends.
- `:manual-code-fn` `(fn [printer-fn] string|nil)` collector.
- `:force?` starts fresh even if credentials already exist.
sourceraw docstring

logout!clj

(logout!)
source

parse-authorization-inputclj

(parse-authorization-input input)

Parse a pasted Anthropic OAuth callback URL, query string, code#state, or bare code.

Parse a pasted Anthropic OAuth callback URL, query string, `code#state`, or bare code.
sourceraw docstring

statusclj

(status)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close