Skip to content

docs: recommend ANTHROPIC_AUTH_TOKEN over ANTHROPIC_CUSTOM_HEADERS for Claude Code auth - #3686

Merged
akshaydeo merged 1 commit into
mainfrom
05-22-refactor_claude_code_integration_recommended_authentication_method
May 22, 2026
Merged

docs: recommend ANTHROPIC_AUTH_TOKEN over ANTHROPIC_CUSTOM_HEADERS for Claude Code auth#3686
akshaydeo merged 1 commit into
mainfrom
05-22-refactor_claude_code_integration_recommended_authentication_method

Conversation

@impoiler

@impoiler impoiler commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates the Claude Code documentation to recommend ANTHROPIC_AUTH_TOKEN as the primary authentication method over ANTHROPIC_CUSTOM_HEADERS. Using ANTHROPIC_AUTH_TOKEN eliminates the requirement for users to log in with an Anthropic account, since Bifrost handles all routing and authentication through the virtual key.

Changes

  • Added an "Authentication Methods" section explaining both ANTHROPIC_AUTH_TOKEN (recommended) and ANTHROPIC_CUSTOM_HEADERS (alternative), including the caveat that ANTHROPIC_CUSTOM_HEADERS still requires an Anthropic account login
  • Replaced ANTHROPIC_CUSTOM_HEADERS: x-bf-vk: your-virtual-key with ANTHROPIC_AUTH_TOKEN: your-virtual-key across all configuration examples (non-Anthropic, Anthropic, Bedrock, Vertex, Azure)
  • Updated the caching/setup note to clarify the login flow differs depending on which authentication method is used
  • Removed the previous blanket note recommending ANTHROPIC_CUSTOM_HEADERS for all versions

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Review the updated Claude Code documentation page and verify:

  • The "Authentication Methods" section clearly explains both options and their trade-offs
  • All configuration snippets use ANTHROPIC_AUTH_TOKEN instead of ANTHROPIC_CUSTOM_HEADERS
  • The setup note accurately reflects the login requirements for each method

Breaking changes

  • Yes
  • No

Security considerations

ANTHROPIC_AUTH_TOKEN passes the virtual key via the Authorization: Bearer header, which is the standard bearer token pattern. Users no longer need to expose or manage Anthropic account credentials when using the recommended method.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf775d1f-f964-4c5f-89d7-0b8a00f2f3bc

📥 Commits

Reviewing files that changed from the base of the PR and between 3c226a6 and 3f9c8e8.

📒 Files selected for processing (1)
  • docs/cli-agents/claude-code.mdx

📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added an “Authentication Methods” section for Claude Code, recommending ANTHROPIC_AUTH_TOKEN and outlining the alternative custom-headers flow and tradeoffs.
    • Revised setup guidance: clarified caching behavior, adjusted logout/restart wording, and updated all example configuration snippets to use the recommended token approach for provider/model pinning.

Walkthrough

Updated docs/cli-agents/claude-code.mdx to document Claude Code Bifrost authentication with a new "Authentication Methods" section promoting ANTHROPIC_AUTH_TOKEN as the recommended approach, revised configuration caching guidance, and migrated all JSON configuration examples from ANTHROPIC_CUSTOM_HEADERS to the new token-based method.

Changes

Claude Code authentication documentation

Layer / File(s) Summary
Authentication Methods section and configuration guidance
docs/cli-agents/claude-code.mdx
New "Authentication Methods" section documents ANTHROPIC_AUTH_TOKEN as recommended and ANTHROPIC_CUSTOM_HEADERS as alternative, with updated settings.json caching guidance, model field handling, and logout/restart instructions.
Example migrations and deprecated guidance removal
docs/cli-agents/claude-code.mdx
Removed conflicting note about ANTHROPIC_CUSTOM_HEADERS usage and migrated all provider/model pinning JSON examples across the document to use ANTHROPIC_AUTH_TOKEN: your-virtual-key instead of the previous ANTHROPIC_CUSTOM_HEADERS approach.

Sequence Diagram(s)

(omitted — doc-only changes, no runtime component interactions)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • maximhq/bifrost#3562: Modifies the same docs file's Bifrost virtual-key examples; overlaps on auth example guidance.
  • maximhq/bifrost#3597: Also touches authentication setup in the same docs/cli-agents/claude-code.mdx env examples.

Suggested reviewers

  • akshaydeo

Poem

🐰✨ I hopped through docs with nimble paws,
Swapped headers for tokens without a pause.
Examples updated, secrets in line,
Users will follow the token-sign.
thump thump 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: recommending ANTHROPIC_AUTH_TOKEN over ANTHROPIC_CUSTOM_HEADERS for Claude Code authentication.
Description check ✅ Passed The description covers all critical sections: purpose, changes made, type of change, affected areas, testing instructions, breaking changes, and security considerations. It follows the repository template structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 05-22-refactor_claude_code_integration_recommended_authentication_method

Comment @coderabbitai help to get the list of available commands and usage tips.

impoiler commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@impoiler
impoiler changed the base branch from dev to graphite-base/3686 May 22, 2026 07:00
@impoiler impoiler changed the title refactor: claude code integration recommended authentication method docs: recommend ANTHROPIC_AUTH_TOKEN over ANTHROPIC_CUSTOM_HEADERS for Claude Code auth May 22, 2026
@impoiler impoiler self-assigned this May 22, 2026
@impoiler
impoiler force-pushed the graphite-base/3686 branch from 78376b2 to fbd0edc Compare May 22, 2026 07:01
@impoiler
impoiler force-pushed the 05-22-refactor_claude_code_integration_recommended_authentication_method branch from 8177210 to 3c226a6 Compare May 22, 2026 07:01
@impoiler
impoiler changed the base branch from graphite-base/3686 to main May 22, 2026 07:01
@impoiler
impoiler marked this pull request as ready for review May 22, 2026 07:05
@coderabbitai
coderabbitai Bot requested a review from akshaydeo May 22, 2026 07:06
@greptile-apps

greptile-apps Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Documentation-only change with no code modifications; safe to merge.

The change is confined to a single .mdx documentation file. The new content is accurate (the Authorization header is already in Bifrost's default whitelist, and the trade-off description for each auth method is technically correct). All five settings.json snippets are updated consistently. No logic, migrations, or runtime behavior is affected.

No files require special attention.

Important Files Changed

Filename Overview
docs/cli-agents/claude-code.mdx Documentation update replacing ANTHROPIC_CUSTOM_HEADERS with ANTHROPIC_AUTH_TOKEN across all config examples and adding a new Authentication Methods section with clear trade-off explanation for each approach.

Reviews (2): Last reviewed commit: "refactor: claude code integration recomm..." | Re-trigger Greptile

Comment thread docs/cli-agents/claude-code.mdx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/cli-agents/claude-code.mdx (1)

51-170: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Add required Mintlify tabs for configuration guidance.

The updated config section still presents raw snippets without the required Web UI / API / config.json tabbed structure for docs pages. Please wrap these setup instructions/snippets in the mandated tabs and ensure the config.json tab example aligns with transports/config.schema.json.

As per coding guidelines, docs/**/*.mdx: Mintlify MDX documentation must have Web UI / API / config.json tabs; validate config.json examples against transports/config.schema.json.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/cli-agents/claude-code.mdx` around lines 51 - 170, The docs page
docs/cli-agents/claude-code.mdx must be updated to use the mandated Mintlify
tabbed layout: wrap the relevant setup sections and all JSON snippets into three
tabs labeled "Web UI", "API", and "config.json" (use the "Web UI" tab for UI
instructions/screenshots and "API" for env/auth guidance), and move the concrete
settings.json example into the "config.json" tab; ensure the config.json example
conforms to transports/config.schema.json (validate keys like env,
ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and provider-specific DEFAULT_* model
keys and remove any disallowed top-level fields such as model), keeping the
existing images and routing instructions in their appropriate tabs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/cli-agents/claude-code.mdx`:
- Around line 54-57: Rewrite the note as step-by-step bullets: instruct the user
to open settings.json and remove the "model" field if present (it overwrites env
model selection), then save the file; start Claude, run the /logout command, and
restart Claude; finally, explain auth behavior: if using ANTHROPIC_AUTH_TOKEN no
Anthropic console login is required, but if using ANTHROPIC_CUSTOM_HEADERS
select "Anthropic Console account · API usage billing" when prompted. Ensure
each action is its own bullet for clarity.

---

Outside diff comments:
In `@docs/cli-agents/claude-code.mdx`:
- Around line 51-170: The docs page docs/cli-agents/claude-code.mdx must be
updated to use the mandated Mintlify tabbed layout: wrap the relevant setup
sections and all JSON snippets into three tabs labeled "Web UI", "API", and
"config.json" (use the "Web UI" tab for UI instructions/screenshots and "API"
for env/auth guidance), and move the concrete settings.json example into the
"config.json" tab; ensure the config.json example conforms to
transports/config.schema.json (validate keys like env, ANTHROPIC_BASE_URL,
ANTHROPIC_AUTH_TOKEN, and provider-specific DEFAULT_* model keys and remove any
disallowed top-level fields such as model), keeping the existing images and
routing instructions in their appropriate tabs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1b7c19ac-5588-4c73-93f9-6ce106a620a7

📥 Commits

Reviewing files that changed from the base of the PR and between fbd0edc and 3c226a6.

📒 Files selected for processing (1)
  • docs/cli-agents/claude-code.mdx

Comment thread docs/cli-agents/claude-code.mdx Outdated
@impoiler
impoiler force-pushed the 05-22-refactor_claude_code_integration_recommended_authentication_method branch from 3c226a6 to 3f9c8e8 Compare May 22, 2026 07:17

akshaydeo commented May 22, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • May 22, 7:20 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 22, 7:20 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit a0ea316 into main May 22, 2026
14 checks passed
@akshaydeo
akshaydeo deleted the 05-22-refactor_claude_code_integration_recommended_authentication_method branch May 22, 2026 07:20
Vaibhav701161 pushed a commit that referenced this pull request May 26, 2026
…` for Claude Code auth (#3686)

## Summary

Updates the Claude Code documentation to recommend `ANTHROPIC_AUTH_TOKEN` as the primary authentication method over `ANTHROPIC_CUSTOM_HEADERS`. Using `ANTHROPIC_AUTH_TOKEN` eliminates the requirement for users to log in with an Anthropic account, since Bifrost handles all routing and authentication through the virtual key.

## Changes

- Added an "Authentication Methods" section explaining both `ANTHROPIC_AUTH_TOKEN` (recommended) and `ANTHROPIC_CUSTOM_HEADERS` (alternative), including the caveat that `ANTHROPIC_CUSTOM_HEADERS` still requires an Anthropic account login
- Replaced `ANTHROPIC_CUSTOM_HEADERS: x-bf-vk: your-virtual-key` with `ANTHROPIC_AUTH_TOKEN: your-virtual-key` across all configuration examples (non-Anthropic, Anthropic, Bedrock, Vertex, Azure)
- Updated the caching/setup note to clarify the login flow differs depending on which authentication method is used
- Removed the previous blanket note recommending `ANTHROPIC_CUSTOM_HEADERS` for all versions

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [x] Documentation
- [ ] Chore/CI

## Affected areas

- [ ] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [x] Docs

## How to test

Review the updated Claude Code documentation page and verify:
- The "Authentication Methods" section clearly explains both options and their trade-offs
- All configuration snippets use `ANTHROPIC_AUTH_TOKEN` instead of `ANTHROPIC_CUSTOM_HEADERS`
- The setup note accurately reflects the login requirements for each method

## Breaking changes

- [ ] Yes
- [x] No

## Security considerations

`ANTHROPIC_AUTH_TOKEN` passes the virtual key via the `Authorization: Bearer` header, which is the standard bearer token pattern. Users no longer need to expose or manage Anthropic account credentials when using the recommended method.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [x] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
@akshaydeo akshaydeo mentioned this pull request May 26, 2026
akshaydeo added a commit that referenced this pull request May 26, 2026
## ✨ Features

- **Azure v1 API Migration** — Migrated Azure provider to the v1 API:
removed the `api-version` query parameter and the
`/openai/deployments/{model}/...` URL pattern in favor of
`/openai/v1/{operation}`; the `api_version` field has been dropped from
`AzureKeyConfig` (#3661, #3756)
- **EnvVar Support for OTEL & Prometheus Configs** — `CollectorURL`,
`MetricsEndpoint`, headers, push gateway URL, and basic auth credentials
can now be sourced from environment variables (e.g.,
`env.OTEL_COLLECTOR_URL`); added a new `ConfigMarshallerPlugin`
interface that lets plugins control storage/redaction round-trips
(#3651)
- **OTel Extra Header Forwarding** — `x-bf-eh-*` extra headers forwarded
to upstream providers are now also emitted on the request span under
`gen_ai.request.extra_header.*` for end-to-end tracing (#3730)
- **OTel Semantic Conventions** — Aligned OTel attribute keys with the
OpenTelemetry GenAI spec (canonical `gen_ai.*` and new `bifrost.*`
attributes); legacy attributes are retained in parallel to avoid
breaking existing dashboards (#3732)
- **VK Quota with Provider Configs** — `GetVirtualKeyQuotaByValue` and
the `getVirtualKeyQuota` HTTP response now include `provider_configs`
with their budgets and rate limits (#3721)
- **MCP Temp Token Non-Auth Toggle** — Added
`mcp_enable_temp_token_auth` client config flag to gate short-lived MCP
token minting for non-authenticated users (#3720)
- **Responses Stream in JSON Parser** — `jsonparser` plugin now handles
OpenAI Responses API streaming (`ResponsesStreamRequest`) in addition to
chat completions (#3749)
- **Session API Rework** — Logout now calls both the password-based
session logout and OAuth logout endpoints and resets all RTK Query cache
state (#3698)

## 🐞 Fixed

- **Streaming Latency for Observability** — Deferred root span
termination to the trace completer callback for streaming requests so
request latency is no longer inflated by header-flush time (#3762)
- **Stream Cancellation Race** — Set `BifrostContextKeyConnectionClosed`
before closing the stream and short-circuit `idleTimeoutReader.Read`
when the connection is already closed to avoid panics and hangs on
cancellation (#3733)
- **Bedrock Cache Points** — Strip cache points from Bedrock requests
for models that do not support prompt caching (e.g., GLM, Llama) to
avoid Converse API errors (#3754)
- **Bedrock Empty Text Blocks** — Skip empty/nil text blocks during
Bedrock response conversion to avoid invalid messages (#3747)
- **Bedrock Reasoning + Tools** — Preserve reasoning content blocks on
assistant turns that also contain tool calls in the Bedrock chat
converter (#3690)
- **Bedrock Search Content & Video** — Restored search content and video
parts that were being dropped from Bedrock-native passthrough requests
(#3729)
- **Structured Output Stop Reason** — Fixed an incorrect `tool_calls`
finish reason when structured output is combined with extended-thinking
tools (#3685)
- **Gemini Tool Schema Passthrough** — Forward full tool parameter
schemas via `parametersJsonSchema` instead of the lossy `parameters`
form; corrected tool response role to `user`; resolved structured output
+ tools conflict (#3761)
- **Anthropic Stop Reason & Tool Versions** — Normalized stop reason
mapping (`end_turn` to `stop`, `tool_use` to `tool_calls`, `max_tokens`
to `length`) and upgraded `text_editor_20250124`/`str_replace_editor` to
`text_editor_20250728` for computer-use tools (#3761)
- **Azure Endpoint Redaction** — Fixed a panic when
`AzureKeyConfig.Endpoint` is a literal value rather than an env
reference (#3761)
- **Auth Middleware Path Match** — Match temp-token auth middleware
whitelist against the request path only, not the full URI with query
parameters (#3737)
- **Governance Blocked Models UI** — Restored the missing Blocked Models
create/edit UI in the VK provider config sheet (#3750)
- **Logging Plugin Cleanup Drain** — Fixed a shutdown race where
`batchWriter` could drop in-flight log entries; `Cleanup` now drains
both the recovered batch and remaining queue within a 30-second budget
(#3717)
- **Model Rankings Empty Entries** — Excluded entries with empty `model`
values from model rankings matview queries so blank rows no longer
surface in the UI (#3758)
- **User Filter Duplicates** — Recreated `mv_filter_users` matview to
require non-empty `user_name`, eliminating duplicate filter dropdown
entries (#3764)
- **User Filter Display Name** — Use `user_name` instead of `user_id` as
the display label for users in logging filters (#3691)
- **Large Numeric ID Precision** — Preserve large numeric IDs in URL
search params by skipping JSON parsing for plain strings (#3692)

## 🔧 Refactors & Chores

- **Error Propagation for GetAvailable\* APIs** — `GetAvailable*`
methods on `LoggerPlugin`/`LogManager` now return wrapped errors instead
of silently logging and returning empty slices (#3759)
- **Governance Blocklist Matching** — Use `slices.Contains` for VK
blocked-model matching for clearer code with identical semantics (#3727)
- **Exported `ResolvePeriod`** — Renamed `resolvePeriod` to
`ResolvePeriod` so external packages can reuse the period parsing
(#3763)

## 📚 Docs

- **OTEL Env Var Documentation** — Documented `env.VAR_NAME` support for
`collector_url`, `metrics_endpoint`, and headers in OTEL/Prometheus
plugin docs
- **OTEL OSS Features & Examples** — Added OTEL documentation to the OSS
features list with usage examples (#3731)
- **Anthropic Auth Recommendation** — Recommend `ANTHROPIC_AUTH_TOKEN`
over `ANTHROPIC_CUSTOM_HEADERS` for Claude Code authentication (#3686)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files API Support

2 participants