-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Summary
The run_loop.py description optimisation script in the skill-creator plugin fails when the user authenticates via Claude Max (OAuth) instead of an API key. The evaluation step (run_eval.py) works fine because it uses claude -p, but improve_description.py calls the Anthropic Python SDK directly via anthropic.Anthropic(), which requires ANTHROPIC_API_KEY.
Steps to reproduce
- Authenticate with Claude Max via
/login(OAuth flow) - Run the description optimisation loop:
python3 -m scripts.run_loop \ --eval-set eval_set.json \ --skill-path path/to/skill \ --model claude-opus-4-6 \ --max-iterations 5
- The eval runs complete successfully (using
claude -p) - The improve step crashes:
TypeError: "Could not resolve authentication method. Expected either api_key or auth_token to be set. Or for one of the `X-Api-Key` or `Authorization` headers to be explicitly omitted"
Root cause
improve_description.py (line 115) creates an anthropic.Anthropic() client directly, which looks for ANTHROPIC_API_KEY in the environment. Claude Max users authenticate via OAuth tokens managed by the CLI, not API keys.
Suggested fix
Route the improve_description call through claude -p (like run_eval.py already does), or read the OAuth token from the CLI's credential store. This would make the full loop work for both API key and Claude Max users.
Environment
- Claude Code with Claude Max subscription (OAuth authentication)
- macOS, Python 3.9
anthropicSDK installed via pip