Skip to content

OAuth (Claude Code keychain) + 2025-01-24 tool versions#9

Open
beemusicco wants to merge 3 commits into
PallavAg:mainfrom
beemusicco:oauth-and-2025-tools-bump
Open

OAuth (Claude Code keychain) + 2025-01-24 tool versions#9
beemusicco wants to merge 3 commits into
PallavAg:mainfrom
beemusicco:oauth-and-2025-tools-bump

Conversation

@beemusicco

Copy link
Copy Markdown

Summary

Refresh of the repo so it runs against the current Anthropic API on Apple Silicon (M-series) macOS in 2026.

  • Auth. Prefer the user's Claude Code OAuth access token from the macOS keychain (Claude Code-credentialsclaudeAiOauth.accessToken) before falling back to ANTHROPIC_API_KEY. Useful for Pro/Max subscribers who don't want to provision a separate console API key. Adds anthropic-beta: oauth-2025-04-20 when using OAuth.
  • Tool versions. Bumped to the current set — computer_20250124, bash_20250124, text_editor_20250728 (with the renamed str_replace_based_edit_tool), beta flag computer-use-2025-01-24. Current models (haiku-4-5, sonnet-4-5) reject the old *_20241022 tool family.
  • Default model. claude-3-5-sonnet-20241022 returns 404 from messages.create for Claude.ai-OAuth tokens now. Default switched to claude-haiku-4-5-20251001. Override with CCU_MODEL.

Test plan

  • python main.py "Take exactly ONE screenshot and write a one-sentence description" — happy path, single-turn.
  • Smoke test the OAuth route returns content (no 401, no scope mismatch).
  • Multi-step click flows (not in this PR; would need new actions like scroll/triple_click/hold_key/wait that computer_20250124 exposes — the model currently uses the subset that maps onto pyautogui).

Notes

  • Default model is haiku because the OAuth token shares its rate limit with the user's active Claude Code session, so the more frugal model is friendlier as a default. Sonnet/Opus work fine via CCU_MODEL when there's headroom.
  • The screencapture PATH fix is in the operator's local launcher, not in main.py (it's a downstream environment concern, not upstream-relevant).

Standalone-runnable refresh of @PallavAg's repo on Apple Silicon
Python 3.14 / anthropic SDK 0.109+ / haiku-4-5 / sonnet-4-5.

CHANGES
1. Auth: prefer Claude Code OAuth token from macOS keychain
   ('Claude Code-credentials' -> claudeAiOauth.accessToken).
   Falls back to ANTHROPIC_API_KEY env var.
   Sets anthropic-beta: oauth-2025-04-20 when using OAuth.
2. Tool versions:
     computer_20241022    -> computer_20250124
     bash_20241022        -> bash_20250124
     text_editor_20241022 -> text_editor_20250728
     editor name "str_replace_editor" -> "str_replace_based_edit_tool"
   Beta flag: computer-use-2024-10-22 -> computer-use-2025-01-24
3. Default model: claude-haiku-4-5-20251001 (claude-3-5-sonnet-20241022
   returns 404 / not-found at console.anthropic.com now). Override with
   env CCU_MODEL.

Note: claude-3-5-sonnet-20241022 is fully retired; computer_20241022
tool family is rejected by current models with "does not support tool
types: computer_20241022, bash_20241022, text_editor_20241022".
wait, scroll, triple_click, hold_key, left_mouse_down, left_mouse_up.
Also: left_click/right_click/middle_click/double_click/triple_click now
accept optional coordinate (move-then-click).

Tested end-to-end via OAuth + haiku-4-5: screenshot → wait 2s → scroll
down 3 at (640,400) → screenshot. All actions execute, no errors.

Safety caps: wait + hold_key duration clamped to 30s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant