Skip to main content

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.

ToolWhat Connect changesID
Claude (API)the env block in ~/.claude/settings.json, plus an apiKeyHelper that renews the ark_ key on demandclaude-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 insteadclaude-code
Claude Desktopits third-party gateway mode, plus queued migration of eligible local sessions, MCP entries, plugins, and skillsclaude-desktop
Codex (app, CLI, IDE)~/.codex/config.toml ($CODEX_HOME overrides the directory), where anyray becomes the default providercodex
Cursornative Team mode: local Shell/Read/MCP optimization hooks + a team steering rule (the BYOK OpenAI endpoint only under --org)cursor
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
OpenClawits anthropic and openai providers in ~/.openclaw/openclaw.json, plus the prompt-cache setting its custom-host mode skipsopenclaw
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; --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

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. --dry-run previews without writing; anyray-connect with no setup flags chooses interactively.

3
Restart open tools

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.

FlagEffect
--quit-appsSkip the question and do it. The only way a scripted run closes anything.
--no-quit-appsNever 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.

Bringing the machine under policy

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.

Verify

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.

Developers on their own Claude plan
curl -fsSL https://app.anyray.ai/i/tnt_… | sh -s -- --subscription
Developers billed to the org's provider account
curl -fsSL https://app.anyray.ai/i/tnt_… | sh -s -- --org
LaneWhat the tool sendsWho pays
--subscriptionThe tool's own seat token, forwarded to Anthropic or OpenAI unchangedThe developer's plan
--orgThe personal gateway key. The gateway swaps in the server-held provider credentialThe org's provider account
neither flagWhichever of the two fits each tool on that machineDepends 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.

Always pass a lane flag to the group you are splitting

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:

1
Assign a team

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.

2
Override individuals

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.

3
Let the fleet apply 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.

CommandWhat it does
anyray-connect --versionPrint the installed version; if a newer release exists, show it and suggest anyray-connect update
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)

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