Repository navigation
cmux NEXT: Use an API key on a chat whose Claude Code or Codex is not signed in - #31517
Conversation
…r Codex is not signed in Leo, 2026-10-26: "if user picks a model they don't have api key, we offer them to add credits or add their own api key" #27058 shipped the Add Credits half (the router's plan and credit refusals). The key half waited on key plumbing (manaflow-ai/cmuxterm-hq#5411); #30188 has since given acpmux `_acpmux/agent_login/api_key`, which saves a key where the agent's own CLI reads it (Claude's settings.json env.ANTHROPIC_API_KEY, `codex login --with-api-key`) and restarts the chat on it. Only Cloud chats offered it. A chat on this Mac whose built-in `claude` or `codex` fails a turn for want of a sign-in now shows Use an API key after Sign in again; Save stores the key and Send again resends the failed prompt on the person's click. Routes (claude-cr, claude-sr) set their own key and endpoint, so they get no key field. Tests: bun test test/cloud-signin-card.test.tsx test/access-offer.test.tsx test/signed-out-rail.test.tsx -> 30 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-60c63e855fe3c933a547
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Gallery before/after for
States
Pick other states with a red: cmux-next checks (god files, concurrency, crash safety, l10n); NEW: Shipped in:
|
|
Review (subagent claude-opus-5-5 medium): SHIP at 1fdc977 The reviewer checked the real code. A local caller gets past acpmux's origin and shared-machine checks. The pane host allows Follow-ups (none blocking):
|
Leo-ask: ask-f74602af08
Leo, 2026-10-26: "if user picks a model they don't have api key, we offer them to add credits or add their own api key"
#27058 shipped the Add Credits half, on the cmux model router's plan and credit refusals. The add their own API key half waited on key plumbing (manaflow-ai/cmuxterm-hq#5411): a key the app saved never reached a built-in harness. #30188 has since given acpmux
_acpmux/agent_login/api_key. It saves a key where the agent's own CLI reads it (Claude'ssettings.jsonenv.ANTHROPIC_API_KEY, orcodex login --with-api-keywith the key on stdin) and restarts the chat on it. Until now only Cloud chats offered it, through the Cloud sign-in card.With this PR, a chat on this Mac whose built-in
claudeorcodexfails a turn because it isn't signed in offers Use an API key after Sign in again, as an outlined button. It uses the same key field as the Cloud card: a password input, then Save. Send again resends the failed prompt, and only on the person's click.cloudAgentLogin.ts: the shared builder is nowagentLogin.cloudAgentLogincovers Cloud chats, as before. The newlocalApiKeyLogincovers chats on this Mac, and only the built-inclaudeandcodexharnesses. Routes (claude-cr,claude-sr) set their own key and endpoint, so a saved key would never reach them and they get no key field.TurnRows.tsx: a sign-in failure with no Cloud card renders<CloudSignIn keyOnly>after Sign in again._acpmux/agent_login/api_keyon a click (AcpmuxPaneMethods.swift), and every acpmux advertisesagent_login.Once this lands, cmuxterm-hq#5411's key half is covered for local Claude Code and Codex chats. Two things stay open there: a router BYOK path, and Gemini.
Tests
bun test test/cloud-signin-card.test.tsx test/access-offer.test.tsx test/signed-out-rail.test.tsx: 30 pass. New tests cover:agent_login;agent_login/api_keyand Send again resending under a gesture ticket;Observed / Not run
scripts/web-lint.sh(fmt passed; the type-aware lint and the type check are left to CI on this host).Changelog
Agent session: agent session
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Lets a chat on this Mac whose built-in Claude Code or Codex isn't signed in offer Use an API key next to Sign in again. Previously only Cloud chats offered API key sign-in; this extends it to local built-in agents through the existing
_acpmux/agent_login/api_keypath, saving the key where the agent's own CLI reads it and restarting the chat on it.claude-cr,claude-sr) and Cloud chats get no key field: routes set their own key and endpoint, and a Cloud chat has its own card.Written for commit 1fdc977. Summary will update on new commits.