Skip to main content

Anyray Connect

anyray-connect is the on-ramp: one command that signs a developer in and points their coding tools at your Anyray gateway.

What it does

Connect finds the AI tools installed on a machine and edits each tool's own config so its requests go through the gateway — where they are tracked, attributed, and optimized. Three things to know:

  • It only edits tool config. Base URLs and provider entries in each tool's own settings files. No CA certificates, no machine-wide proxy or DNS changes.
  • Keys stay where they belong. The org's provider API keys stay on the gateway. Each developer gets their own short-lived gateway key (ark_…), minted when they enroll.
  • It's reversible. --revert restores every config Connect wrote.

What it configures

ToolWhat Connect changesID
Claude (API)the env block in ~/.claude/settings.jsonark_ key as tokenclaude-code
Claude (Subscription)same env block — your own Claude sign-in staysclaude-code
Claude Desktopits third-party gateway modeclaude-desktop
Codex (app, CLI, IDE)~/.codex/config.tomlanyray becomes the default providercodex
CursorOpenAI custom endpoint (BYOK) for Ask/Plan chatcursor
VS Code Copilot Chatan Anyray chat provider (VS Code 1.121+)copilot
GitHub Copilot CLICOPILOT_PROVIDER_* env in your shell profile — seat-billed via the gateway's Copilot carrier route when a Copilot sign-in is readable, org-billed BYOK under --org / with no seatcopilot-cli
OpenCodeits direct API providers and its Copilot provideropencode
JetBrains AI AssistantAnyray Claude and Codex agents in its agent registryjetbrains
Devin DesktopAnyray Claude and Codex agents in its agent registrywindsurf
Shell & SDKsbase-URL env vars in the shell profileshell-env

Tools that aren't installed are skipped. To configure only some, pass --tools with a comma-separated list of ids from the table.

Claude Code keeps its full context window

Behind any base URL that isn't Anthropic's own, Claude Code stops looking a model's capabilities up and budgets a flat 200,000-token window, compacting at ~95% of it. So if you pin a model in ~/.claude/settings.json, Connect asks the gateway what that model's window actually is, then hands the answer back through the knob Claude Code reads for that model id:

  • A Claude model with a million-token window gets its long-context alias — model becomes claude-opus-4-8[1m]. Same model, long-context variant. Claude Code skips CLAUDE_CODE_MAX_CONTEXT_TOKENS for claude-* ids, so the alias is the setting that actually restores the window.
  • Any other model id gets env.CLAUDE_CODE_MAX_CONTEXT_TOKENS, which is exactly where Claude Code reads a window for a model it has no table of its own for.

Both are client-side only; nothing is added to your requests. Connect never picks a model for you — with no pinned model, or a window it can't resolve, it writes nothing and Claude Code keeps its own default. --revert undoes both, leaving an alias you set yourself alone.

One thing Connect can't reach: a --model flag on your launch command, or a model picked inside the app, overrides settings.json. Add the alias there too, quoting it in zsh — claude --model 'claude-opus-4-8[1m]'.

How to run it

1
Get an enrollment link

An admin creates a passwordless enrollment link in Console → Users, or shares the org's SSO command.

2
Run Connect
curl -fsSL https://app.anyray.ai/connect.sh | sh -s -- --enroll https://app.anyray.ai/enroll/enl_…
# or, with enterprise SSO:
curl -fsSL https://app.anyray.ai/connect.sh | sh -s -- --sso https://app.anyray.ai/sso/tnt_…

Enrollment mints your personal gateway key and sets your name and team for spend attribution. Connect then detects your tools, shows what it will change, and writes each tool's config. Add --dry-run to preview without writing anything.

3
Restart open tools

Editors that were running pick up the new config on restart.

Verify

npx anyray-connect status shows which tools point at the gateway, plus your gateway, name, and team. If something looks wrong, npx anyray-connect doctor diagnoses gateway reachability and each tool's config.

Staying current

Connect installed with connect.sh keeps itself on the published release. About every 30 minutes it checks which version is current, and if the machine is on a different one it downloads that build, verifies its SHA-256 checksum against the published SHA256SUMS, and swaps it in. Commands you run after that use the new version immediately; nothing you configured is rewritten, because every tool, hook, and service points at the same stable path.

It follows the published version in both directions. If a release turns out to be bad and Anyray un-publishes it, machines move back to the previous build on their next check — the previous version is still on disk, so that costs a file swap, not a download.

CommandWhat it does
anyray-connect updateCheck and install now instead of waiting for the next check
anyray-connect update --checkReport which version is published; change nothing
anyray-connect update --auto offStop updating this machine automatically
anyray-connect update --auto onResume automatic updates (and update now)
Turning updates off has one exception

A release Anyray marks mandatory — a security or correctness fix — still installs on a machine that has opted out. Everything else waits for you to run anyray-connect update.

Your own Claude/ChatGPT plan vs. the org API key

By default each tool uses the developer's own subscription (Claude or ChatGPT seat) where one is detected and supported, and the org's API key otherwise. Force it one way with --subscription (always the developer's own plan) or --org (always the org key). See Anthropic — subscription login for how the seat lane works.

Updating an npm install

npx anyray-connect@latest already resolves the current release on every run, so npm installs have nothing to keep current and don't self-update. anyray-connect update reports this rather than changing anything. The same is true of a copy your IT team placed on the machine — that one is theirs to roll.

Undoing a run

npx anyray-connect --revert restores every tool config Connect wrote and clears the stored enrollment. Restart any editor that was running. Reconnecting later needs a fresh enrollment link or the SSO command.