Run the EveryAPI gateway inside Claude Code
Claude Code can send Anthropic Messages requests through EveryAPI by using the documented base URL and an EveryAPI key. `everyapi use claude` injects those settings only into the child process it launches.
One base URL line points Claude Code at EveryAPI
Default global Base URL / China-first Base URL: https://api.everyapi.ai/v1 / https://api-cn.everyapi.ai/v1
# 1. Install the everyapi CLI (Homebrew / Go install / binary)brew tap everyapi-ai/tap && brew install everyapi # 2. Log in and link your account (device-code flow, once per machine)everyapi auth login # 3. Launch Claude Code in one step, with env vars injected automaticallyeveryapi use claude # This command = exports ANTHROPIC_BASE_URL/AUTH_TOKEN for you# then execs into your local claude command; settings apply to this child process onlyFrom zero to your first call
- Install Claude Code itself
Install the claude command per Anthropic's docs (npm i -g @anthropic-ai/claude-code or brew install). EveryAPI doesn't take over Claude Code's own installation.
https://docs.anthropic.com/en/docs/claude-code/quickstart
- Install the everyapi CLI and log in
brew tap everyapi-ai/tap && brew install everyapi, then everyapi auth login — the terminal shows a QR code / opens a device-auth confirmation page in the browser, and after you confirm the CLI gets the token locally.
- everyapi use claude does it in one command
The CLI injects ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN into the Claude Code child process it launches. It does not rewrite your shell profile or change later plain `claude` commands.
- Need to switch the upstream model?
Claude Code requests the configured model through the gateway. Available models and routes depend on your EveryAPI account and current channel eligibility.
Claude Code × EveryAPI
Do I need a separate Anthropic API key?
No. Set Claude Code's ANTHROPIC_AUTH_TOKEN directly to your EveryAPI sk-everyapi- key, and the gateway handles the upstream credentials for you.
Why doesn't ANTHROPIC_BASE_URL include /v1?
Anthropic's official protocol puts the version number in the URL path segment rather than the base URL (POST /v1/messages). Claude Code builds the path itself, so the base should just be https://api.everyapi.ai. It's OpenAI / Codex that need the /v1.
Can I use an Anthropic OAuth (Claude Pro) subscription instead of an API key?
Claude Pro subscription OAuth goes through Anthropic's desktop / mobile flow, which uses a different endpoint than an API key. A seller on the EveryAPI marketplace can attach their own Claude Pro OAuth, and it's transparent to the buyer going through EveryAPI (see the marketplace docs). The buyer doesn't need to hold any OAuth.
Are Claude Code's /allowed-tools / MCP server settings affected?
Not affected. EveryAPI only proxies LLM inference requests; MCP server / tool configuration is still managed by Claude Code itself. EveryAPI also provides its own MCP server (everyapi mcp install claude) so Claude Code can check your EveryAPI quota / balance in natural language.