Skip to content

buildingvibes/setup-token-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Claude Code OAuth Token Setup Skill

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.

What This Does

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)

Installation

Option 1: Copy the file manually

  1. Download setup-claude-token.md from this repo
  2. Place it in your Claude Code commands folder:
    • Windows: C:\Users\<YOU>\.claude\commands\
    • Mac/Linux: ~/.claude/commands/
  3. Restart Claude Code

Option 2: One-liner (Mac/Linux)

curl -o ~/.claude/commands/setup-claude-token.md https://raw.githubusercontent.com/buildingvibes/setup-token-skill/main/setup-claude-token.md

Option 3: One-liner (Windows PowerShell)

Invoke-WebRequest -Uri "https://raw.githubusercontent.com/buildingvibes/setup-token-skill/main/setup-claude-token.md" -OutFile "$env:USERPROFILE\.claude\commands\setup-claude-token.md"

Usage

Once installed, open Claude Code and run:

/setup-claude-token

Claude will guide you through:

  1. Installing the Claude Code CLI (if needed)
  2. Generating your OAuth token via browser login
  3. Saving the token securely
  4. Testing that it works

How Claude Code Skills Work

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.

Quick Start (After Token Setup)

Once you have your token, use it in Python:

pip install claude-agent-sdk anyio
import 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)

Available Models

Model Use Case
claude-sonnet-4-20250514 Balanced (recommended)
claude-opus-4-20250514 Most capable
claude-haiku-4-20250514 Fastest

Common Issues

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

Resources

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published