Claude plan
Connect a Claude plan to AI Wallet through the sign in of Claude Code, with Anthropic's model list and the room of the plan's five hour and weekly windows.
The Claude plan account answers with the visitor's Claude subscription. The wallet lists it as Claude under "With your plan", with the id claude. A Claude API key is a separate account, described on the Claude API key page.
What the visitor needs
A Claude plan that signs in to Claude Code, Anthropic's command line tool. The answers count against that plan.
Sign in
- In the wallet, the visitor picks Claude under "With your plan".
- The wallet opens a window on
https://claude.ai/oauth/authorize, the sign in page of Claude Code, with a PKCE challenge. - The visitor signs in to claude.ai and authorizes the access.
- Claude sends the window to
http://localhost:54545/callback, an address that does not load. The wallet reads that address from the window as soon as it lands there and closes the window. - The wallet trades the code of that address for tokens at
https://platform.claude.com/v1/oauth/token, and the account is connected.
When the wallet misses the address, the visitor copies the whole address of the window into the "Address of the window" field of the side panel. An address from another sign in is refused with "this is not the address of this sign in". The sign in stays open for ten minutes.
The wallet renews the access token with the refresh token from one minute before it expires.
Models
The wallet lists Anthropic's catalog from https://api.anthropic.com/v1/models, asked with the plan's token, and keeps the list for a day. The visitor picks the account's default model in its settings, and a model per site with the buttons of the side panel. Without a choice, the account answers with claude-sonnet-5-5.
Usage and limits
The wallet reads two headers on each answer: anthropic-ratelimit-unified-5h-utilization and anthropic-ratelimit-unified-7d-utilization, the share used of the plan's five hour and weekly windows. The room left is one minus the higher of the two.
When Claude answers anthropic-ratelimit-unified-status: rejected, the account reads as spent. Auto then tries it last.
Calls
Answers come from https://api.anthropic.com/v1/messages?beta=true in Anthropic's Messages protocol. Each call carries the plan's token and the betas claude-code-20250219, oauth-2025-04-20 and interleaved-thinking-2025-05-14.
The wallet leaves temperature and topP out of these calls, since current Claude models answer them with an error. When your site sets no maxTokens, the call asks for 4096 tokens. Claude Opus 5.5, Claude Sonnet 5.5 and Claude Fable 5.1 refuse a forced tool choice (required or a named tool), and their error reaches your site with its status.
Known issues
- The sign in borrows the OAuth client of Claude Code.
- Anthropic answers a plan's request with 429
rate_limit_errorwhen its first system block is anything other than Claude Code's identity string. The wallet sends "You are Claude Code, Anthropic's official CLI for Claude." as the first system block, ahead of your site's system messages. - Anthropic answers a plan's token only on a request without an
Originheader, and treats the request as Claude Code only when it carries Claude Code'sUser-Agent. The wallet removesOriginand setsUser-Agent: claude-cli/2.1.280 (external, Chrome)on its calls toapi.anthropic.com. Its calls to the token endpoint carryUser-Agent: axios/1.15.2, the client Claude Code signs in with. - Since Anthropic's validation change of 6 November, the sign in must ask for the
org:create_api_keyscope and carry a state of at least 43 characters. Anthropic answers a shorter state with "Invalid request format". The wallet sends both.
Providers
Every AI account AI Wallet supports, how the visitor connects it and who pays, and how model choice, the room meter and Auto routing work.
ChatGPT plan
Connect a ChatGPT plan to AI Wallet through OpenAI's device sign in for Codex, with the Codex model list and the room of the plan's two usage windows.