A custom Claude Code skill that helps you set up OAuth tokens to use your Claude Max/Pro subscription programmatically instead of paying per-token API costs.
When you have a Claude Max ($20/mo) or Pro subscription, you can use it programmatically via OAuth tokens instead of paying separately for API usage. This skill guides you through generating and configuring that token.
| Token Type | Prefix | Package | Billing |
|---|---|---|---|
| OAuth Token | sk-ant-oat01-* |
claude-agent-sdk |
Uses your Max/Pro subscription |
| API Key | sk-ant-api03-* |
anthropic |
Pay per token ($3-15/M tokens) |
- Download
setup-claude-token.mdfrom this repo - Place it in your Claude Code commands folder:
- Windows:
C:\Users\<YOU>\.claude\commands\ - Mac/Linux:
~/.claude/commands/
- Windows:
- Restart Claude Code
curl -o ~/.claude/commands/setup-claude-token.md https://raw.githubusercontent.com/buildingvibes/setup-token-skill/main/setup-claude-token.mdInvoke-WebRequest -Uri "https://raw.githubusercontent.com/buildingvibes/setup-token-skill/main/setup-claude-token.md" -OutFile "$env:USERPROFILE\.claude\commands\setup-claude-token.md"Once installed, open Claude Code and run:
/setup-claude-token
Claude will guide you through:
- Installing the Claude Code CLI (if needed)
- Generating your OAuth token via browser login
- Saving the token securely
- Testing that it works
Claude Code looks for .md files in ~/.claude/commands/. Each file becomes a slash command:
~/.claude/commands/
├── setup-claude-token.md → /setup-claude-token
├── my-custom-skill.md → /my-custom-skill
└── deploy-helper.md → /deploy-helper
The markdown content becomes instructions that Claude follows when you invoke the command.
Once you have your token, use it in Python:
pip install claude-agent-sdk anyioimport anyio
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, TextBlock
async def ask_claude(prompt: str) -> str:
options = ClaudeAgentOptions(max_turns=1, model="claude-sonnet-4-20250514")
response = ""
async for msg in query(prompt=prompt, options=options):
if isinstance(msg, AssistantMessage):
for block in msg.content:
if isinstance(block, TextBlock):
response += block.text
return response
result = anyio.run(ask_claude, "What is the capital of France?")
print(result)| Model | Use Case |
|---|---|
claude-sonnet-4-20250514 |
Balanced (recommended) |
claude-opus-4-20250514 |
Most capable |
claude-haiku-4-20250514 |
Fastest |
| Error | Solution |
|---|---|
| "Raw mode is not supported" | Run claude setup-token in a standalone terminal, not VS Code |
| "401 authentication_error" | You're using anthropic package - switch to claude-agent-sdk |
| Token not found | Make sure CLAUDE_CODE_OAUTH_TOKEN is set in your environment |
MIT