Anthropic’s Claude Code docs say consumer OAuth tokens from Free, Pro, and Max cannot be used with the Agent SDK, and staff said clearer guidance is coming. If you automate local dev loops or parallel workers, use API keys until the allowed auth patterns are explicit.

Anthropic's Claude Code legal and compliance page draws a hard line between consumer and commercial auth. The page says developers should authenticate with API keys from the Claude Console or supported cloud providers, and separately says OAuth tokens from Free, Pro, or Max accounts cannot be used in other products or services, "including the Agent SDK." Docs excerpt
That is the key implementation detail for engineers building wrappers around Claude Code. If a tool is calling the Agent SDK, Anthropic's published guidance currently treats consumer OAuth as the wrong credential path, even when the underlying goal is still Claude-assisted coding rather than a public SaaS integration. Original question
The dispute is not about whether developers want to automate Claude Code; it's about which abstraction layers Anthropic considers equivalent. In the TypeScript example, Matt Pocock says he assumed running Claude Code inside a bash script was allowed because Claude Code documents scripting as an expected use case. He then asks whether moving the same local workflow into a TypeScript script via the Agent SDK would suddenly become a terms violation.
That distinction matters for real tooling. The thread's specific use case was "parallelizing multiple Claude Code's" and potentially distributing an open-source helper that makes that parallelization easier. Thread details Anthropic's wording leaves engineers with a split model: shelling out to Claude Code may appear acceptable, while using Anthropic's own SDK with a consumer OAuth token for the same local-dev loop appears prohibited.
Anthropic did not offer a definitive allowed-pattern matrix in public. Instead, trq212 replied that the situation has been "confusing," said the team should be clearer, and promised a follow-up because "the Agent SDK spans a lot of use cases." Reply text
A later follow-up from trq212 adds operational context rather than a product change: Anthropic says usage has grown quickly across Claude.ai, Claude Code, enterprise workflows, and the Agent SDK, and explicitly acknowledges, "We have not done fully right by Agent SDK users." That leaves the current state unchanged for now: the public docs point developers to API-key-based authentication, while staff have only committed to clarifying how Agent SDK use cases should be interpreted.
The relevant compliance docs are here: code.claude.com/docs/en/legal-… "Using OAuth tokens obtained through Claude Free, Pro, or Max accounts in any other product, tool, or service — including the Agent SDK — is not permitted and constitutes a violation of the Consumer Terms of Show more
Can I get some questions answered by someone at Anthropic? 1. Can you use an OAuth token generated from a subscription to power the Claude Agent SDK strictly for using Claude Code in a local dev loop? All I want is a more reliable API for parallelizing multiple Claude Code's. Show more
Sorry this has been confusing. I know we should be clearer here, the Agent SDK spans a lot of use cases and that makes it tough to give guidance for. We're working on more clarity for this & I'll follow up. Thanks for bearing with us, been a hectic couple weeks.