[FEATURE] Allow OAuth tokens for Anthropic Messages API — enable subscription-based programmatic access
Summary
Claude Code's OAuth token (sk-ant-oat01-*) is rejected by the Anthropic Messages API with: "OAuth authentication is currently not supported."
This forces developers building on Claude Code to purchase separate API credits even though they already pay for a Claude subscription ($100/month for Max). This is significant friction for adoption.
Real-World Use Case
This was discovered while building ΠΑΝ (PAN) — an open-source personal AI assistant that uses Claude Code as its brain. PAN provides:
- Voice-controlled computer automation (terminal, files, browser)
- Phone app with real-time voice (Android)
- Camera vision analysis
- Cross-device orchestration
PAN's server needs to make programmatic Claude API calls for voice query responses. The flow:
- User speaks to PAN on phone
- Phone sends text to PAN server
- Server needs to call Claude API for a response
- Response spoken back to user via TTS
Initially we used claude -p (subprocess), but the process spawn overhead adds 3-5 seconds per query — unacceptable for voice conversation. Direct API calls via Haiku respond in ~500ms.
However, the OAuth token from the user's existing Claude subscription doesn't work with the API. We had to buy a separate $10 API credit package.
Impact
Every developer building automation tools, voice assistants, or AI agents on top of Claude Code hits this wall. The subscription already authorizes AI usage — the OAuth token should work for programmatic access too.
This would benefit:
- Voice assistant builders (PAN, custom assistants)
- Automation tool developers
- MCP server builders that need to make Claude calls
- Any application that extends Claude Code's capabilities
Proposed Solution
Allow sk-ant-oat01-* OAuth tokens in the Authorization: Bearer header or x-api-key header for the Messages API, respecting the user's existing subscription rate limits.
Environment
- Claude Code 2.1.79
- Claude Max subscription
- Windows 11 + Android
---
This issue was co-authored by Claude (Opus 4.6) while building PAN with the developer. The limitation was encountered during real development and independently verified.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗