Anyray Connect
anyray-connect points a developer's coding tools at your gateway in one command.
Connect finds the AI tools installed on a machine and edits each tool's own config so its
requests go through the gateway: base URLs and provider entries, plus lane extras like the
Anyray VS Code extension and a per-user credential heartbeat.
The org's provider keys stay on the gateway; each developer gets a personal ark_…
client key. --revert restores every config Connect wrote.
| Tool | What Connect changes | ID |
|---|---|---|
| Claude (API) | the env block in ~/.claude/settings.json, plus an apiKeyHelper that renews the ark_ key on demand | claude-code |
| Claude (Subscription) | same env block; your own Claude sign-in stays. No apiKeyHelper here: its output would hijack the seat's OAuth sign-in, so a SessionStart hook re-mints the key instead | claude-code |
| Claude Desktop | its third-party gateway mode, plus queued migration of eligible local sessions, MCP entries, plugins, and skills | claude-desktop |
| Codex (app, CLI, IDE) | ~/.codex/config.toml ($CODEX_HOME overrides the directory), where anyray becomes the default provider | codex |
| Cursor | native Team mode: local Shell/Read/MCP optimization hooks + a team steering rule (the BYOK OpenAI endpoint only under --org) | cursor |
| VS Code Copilot Chat | an Anyray chat provider (VS Code 1.121+) | copilot |
| GitHub Copilot CLI | COPILOT_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 seat | copilot-cli |
| OpenCode | its direct API providers and its Copilot provider | opencode |
| OpenClaw | its anthropic and openai providers in ~/.openclaw/openclaw.json, plus the prompt-cache setting its custom-host mode skips | openclaw |
| JetBrains AI Assistant | Anyray Claude and Codex agents in its agent registry | jetbrains |
| Devin Desktop | Anyray Claude and Codex agents in its agent registry | windsurf |
| Shell & SDKs | base-URL env vars in the shell profile | shell-env |
Tools that aren't installed are skipped; --tools with a comma-separated list of ids
configures a subset. The full on-disk footprint, every hook and MCP seam Connect writes,
background services, and the fleet command surface are in the
Connect reference.
How to run it
An admin creates a passwordless enrollment link in Console → Users, or shares the org's SSO command.
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. --dry-run previews without writing; anyray-connect with no setup flags
chooses interactively.
An editor that was already open holds the environment it captured at launch, so it keeps its old routing until it restarts. When an interactive run finds an open app whose configuration it is about to change, Connect asks once, then closes and reopens exactly those apps; an app already pointed at the gateway is never touched.
| Flag | Effect |
|---|---|
--quit-apps | Skip the question and do it. The only way a scripted run closes anything. |
--no-quit-apps | Never close anything, whatever else is passed. |
Without either flag, only an interactive run asks. --yes, a non-interactive shell,
--dry-run and the managed/MDM payloads close nothing.
A program driving enrollment can add --json to --sign-in, --sso, --enroll or
--claim: stdout becomes a stream of NDJSON events (sso_grant, enrolled, applied,
error), human output moves to stderr, --yes is required, and no browser is opened.
Add --endpoint to a --sign-in, --sso, --enroll, or --claim command to install the
signed end-point agent, so the device reports compliance. It takes one sudo prompt on macOS
and Linux, or an elevated shell on Windows. In the console, tick Also bring the machine under
policy and the copied command carries the flag; nothing adds it for you. --no-endpoint
never installs it, whatever else is passed.
status shows which tools point at the gateway, plus your gateway, name, and team. When
something looks wrong, doctor diagnoses gateway reachability and each tool's config.
curl -fsSL https://app.anyray.ai/connect.sh | sh -s -- status
# if something looks wrong:
curl -fsSL https://app.anyray.ai/connect.sh | sh -s -- doctor
On a machine with an IT-managed Claude Code managed-settings.json, apply and doctor also
check that the policy doesn't drop Anyray's hooks:
managed policy.
Mixing both lanes in one organization
--subscription and --org are chosen per enrollment command, not once per deployment,
so one gateway can serve both at the same time: some developers on their own Claude or
ChatGPT plan, the rest billed to the org's provider account (an API key, or a cloud account
such as Bedrock or Vertex AI). Publish one command per group; both carry the
same enrollment link.
curl -fsSL https://app.anyray.ai/i/tnt_… | sh -s -- --subscription
curl -fsSL https://app.anyray.ai/i/tnt_… | sh -s -- --org
| Lane | What the tool sends | Who pays |
|---|---|---|
--subscription | The tool's own seat token, forwarded to Anthropic or OpenAI unchanged | The developer's plan |
--org | The personal gateway key. The gateway swaps in the server-held provider credential | The org's provider account |
| neither flag | Whichever of the two fits each tool on that machine | Depends on what is signed in |
Everyone still enrols normally and gets a personal gateway key, so per-user spend attribution works the same in both groups. The lanes stay separate inside the gateway: seat traffic keeps the developer's own token and deliberately skips the org's routing config (routing every request to Bedrock cannot capture a seat request), while org-lane traffic pins no provider of its own, which is what lets routing steer it.
With no flag, Connect looks for a Claude or ChatGPT sign-in and uses the seat when it finds
one. A developer who is meant to bill to the org account, but happens to be signed into
Claude Code, silently bills their personal plan instead. --org makes that group
deterministic, and the choice is remembered, so later automatic key refreshes rebuild the
same lane.
Assign the lane centrally instead
Two published commands leave the split to whichever one each person copied. Console → Tools → Billing lane decides it centrally, per team and per user:
Add the team id and pick Organization account or Own subscription. It covers everyone on that team: the seat's current SCIM-mapped team when SCIM manages the roster, otherwise the team set at enrollment. A SCIM group move re-lanes the seat on its next policy pull, no re-enrollment.
Add a user id (usually their email) for anyone who differs; a user assignment wins over their team's. Setting a user to Automatic exempts them from their team's assignment rather than inheriting it.
Each machine picks the assignment up on its next policy pull and re-points every managed
tool. anyray-connect sync applies it immediately.
An assignment overrides the flag the developer passes, and Connect says so when it does.
Anyone with no assignment keeps the default behavior above; --upstream BYO passthrough is
neither lane and is left alone. An older gateway, an unreachable one, or a not-yet-enrolled
developer all resolve to "unassigned" and enrollment proceeds on the developer's own choice:
governance that cannot be read degrades to ungoverned, never to broken.
Staying current
Every install method converges on one managed standalone binary at
~/.anyray/bin/anyray-connect (connect.sh installs it directly), and the updater checks the
published release about every 30 minutes regardless of how the first run started.
| Command | What it does |
|---|---|
anyray-connect --version | Print the installed version; if a newer release exists, show it and suggest anyray-connect update |
anyray-connect update | Check and install now instead of waiting for the next check |
anyray-connect update --check | Report which version is published; change nothing |
anyray-connect update --auto off | Stop updating this machine automatically |
anyray-connect update --auto on | Resume automatic updates (and update now) |
Fleet posture lives in Console → Tools → Connect updates: Automatic (the default), Administrator-directed (nothing downloads unattended; versions land when an admin sends an update), or Off (no Anyray process fetches a binary; you ship each version with your own tooling). The restricted modes suit fleets running behavioral endpoint security, which scores the download-and-run shape regardless of code signature (Fleet update policy). npm installs and platforms without a standalone binary: update path variants.
Uninstall
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.
If the CLI isn't on your PATH, run it through npx or the installer, with the flag passed to
the CLI, not to curl:
npx anyray-connect@latest --revert
# or
curl -fsSL https://app.anyray.ai/connect.sh | sh -s -- --revert