만약 Claude Pro 또는 Max를 유료로 결제하고, 동시에 자체 코드에서 Claude에 대한 스크립팅 작업을 한다면 이중으로 비용을 지불할 수 있습니다. Anthropic은 구독 청구와 API 크레딧을 완전히 별개의 계정으로 관리하며, 일반적인 anthropic SDK는 오직 API 관련 정보만 알고 있습니다. 하지만 Claude Agent SDK가 구독에 맞춰 청구되도록 하는 공식적으로 지원되는 경로가 존재합니다. 여기서는 Python과 TypeScript에서 이 방법을 설명합니다. 두 언어의 전체 설정 및 작동 예시를 나란히 보여주는 작은 보조 레포지토리가 있습니다: 👉 github.com/avivshaked/prototype-with-claude-max 이것이 개념 모델입니다. Anthropic은 두 개의 별도 청구 관계를 유지합니다:
| Auth | 무엇인가요? | 어디서 비용을 지불하나요? |
|---|
| ANTHROPIC_API_KEY | 콘솔 API 키 | 사용량 기반 (Pay-as-you-go) |
et — it would shadow your OAuth token. unset it. " ) from claude_agent_sdk import query , ClaudeAgentOptions , AssistantMessage , TextBlock async def main (): async for msg in query ( prompt = " Say hello in one short sentence. " , options = ClaudeAgentOptions ( allowed_tools = []), ): if isinstance ( msg , AssistantMessage ): for block in msg . content : if isinstance ( block , TextBlock ): print ( block . text ) asyncio . run ( main ()) That's it. Bills against your Max subscription, not API credits. The repo has the same thing in TypeScript, plus a WebSearch + token-by-token streaming example. The gotcha worth knowing about Auth precedence on the SDK is: cloud creds → 2. ANTHROPIC_AUTH_TOKEN → 3. ANTHROPIC_API_KEY → 4. apiKeyHelper → 5. CLAUDE_CODE_OAUTH_TOKEN → 6. interactive /login If you have ANTHROPIC_API_KEY exported from another project (and you almost certainly do), it silently wins over your OAuth token. You'll be billing API credits while thinking you're using your subscription. unset ANTHROPIC_API_KEY The repo includes a check_auth.py / check-auth.ts script that tells you exactly which auth method is winning, so you can diagnose instead of guessing. ⚠️ Personal use only This works because the OAuth token is licensed for individual use through Claude Code and the Agent SDK. Do not ship a multi-user app on it: You'd run everyone's traffic through one person's quota — you'd hit rate limits in seconds at any real load. It likely violates Anthropic's terms. Pro/Max pl
답변은 개별 사용자를 위한 것이며, 2026년 4월부로 Anthropic은 구독 인증을 다른 도구에 연결하려는 타사 하네스(harnesses)를 적극적으로 차단합니다. 유출된 토큰은 누구나 여러분의 구독을 고갈시킬 수 있으므로 주기적으로 교체해야 합니다. 프로덕션 환경에서는 SDK가 아닌 인증 방식을 변경해야 합니다. Agent SDK 자체는 프로덕션 등급입니다. console.anthropic.com에서 ANTHROPIC_API_KEY를 지정하면 됩니다. 전체 내용은 리포지토리의 최상위 README에, Python과 TypeScript용 개별 언어 README에는 설정 지침, 각각 3개의 작동 예제(hello, check_auth, news with streaming + WebSearch), 그리고 문제 해결표가 있습니다. 레포: avivshaked/prototype-with-claude-max 만약 Anthropic에 이중으로 비용을 지불해 왔다면, 이것이 개인 스크립트의 문제를 약 5분 만에 해결해 줄 것입니다.