Skip to content

skill-creator: run_loop.py fails with Claude Max (OAuth) - missing API key support #675

@noejon

Description

@noejon

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

  1. Authenticate with Claude Max via /login (OAuth flow)
  2. 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
  3. The eval runs complete successfully (using claude -p)
  4. 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
  • anthropic SDK installed via pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions