Pre-Setup Checklist
- Confirm the provider explicitly supports Claude Code, not only OpenAI-compatible APIs.
- Verify the API base URL, model names, auth headers and streaming behavior.
- Normalize pricing to cost per 1M input tokens and 1M output tokens.
- Check privacy policy, log retention, refund policy and support channels.
Common Environment Variables
Relay-specific variable names vary. Treat this as a structure example and follow current Claude Code and provider documentation first.
ANTHROPIC_AUTH_TOKEN="your-relay-api-key"
ANTHROPIC_BASE_URL="https://example.com/anthropic" Official LLM Gateway Signals
Anthropic's Claude Code LLM gateway documentation frames gateways as a centralized proxy layer for authentication, usage tracking, budgets, audit logs and model routing. A third-party relay should document which of those capabilities it actually provides before you treat it as a team gateway.
- Check whether the provider exposes an Anthropic-format endpoint for Claude Code, not only an OpenAI-compatible `/v1` endpoint.
- Confirm whether `ANTHROPIC_BASE_URL` should point at the root gateway URL or a provider-specific path such as `/anthropic`; do not guess or blindly append `/v1`.
- Confirm which auth variable the provider expects: `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, or an `apiKeyHelper` in Claude Code settings.
- If using an API key helper, remember it has lower precedence than explicit `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY` values.
- For teams, ask how usage tracking, cost controls, audit logging, model routing and fallback behavior are implemented and exported.
Configuration Safety Checks
Claude Code can read environment variables and settings from your local environment. Treat any repository or copied snippet that sets `ANTHROPIC_BASE_URL` as sensitive because it can route code and prompts through a different endpoint.
- Inspect `.claude/settings.json`, shell profiles, CI variables and project scripts before launching Claude Code in a cloned repository.
- Remove unexpected `ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, Bedrock or Vertex variables before testing a new provider.
- Prefer a temporary terminal session for first tests, then persist settings only after you verify the exact endpoint, model names and billing.
- Do not run Claude Code with untrusted project settings on private repositories or secrets-bearing worktrees.
- Keep official Anthropic, Bedrock or Vertex routes as the fallback path when the gateway returns unexpected auth, model or streaming errors.
Small-Balance Test Flow
- Use the minimum recharge or trial credit.
- Test normal Q&A, code reading, code edits and long-context behavior on a non-sensitive sample project.
- Record latency, error codes, billing and output quality.
- Use fixed prompts to check for possible model substitution.
- Only then consider adding the relay to your daily coding workflow.
Model Verification Approach
A single answer cannot prove model identity. Use a fixed test suite covering long-context recall, tool-use style, code reasoning, multilingual details and refusal boundaries, then compare repeated outputs.
FAQ
Is a Claude Code relay the same as an OpenAI-compatible relay?
Not exactly. Claude Code depends more on Anthropic-compatible endpoints, model names and streaming behavior. A provider that only supports OpenAI-compatible APIs may not work directly.
What is the biggest risk when using Claude Code through a relay?
The main risks are prompt and code logging, model substitution, unstable long-context behavior, balance loss and unclear upstream access. Sensitive repositories should prefer official APIs or compliant enterprise options.
How do I know whether a Claude Code relay is worth long-term use?
Review docs, pricing, privacy and support first. Then test multi-turn code reading, edits, long context and retries on a fixed project while recording billing and error rates.
Should I put ANTHROPIC_BASE_URL in a project settings file?
Only for trusted projects and reviewed endpoints. For first tests, use a temporary terminal session. A project-level setting that changes `ANTHROPIC_BASE_URL` can route prompts and code through a different service.