Skip to content

Conversation

@tanushmahalka
Copy link

@tanushmahalka tanushmahalka commented Jan 30, 2026

Summary

This PR adds support for ANTHROPIC_OAUTH_TOKEN as an alternative authentication method, allowing Claude Pro/Max subscribers to use moltworker without needing separate API billing.

Changes:

  • Add ANTHROPIC_OAUTH_TOKEN to the MoltbotEnv type definition
  • Pass OAuth token through the environment builder to containers
  • Update validation logic to accept either API key OR OAuth token
  • Add request logging for OAuth token presence
  • Fix: Remove redundant telegram dm config initialization that was causing issues

Usage

Users can now set their OAuth token instead of an API key:

wrangler secret put ANTHROPIC_OAUTH_TOKEN
# paste token from: claude config get oauth_token

Closes #34

Test Plan

  • Verify moltworker starts with only ANTHROPIC_OAUTH_TOKEN set (no API key)
  • Verify existing ANTHROPIC_API_KEY flow still works
  • Verify telegram configuration works without errors

Allow users to authenticate using their OAuth token as an alternative
to API keys. This enables Claude Pro subscribers to use the moltworker
gateway without needing separate API billing.

- Add ANTHROPIC_OAUTH_TOKEN to MoltbotEnv type
- Pass OAuth token through environment builder
- Update validation to accept either API key or OAuth token
- Add logging for OAuth token presence
Remove unnecessary 'config.channels.telegram.dm' initialization that
was causing configuration issues. The dmPolicy is set directly without
needing the intermediate dm object.
config.channels.telegram = config.channels.telegram || {};
config.channels.telegram.botToken = process.env.TELEGRAM_BOT_TOKEN;
config.channels.telegram.enabled = true;
config.channels.telegram.dm = config.channels.telegram.dm || {};
Copy link

Choose a reason for hiding this comment

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

oops

Choose a reason for hiding this comment

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

yeah this change needs to be reverted

config.channels.telegram = config.channels.telegram || {};
config.channels.telegram.botToken = process.env.TELEGRAM_BOT_TOKEN;
config.channels.telegram.enabled = true;
config.channels.telegram.dm = config.channels.telegram.dm || {};

Choose a reason for hiding this comment

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

yeah this change needs to be reverted

@montanaflynn
Copy link

Only issue with this is that the oauth token is short lived and needs to be refreshed periodically.

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.

Support for CLAUDE_CODE_OAUTH_TOKEN for subscription users

4 participants