Skip to content

fix(auth): accept direct Anthropic API keys#73

Open
EfeDurmaz16 wants to merge 2 commits into
vercel-labs:mainfrom
EfeDurmaz16:efe/deepsec-direct-anthropic-api-key
Open

fix(auth): accept direct Anthropic API keys#73
EfeDurmaz16 wants to merge 2 commits into
vercel-labs:mainfrom
EfeDurmaz16:efe/deepsec-direct-anthropic-api-key

Conversation

@EfeDurmaz16
Copy link
Copy Markdown

Summary

  • accept ANTHROPIC_API_KEY as valid Claude Agent SDK credentials for direct Anthropic usage
  • update .env.example and docs to recommend AI_GATEWAY_API_KEY for gateway routing and ANTHROPIC_API_KEY for direct Anthropic
  • add preflight coverage so direct Anthropic users are not blocked before the SDK runs

Fixes #55.

Verification

  • pnpm install --frozen-lockfile
  • pnpm vitest run --project cli packages/deepsec/src/__tests__/preflight.test.ts
  • pnpm lint
  • pnpm --filter deepsec build
  • git diff --check

Note: install completed with an existing workspace bin warning for node_modules/.bin/deepsec before the package build artifact exists.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

@EfeDurmaz16 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestion:

resolveBrokeredCredentials() only reads ANTHROPIC_AUTH_TOKEN, ignoring ANTHROPIC_API_KEY, causing sandbox runs to silently fail with 401 when only ANTHROPIC_API_KEY is set.

Fix on Vercel

Signed-off-by: EfeDurmaz16 <efebarandurmaz05@gmail.com>
@EfeDurmaz16
Copy link
Copy Markdown
Author

Checked the review suggestion about direct ANTHROPIC_API_KEY support. The current PR tip already contains the follow-up fix.

Current branch state:

  • resolveBrokeredCredentials() now falls back from ANTHROPIC_AUTH_TOKEN to ANTHROPIC_API_KEY.
  • credential-brokering tests cover direct ANTHROPIC_API_KEY and precedence when both variables are set.

Verification:

  • pnpm test packages/deepsec/src/__tests__/credential-brokering.test.ts packages/deepsec/src/__tests__/preflight.test.ts

Commit: 76d1381

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.

"Invalid bearer token" when using Anthropic direct

1 participant