Skip to main content

Module subscription

Module subscription 

Source
Expand description

Whether a Claude Code session paid by the developer’s own Claude subscription (billing = subscription) can work through this deployment’s AI Gateway, checked before it is started and at the end of visdom init:

  1. the gateway takes subscription traffic (gateway.subscription),
  2. Claude Code is signed in with a claude.ai subscription (gateway.claude_login),
  3. the model alias is one the gateway takes a subscription call on (gateway.subscription_model),
  4. a subscription key is issued (or kept) and the gateway accepts it (gateway.subscription_key),
  5. nothing in Claude Code’s settings takes the session over from that login (gateway.claude_settings).

Structs§

ClaudeEnv
The env of every Claude Code settings layer that applies over the environment a session is started in, the one that wins first: the settings an organisation manages, the caller’s own --settings (the later one first), the project’s .claude/settings.local.json and .claude/settings.json, the user’s settings.json. visdom’s launch sets the model as environment, so any of these that names one wins.
ModelUse
A model alias Claude Code will ask for, and who set it (None: the alias visdom configured or picked).

Enums§

ClaudeLogin
How Claude Code is signed in, as claude auth status says.
KeyState
The state of the subscription key, as far as it was checked.

Constants§

ALTERNATIVES
The commands behind the two ways out NOT_SUPPORTED names.
NOT_SUPPORTED
What the developer is told when the platform does not take subscription traffic: printed word for word (the product owner’s wording).
OTHER_MODEL_SETTINGS
Claude Code’s other settings that name a model a session may ask for, beside ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL. The list is Claude Code’s: a setting it gains has to be added here.

Functions§

claude_login
Ask Claude Code (program) how it is signed in, in the environment a session visdom starts would have: without the keys and provider switches the launch removes, which would otherwise be reported instead of the login.
eligible_of
The aliases of available the gateway takes a subscription call on in project; none when it does not say.
is_not_supported
Whether why is NOT_SUPPORTED, which is then printed on its own.
key_finding
gateway.subscription_key, with the expiry date.
login_finding
gateway.claude_login: whether Claude Code has the claude.ai login the subscription is paid through.
managed_settings_path
Where Claude Code reads the settings an organisation manages, which come after everything visdom passes. VISDOM_CLAUDE_MANAGED_SETTINGS names another file (an unusual installation, and the tests).
managed_takeovers
What in the managed settings settings takes a subscription session over: they come after visdom’s own, so it cannot set them aside.
model_finding
gateway.subscription_model: whether every alias of uses is one the gateway takes a subscription call on, in project. source is where visdom’s own alias was set; config_key is the setting that names it. A gateway that does not publish which aliases qualify cannot be relied on to keep a subscription call off another provider: an error too.
models_in_use
The aliases a session started now would ask for: the main model (the caller’s --model, else ANTHROPIC_MODEL as the session sees it — a settings layer, else the environment, which the launch keeps — else configured) and the small one (ANTHROPIC_DEFAULT_HAIKU_MODEL, else configured). env gives a variable’s value and where it is set.
probe_settings
The settings auth status is asked with, and whether they include the caller’s own: the caller’s --settings, merged as the launch merges them, under what the launch sets aside — the developer’s key helper (which Claude Code 2.1.332 would report as authMethod: api_key_helper, tried by hand, instead of the login the session uses), keys and provider switches.
read_auth_status
Read what claude auth status printed. A claude.ai login stored beside a key that takes precedence elsewhere (a key helper in the developer’s settings, which visdom sets aside) still counts as the login.
settings_finding
gateway.claude_settings: nothing in Claude Code’s settings takes the session over from the claude.ai login. Settings an organisation manages that would are an error; a key helper in the developer’s own settings is set aside in sessions visdom starts, but not in a Claude Code started without it (source <(visdom env) cannot), so it is a warning. project_dir is the checkout whose .claude/ settings apply.
traffic_finding
gateway.subscription: whether the gateway takes subscription traffic. Denied, or not said (a gateway from before the setting), is NOT_SUPPORTED on the first line.