Skip to main content

third-option

Signs Claude Code in to a Third Option gateway from anywhere, and keeps the session fresh.

Claude Code's own gateway login accepts only a gateway on a private network: every address the host resolves to must be RFC 1918, CGNAT or loopback, and no setting widens that. A gateway with a public address — a hosted one, or a company's reached without the VPN — has no interactive way in. This is that way in.

Install

cargo install third-option
npm install -g third-option
uv tool install third-option        # or: pipx install third-option

Prebuilt for Linux x64 and arm64 (glibc) and Apple Silicon; cargo install builds anywhere Rust does.

Use

third-option enroll https://gateway.example.com
claude --settings ~/.config/third-option/claude-settings.json

enroll opens the gateway's sign-in page, waits for you to confirm the code it printed, then writes a settings file of its own ($THIRD_OPTION_HOME/claude-settings.json, default ~/.config/third-option/) that points one launch of Claude Code at the gateway. Nothing under ~/.claude changes, so a trial, a demo, or a second gateway beside your everyday setup leaves every other session alone.

third-option enroll --global https://gateway.example.com

writes the same keys into Claude Code's own settings.json ($CLAUDE_CONFIG_DIR, else ~/.claude) instead, so every session on the machine uses the gateway. Either way the file ends up with:

  • env.ANTHROPIC_BASE_URL is the gateway and model discovery is on, so the model picker shows what the gateway serves;
  • apiKeyHelper is third-option token, which prints the session token and renews it through the gateway's refresh grant before it runs out;
  • whatever the gateway pushes from /managed/settings — model, permissions, the telemetry exporter — is merged in, the operator's keys winning and lists such as permissions.deny unioned;
  • when telemetry is pushed, otelHeadersHelper is third-option otel-headers, so exports to the gateway carry the session and land.

Nothing else in the file is touched. Run enroll again to pick up a changed policy. third-option status shows the session, when it ends, and what Claude Code points at; third-option models lists what this identity may use.

Verb Does
enroll [url] sign in if needed, then write the settings that point Claude Code at the gateway: a file for claude --settings, or with --global Claude Code's own
login <url> sign in only — for a scripted client that sets ANTHROPIC_BASE_URL itself
token print a fresh session token (apiKeyHelper)
otel-headers print {"Authorization": "Bearer …"} (otelHeadersHelper)
status, models, logout [--all]

--gateway <url> picks a gateway; otherwise $ANTHROPIC_BASE_URL — which Claude Code sets from the env block when it runs a helper — then the last login. --no-browser prints the link instead of opening it.

Where the session is kept

The session is a credential, so it lives in the OS secure store: the Keychain on macOS, the Secret Service (GNOME Keyring, KWallet) on Linux, the Credential Manager on Windows — service third-option, account the gateway's origin, so it is the entry you see in Keychain Access or Seahorse. macOS asks once per new build of the binary whether it may read its own entry; "Always Allow" is the answer. credentials.json under $THIRD_OPTION_HOME, else ~/.config/third-option, only records which gateways have a session and which was used last.

Where no secure store is reachable — a server with no session bus, a CI runner — login keeps the session in that file instead, readable only by you, and says so. THIRD_OPTION_STORAGE=file chooses the file outright; THIRD_OPTION_STORAGE=keyring refuses the fallback. status shows where each session is.

Two modes, one gateway

Public — this CLI Private network — Claude Code's own login
Reaches the gateway over any TLS route private addresses only
Enrollment third-option enroll /login, pinned by a machine policy file
Credential apiKeyHelper the pinned gateway session
Managed settings merged into the file enroll writes pushed live, not editable
Telemetry signed by otelHeadersHelper signed by the session

They are exclusive on one machine: the policy file that turns on Claude Code's own gateway login (/etc/claude-code/managed-settings.json; /Library/Application Support/ClaudeCode/ on macOS) makes it refuse every helper credential. enroll and status say so when they see one. The private-network mode is the stronger one, so a fleet on its own network should use it; this CLI is for everyone else.

Scripted use

export ANTHROPIC_BASE_URL=https://gateway.example.com
export ANTHROPIC_AUTH_TOKEN="$(third-option token)"

token renews the session when it has under fifteen minutes left, so a long-running script can call it again rather than cache the value.

License

MIT OR Apache-2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

third_option-0.3.0-py3-none-manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

third_option-0.3.0-py3-none-manylinux_2_28_aarch64.whl (2.9 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

third_option-0.3.0-py3-none-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file third_option-0.3.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for third_option-0.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f1a7299cbfeddb78b8b58f0d0f298234cca2f7433636bf825677dfe13e258689
MD5 f02ab9e653dc869b59b21a2084a059dc
BLAKE2b-256 b000a826ed3b0f61dac2357e293d33e2b2119d24b9eb4bd1313a3194d4e24c9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for third_option-0.3.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release-third-option.yml on 3rd-option/monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file third_option-0.3.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for third_option-0.3.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e288392ee44bd1bd9b2cef57abcf2e9546fd24c07ebcb7c3de0acac4dbabfe4f
MD5 26a0f8d31ae5f9e620783fa001ec4dac
BLAKE2b-256 7612879d8e2630a0e731c50f4cb452141005277c4e16169f19bc5bb1b987a7bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for third_option-0.3.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release-third-option.yml on 3rd-option/monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file third_option-0.3.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for third_option-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 193a6439e2ddf822591a5d837ceb8da7152af925f7b6828feacd8825b18f283b
MD5 7305448ebb7b4ad8d6d0a94fb99f8c43
BLAKE2b-256 592786910098efef0507b0ffb495cb77021c5c36f5e42f920d14ae639cc54c35

See more details on using hashes here.

Provenance

The following attestation bundles were made for third_option-0.3.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release-third-option.yml on 3rd-option/monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

3 files

0.2.0

3 files

0.1.0

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page