ClaudeAgentSDK.Auth.Providers.Anthropic (claude_agent_sdk v0.14.0)

Copy Markdown View Source

Anthropic-specific authentication via claude setup-token.

Summary

Functions

Returns the environment variable name for Claude OAuth tokens.

Guides user through obtaining an OAuth token via claude setup-token.

Functions

oauth_env_var()

@spec oauth_env_var() :: String.t()

Returns the environment variable name for Claude OAuth tokens.

Examples

iex> ClaudeAgentSDK.Auth.Providers.Anthropic.oauth_env_var()
"CLAUDE_AGENT_OAUTH_TOKEN"

setup_token()

@spec setup_token() :: {:ok, String.t(), DateTime.t()} | {:error, term()}

Guides user through obtaining an OAuth token via claude setup-token.

The Claude CLI requires an interactive TTY, so this function prompts the user to run claude setup-token in a separate terminal and paste the resulting token.

Requirements

  • Claude Code CLI installed (v2.0.10+)
  • Active Claude subscription

Token Format

Accepts OAuth tokens (sk-ant-oat01-...) or API keys (sk-ant-api03-...).