[FEATURE] Allow OAuth tokens for Anthropic Messages API — enable subscription-based programmatic access

Resolved 💬 4 comments Opened Mar 21, 2026 by Tereseus Closed Apr 19, 2026

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:

  1. User speaks to PAN on phone
  2. Phone sends text to PAN server
  3. Server needs to call Claude API for a response
  4. 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.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗