Skip to content

feat(tui): support setup-token (OAuth) for Anthropic API calls#40

Merged
jalehman merged 1 commit into
Martian-Engineering:mainfrom
GodsBoy:feat/setup-token-support
Mar 10, 2026
Merged

feat(tui): support setup-token (OAuth) for Anthropic API calls#40
jalehman merged 1 commit into
Martian-Engineering:mainfrom
GodsBoy:feat/setup-token-support

Conversation

@GodsBoy

@GodsBoy GodsBoy commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Add OAuth setup-token support to lcm-tui's Anthropic API integration.

Closes #41

Part 1: Token resolution

  • resolveProviderAPIKey now checks CLAUDE_CODE_OAUTH_TOKEN env var and ~/.openclaw/secrets.json (anthropic-setup-token key) before the provider mode check
  • Token priority: ANTHROPIC_API_KEY env > CLAUDE_CODE_OAUTH_TOKEN env > secrets.json setup-token > openclaw.json provider config

Part 2: Header selection

  • summarizeAnthropic detects token prefix to choose the correct HTTP auth header:
    • sk-ant-oat prefix → Authorization: Bearer header
    • sk-ant-api or other → x-api-key header (existing behaviour)

Both token types work transparently with no config change needed. Existing API key users are unaffected.

Add two-part fix for OAuth setup-token support in lcm-tui:

1. resolveProviderAPIKey now checks CLAUDE_CODE_OAUTH_TOKEN env var and
   ~/.openclaw/secrets.json (anthropic-setup-token key) as additional
   token sources before the provider mode check. Priority order:
   ANTHROPIC_API_KEY > CLAUDE_CODE_OAUTH_TOKEN > secrets.json > config.

2. summarizeAnthropic now detects the token prefix to choose the correct
   HTTP auth header: sk-ant-oat tokens use Authorization: Bearer,
   while sk-ant-api and other tokens use x-api-key (existing behavior).

Both token types work transparently with no config change needed.
@jalehman jalehman merged commit 46e5e23 into Martian-Engineering:main Mar 10, 2026
billzhuang6569 pushed a commit to billzhuang6569/lossless-claw that referenced this pull request Mar 21, 2026
…an-Engineering#40)

Add two-part fix for OAuth setup-token support in lcm-tui:

1. resolveProviderAPIKey now checks CLAUDE_CODE_OAUTH_TOKEN env var and
   ~/.openclaw/secrets.json (anthropic-setup-token key) as additional
   token sources before the provider mode check. Priority order:
   ANTHROPIC_API_KEY > CLAUDE_CODE_OAUTH_TOKEN > secrets.json > config.

2. summarizeAnthropic now detects the token prefix to choose the correct
   HTTP auth header: sk-ant-oat tokens use Authorization: Bearer,
   while sk-ant-api and other tokens use x-api-key (existing behavior).

Both token types work transparently with no config change needed.
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.

feat(tui): support setup-token (OAuth) for Anthropic API calls

2 participants