Skip to content

"Invalid bearer token" when using Anthropic direct #55

Description

@joesaunderson

What happened

I have set ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL as per the docs (in .env.local within .deepsec directory.

I get:

Agent SDK error: Claude Code returned an error result: Failed to authenticate. API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"},"request_id":"..."}

Reproduction

pnpm deepsec process --project-id ...

Expected vs actual

I expect the requests to work, they didn't.

Environment

  • deepsec version (pnpm deepsec --version): 1.1.14
  • Node version (node --version): v24.11.1
  • OS: MacOS
  • Agent backend (claude-agent-sdk / codex): claude-agent-sdk
  • Model:

Logs

  > Investigating 4 file(s) with Claude Agent SDK (claude-opus-4-7)
    Turn 1 (107s, 0 tool calls)
    Turn 1 (107s, 0 tool calls)
    Turn 1 (110s, 0 tool calls)
    Agent SDK error: Claude Code returned an error result: Failed to authenticate. API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"},"request_id":"req_,..."}
    Agent SDK error: Claude Code returned an error result: Failed to authenticate. API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"},"request_id":"req_..."}
    Agent SDK error: Claude Code returned an error result: Failed to authenticate. API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"},"request_id":"req_..."}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions