@kapybara/zerosub 1.18.2 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -1
- package/client/accounts-surface.tsx +49 -11
- package/client/add-account.tsx +36 -9
- package/client/bedrock-account.tsx +455 -0
- package/client/settings-screen.tsx +1 -1
- package/client/switch-row.tsx +4 -2
- package/index.server.ts +17 -0
- package/package.json +1 -1
- package/server/api-usage.ts +47 -4
- package/server/bedrock.ts +437 -0
- package/server/claude.ts +17 -0
- package/server/codex.ts +1 -1
- package/server/homes.ts +8 -1
- package/server/limits.ts +111 -0
- package/server/routing.ts +22 -7
- package/server/service.ts +532 -47
- package/server/state.ts +4 -1
- package/shared/model.ts +60 -3
- package/shared/preferences.ts +3 -3
- package/shared/rpc.ts +56 -1
- package/shared/timeline.ts +2 -0
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ Use several Claude, ChatGPT (Codex), Grok and Cursor subscriptions side by side
|
|
|
16
16
|
- **Grok accounts.** Sign in several Grok (SuperGrok, X Premium+) accounts for Paseo's Grok agents and pick the one each new agent starts on. See [Grok accounts](#grok-accounts).
|
|
17
17
|
- **Cursor accounts.** Sign in several Cursor accounts for Paseo's Cursor agents (`cursor-agent`) and pick the one each new agent starts on (Linux only for now). See [Cursor accounts](#cursor-accounts).
|
|
18
18
|
- **Azure OpenAI accounts.** Add an Azure OpenAI key under ChatGPT (Codex) and pick it for an agent or make it the default. ZeroSub only moves work onto it by itself if you turn that on, and then only when every ChatGPT subscription is out (after a banked reset, if you let ZeroSub spend those). See [Azure OpenAI accounts](#azure-openai-accounts).
|
|
19
|
+
- **AWS Bedrock accounts.** Add Claude Code on Amazon Bedrock under Claude, with the host's own AWS credentials, a profile or an access key, and pick it for an agent or make it the default. ZeroSub only moves work onto it by itself if you turn that on, then only when every Claude subscription is out (after a banked reset, if you let ZeroSub spend those), and back once one has room. See [AWS Bedrock accounts](#aws-bedrock-accounts).
|
|
19
20
|
- **Pi accounts.** Add Anthropic API keys for Paseo's Pi agents, each with an optional base URL and its own proxy, and pick one per Pi agent. See [Pi accounts](#pi-accounts).
|
|
20
21
|
- **Everything else stays the same.** Every account shares your settings, skills, plugins, MCP servers, `CLAUDE.md`/`AGENTS.md` and conversation history.
|
|
21
22
|
|
|
@@ -139,7 +140,7 @@ When a Claude account has extra usage turned on (pay-as-you-go past the plan's l
|
|
|
139
140
|
ZeroSub tries these in order, and a timeline note says which one happened.
|
|
140
141
|
|
|
141
142
|
1. **Use a banked reset**, if you turned on **Use banked resets when every account is out**.
|
|
142
|
-
2. **Move to
|
|
143
|
+
2. **Move to a paid API account** with room, if you turned on **Use paid API accounts when every subscription is out**: an [Azure OpenAI account](#azure-openai-accounts) for a ChatGPT agent, an [AWS Bedrock account](#aws-bedrock-accounts) for a Claude agent, as it would to another account of its provider. A free reset always goes first: both are billed per token. A Claude agent moves back once a subscription account has room.
|
|
143
144
|
3. **Fork the chat to the other provider**, if you turned on **When every account is out, fork the chat to the other provider** (off by default). A stopped Claude chat continues in a new ChatGPT agent, or the other way round:
|
|
144
145
|
- The new agent opens in the same workspace (under the same parent, for a sub-agent) with the conversation so far and goes straight back to work. If that conversation began as a hand-off itself, only the start and end of the earlier one are quoted. It uses the other provider's default model and its account with the most room left.
|
|
145
146
|
- **OpenCode instead:** in the settings under the fork switch, **Fork a stopped Claude chat to** can point at **OpenCode** rather than ChatGPT. A stopped Claude chat then continues on this host's OpenCode, using the model and thinking option picked there from OpenCode's catalog (or the host's default when the host marks one). OpenCode is a harness, not an account provider: the fork uses no ZeroSub account, and nothing is added to your accounts. If the saved model or thinking option is no longer in the host's catalog, the fork is refused with a note rather than falling back to another model.
|
|
@@ -199,6 +200,61 @@ It's remade whenever `~/.codex/config.toml` has changed, checked each time a ses
|
|
|
199
200
|
- Token counts need the Codex session file. A turn whose file isn't found (a thread whose file is more than 120 days of folders back, or a Codex that keeps sessions elsewhere) is counted as "couldn't be counted", and the card says the totals are short. Turns run on the account from a terminal aren't seen.
|
|
200
201
|
- ChatGPT conversations can't change accounts, so a task that moved to Azure keeps its Azure tab; new agents go to a ChatGPT account once one has room, not that tab.
|
|
201
202
|
|
|
203
|
+
## AWS Bedrock accounts
|
|
204
|
+
|
|
205
|
+
A Claude account can also be Claude Code on Amazon Bedrock in your AWS account: Claude agents then run on Bedrock, billed per token by AWS, and ZeroSub manages the account like any other.
|
|
206
|
+
|
|
207
|
+
**Add one.** Under Claude, click **Add account → AWS Bedrock** (the same chooser offers a Claude subscription, an API key or token, and a folder that's signed in already) and enter:
|
|
208
|
+
|
|
209
|
+
- **Name**, as for any account.
|
|
210
|
+
- **AWS region**, as a code (`us-east-1`, `eu-central-1`). The form fills it in when the host names one: the daemon's `AWS_REGION` or `AWS_DEFAULT_REGION`, the region of its profile in `~/.aws/config` (or `AWS_CONFIG_FILE`), or, on an EC2 instance, the instance's own (IMDSv2). That's looked up only when the form opens, for at most a second and a half, never at startup.
|
|
211
|
+
- **Credentials**, from one of:
|
|
212
|
+
- **Host's AWS credentials**: the AWS default chain where the daemon runs (its environment, `~/.aws`, an EC2 instance or ECS task role). Nothing is stored.
|
|
213
|
+
- **AWS profile**: a profile in the host's `~/.aws/config`. Only its name is stored.
|
|
214
|
+
- **Access key**: an access key ID and secret, with a session token for temporary credentials. Stored in the account's home (see below).
|
|
215
|
+
- **Models** (optional): model or inference-profile IDs for `ANTHROPIC_MODEL` and `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL` and `ANTHROPIC_DEFAULT_HAIKU_MODEL`, as enabled in your AWS account. Empty ones keep Claude Code's own Bedrock defaults. Claude Code maps Paseo's own model IDs (`claude-opus-5-5`, `claude-sonnet-5-5`, `claude-haiku-5-5`) to Bedrock by itself, but its built-in defaults for the `opus`, `sonnet` and `haiku` aliases can be older than what your region offers (in `eu-central-1`, `sonnet` pointed at a Sonnet 4.5 profile the region didn't have). If an alias fails there, fill in the Opus, Sonnet and Haiku models with inference profiles your AWS account has, such as `global.anthropic.claude-sonnet-5-5`.
|
|
216
|
+
|
|
217
|
+
There's no sign-in. If the host has the `aws` command, ZeroSub checks the credentials with it, only when you add the account or change its credentials or region: `aws sts get-caller-identity`, then `aws bedrock list-inference-profiles` in the region. Missing, wrong or expired credentials (or a profile that doesn't exist) aren't saved. Without the `aws` command, offline, or when listing inference profiles is refused, the account is saved anyway and a warning says so; its first turn tells for sure. The key button on its card changes the region, credentials (an empty secret keeps the stored one for the same key ID), models and the price table. Removing the account deletes its home, with its AWS settings (and access key), once no open agent uses it, and its token counts; its agents move to the default account, as from any Claude account.
|
|
218
|
+
|
|
219
|
+
**When it's used.** It's billed per use, so by default ZeroSub never moves work onto it by itself, like any API-key account:
|
|
220
|
+
|
|
221
|
+
- Pick it for an agent (the account button, `/account <name>`, the next-new-agent pick), or make it the default; then new agents start on it.
|
|
222
|
+
- Automatic choices (failover at a limit, **Spread new agents across accounts**, a default that's out, **Fork the chat to the other provider**) skip it.
|
|
223
|
+
|
|
224
|
+
With **Use paid API accounts when every subscription is out** on (off by default; the same switch as for [Azure OpenAI accounts](#azure-openai-accounts), in Accounts or **Settings → Plugins → zerosub → ZeroSub preferences**), it takes over as a last resort:
|
|
225
|
+
|
|
226
|
+
- Automatic choices then use it only when every Claude subscription account is at its limit, disabled or signed out. A Claude agent that hits its limit moves to another Claude subscription account with room first, then spends a banked reset if **Use banked resets when every account is out** is on and one can be spent; only then does it move onto Bedrock in the same conversation, as it would to another Claude account, and its timeline says it runs on AWS Bedrock, a paid API, because every subscription account is out.
|
|
227
|
+
- With **Use banked resets when every account is out** on too, a Claude subscription account at its limit whose latest reading shows a banked reset it can use now goes before Bedrock: a new agent opens on it, and an agent already on it stays there when it resumes or the 30-second check runs, so its next turn spends the reset. Only when no reset can be spent does an agent start on, or move to, Bedrock.
|
|
228
|
+
- It isn't pinned there. Once its own account, or another Claude subscription account, has room again (or, with **Use banked resets when every account is out** on, one has a banked reset to spend), the 30-second check moves it back, and its timeline says so. New agents go back to a subscription account then too. A ChatGPT chat continued on Claude (**Fork the chat to the other provider**, or **Continue on Claude (new agent)…** from the account button) that lands on Bedrock is held there the same way: it moves to a Claude subscription account once one can take it. Only an agent you put on Bedrock yourself (picked for it, or Bedrock as the default) stays; when you change the default away from Bedrock with **Move open agents when the default changes** off, its open agents stay on Bedrock as your pick.
|
|
229
|
+
|
|
230
|
+
**Claude's Auto mode.** Paseo won't start a turn in Claude's Auto mode, its default Claude mode, on Bedrock ("Claude Auto mode requires the Anthropic API"). So ZeroSub never moves an agent in Auto mode onto Bedrock by itself (failover, a new or resumed agent, the 30-second check, a fork from ChatGPT), nor one whose mode Paseo doesn't say, and the agent's timeline says why when that leaves it at its limit: switch it to another mode (Accept File Edits, say) to let it move. Paseo can't say a new agent's mode before the agent exists, so on Paseo 0.16 and later ZeroSub notes the mode it's created in (in the agent's metadata, `zerosub.created-mode`, only while paid fallback is on and there's a Bedrock account), and a new agent in another mode starts on Bedrock right away. On an older Paseo a new agent never starts on Bedrock by itself: it opens on the subscription account, its first turn hits the limit, and failover then moves it to Bedrock. An Auto-mode agent put on Bedrock by hand or as the default gets Paseo's refusal; ZeroSub notes in its timeline to pick another mode, and leaves the account as it is.
|
|
231
|
+
|
|
232
|
+
Either way, Bedrock has no 5-hour or weekly limits, so the account counts as available unless AWS turns a turn down. What's read for that is a failed turn's failure and error rows, and Claude Code's own error replies ("API Error: …") among the turn's last two replies, whether the turn failed or completed (Paseo before 0.16 reports such a turn as completed), never an agent's reply that only mentions one. A completed turn's warnings, error rows and tool output (an MCP server's "HTTP 401 Unauthorized", an `AccessDenied` from a command the agent ran) are another service's, and never touch the account.
|
|
233
|
+
|
|
234
|
+
- Throttling (`ThrottlingException`, HTTP 429, "Too many tokens") sets it aside for a minute; an exceeded service quota (`ServiceQuotaExceededException`) for five. While every Claude subscription account is out too, its agents stay on it rather than go back to one at its limit (at failover, for idle agents, and at the 30-second check), and the agent that was turned down says every account is at its limit.
|
|
235
|
+
- Refused credentials or access (`AccessDeniedException`, HTTP 401/403, an invalid or expired security token, no credentials found): ZeroSub checks the credentials again first, as when they're saved (`aws sts get-caller-identity`, then `aws bedrock list-inference-profiles`). Only if AWS refuses them too is the account marked signed out, with AWS's answer on its card, until you change its settings. If they pass, or can't be checked (no `aws` command, AWS can't be reached), the account stays usable and the daemon's log says so.
|
|
236
|
+
- A model Bedrock names as unusable ("You don't have access to the model with the specified model ID", "The provided model identifier is invalid", a model that needs an inference profile) marks it signed out the same way without that check: only Bedrock words it so, and the credentials are fine. Change the model overrides in its settings.
|
|
237
|
+
- A model Claude Code finds missing in the account's region ("The model … is not available on your bedrock deployment") leaves the account as it is: other models still run there. The agent's timeline names the model and says to set the model overrides (see **Models** below) or pick another model for the agent.
|
|
238
|
+
|
|
239
|
+
**Where the credentials are.** The region, credential source, profile name, model overrides and prices are in the account's home, `$PASEO_HOME/zerosub/homes/claude-<id>/bedrock.json`, readable only by you; for an access key, so are the key ID, the secret and the session token. Unlike other Claude accounts' folders, a Bedrock account's home stays in `homes/`, managed by ZeroSub: it's never moved to `~/.claude-config` (or the folder picked under the Claude accounts) and gets no terminal script, since its access key reaches Claude Code only in the session's environment; removing the account deletes it, `bedrock.json` and all. **A folder that's signed in already** turns down a folder with a `bedrock.json`: to add a Bedrock account back, add it again with **AWS Bedrock**. `bedrock.json` is never linked into or out of any Claude home. The registry marks the account as Bedrock (`provider: "bedrock"`; a Claude API-key account has no such mark and keeps its own form) and keeps its region and source, an access key by a short hash of its ID. The app only ever gets the key ID's last four characters; ZeroSub never logs a secret, and leaves it out of what the `aws` command says when it's shown.
|
|
240
|
+
|
|
241
|
+
**How it runs.** The home is a Claude home like any added account's: shared entries are links to `~/.claude`, and there's no sign-in in it. When Paseo opens a session there, ZeroSub sets `CLAUDE_CONFIG_DIR` to the home, `CLAUDE_CODE_USE_BEDROCK=1`, `AWS_REGION` and `AWS_DEFAULT_REGION`, and blanks what would send it elsewhere or sign it in another way (`ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `CLAUDE_CODE_OAUTH_TOKEN`, `ANTHROPIC_BASE_URL`, `ANTHROPIC_CUSTOM_HEADERS`, the Vertex and Foundry switches). By source:
|
|
242
|
+
|
|
243
|
+
- Host: the daemon's own AWS variables are left as they are.
|
|
244
|
+
- Profile: `AWS_PROFILE` is set, and `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN` and `AWS_BEARER_TOKEN_BEDROCK` are blanked, since they'd come before it.
|
|
245
|
+
- Access key: those three are set from `bedrock.json`, read right then, and `AWS_PROFILE` and `AWS_BEARER_TOKEN_BEDROCK` are blanked.
|
|
246
|
+
|
|
247
|
+
The model variables are set from the overrides, or blanked so a model named for your subscriptions doesn't reach Bedrock. Its generated `settings.json` is `~/.claude/settings.json` with the account's own `settings.account.json` on top, as for any added account, then made to agree with that environment: the same `env` (never a secret), no `apiKeyHelper`, and, unless it uses the host's credentials, no `awsAuthRefresh` or `awsCredentialExport`. A proxy set for the account with the globe button stays in it.
|
|
248
|
+
|
|
249
|
+
**Usage.** In place of usage bars, the card shows the tokens used this calendar month (UTC): input (with how much was read from and written to the cache) and output, and an estimated cost. At the end of each turn on the account, ZeroSub reads the agent's Claude Code session file (`~/.claude/projects/<project>/<session>.jsonl`, which every Claude account shares) and adds the assistant messages written since the turn started, each one once. Totals are kept by model in `$PASEO_HOME/zerosub/api-usage.json`, with Azure's, and start again each month. The cost comes from the price table in the account's settings (USD per million input, cache read, cache write and output tokens, per model as Claude Code names it; a cache read or write without a price counts at the input price). With no prices it says "cost unknown". It's an estimate from Claude Code's own counts, not AWS's bill.
|
|
250
|
+
|
|
251
|
+
**Limitations.**
|
|
252
|
+
|
|
253
|
+
- An access key reaches Claude Code through the session's environment, which Paseo starts the agent with; anything that can read that process's environment can read it. Use the host's credentials or a profile to keep it out of ZeroSub's files.
|
|
254
|
+
- Project settings (`.claude/settings.json` in a repository) that set another provider or AWS credentials still apply on top, as they would in Claude Code.
|
|
255
|
+
- Token counts need the Claude Code session file. A turn whose file isn't found is counted as "couldn't be counted", and the card says the totals are short. Turns run on the account from a terminal aren't seen.
|
|
256
|
+
- The check covers the credentials, not each model: a model your AWS account hasn't enabled in the region shows up as a refusal on its first turn.
|
|
257
|
+
|
|
202
258
|
## Pi accounts
|
|
203
259
|
|
|
204
260
|
Paseo's built-in **Pi** agents get a section of their own once [Pi](https://github.com/earendil-works/pi) is installed where the daemon runs. Its first card is Pi's own login, `~/.pi/agent` (or `PI_CODING_AGENT_DIR` in the daemon's environment), with whatever it's signed in to. ZeroSub changes its files only when you edit its key or proxy on that card (see below; otherwise it only makes the directory and its `sessions` folder if they're missing, for added accounts to share), and a Pi agent on it runs as Paseo would run it without ZeroSub. Nothing else changes for Pi until you add an account: no scripts, no folders outside ZeroSub's own, no address checks. **Add account** under Pi adds an Anthropic API key as an account, each with:
|
|
@@ -312,6 +368,7 @@ ZeroSub never implements OAuth itself and never copies credentials between accou
|
|
|
312
368
|
- Removing an account moves its agents to the default account, then signs it out (`claude auth logout` / `codex` logout / `grok logout` / `cursor-agent logout`) and deletes its home. This happens once no agent is mid-turn on it. Abandoned sign-ins are cleaned up the same way; one a restart interrupted is deleted only if it isn't signed in.
|
|
313
369
|
- ZeroSub only signs out or deletes homes it recorded for cleanup when you removed the account or started the sign-in, never a home just because the registry doesn't list it: a damaged or hand-edited registry may simply be missing accounts. Folders in `homes/` that no account uses are left alone and named in the log at startup.
|
|
314
370
|
- An Azure OpenAI account's key is in its home's `azure.json` only (see [Azure OpenAI accounts](#azure-openai-accounts)), and is sent nowhere but its endpoint.
|
|
371
|
+
- An AWS Bedrock account's access key, if it has one, is in its home's `bedrock.json` only (see [AWS Bedrock accounts](#aws-bedrock-accounts)), and is handed only to its own sessions and the `aws` command that checks it. The region the Bedrock form fills in is looked up when it opens, never at startup.
|
|
315
372
|
- An account that still has ChatGPT conversations on it can't be removed until you archive them or continue them elsewhere, because they can't move. Grok and Cursor conversations can only be archived.
|
|
316
373
|
- Your CLI login can't be removed from ZeroSub.
|
|
317
374
|
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { AddAccountModal } from "./add-account";
|
|
18
18
|
import { ApiAccountModal } from "./api-account";
|
|
19
19
|
import { AzureAccountModal, AzureUsage, azureCardDetails } from "./azure-account";
|
|
20
|
+
import { BedrockAccountModal, BedrockUsage, bedrockCardDetails } from "./bedrock-account";
|
|
20
21
|
import { ForkDestinationRows, OpenCodeForkRows } from "./fork-settings";
|
|
21
22
|
import { AddPiAccountModal, ApiKeyModal, HomesHint, PiSectionNotes, ProxyModal, ShellHint, piCardDetails } from "./pi-accounts";
|
|
22
23
|
import { PaceSection } from "./pace";
|
|
@@ -260,7 +261,9 @@ function FamilySection({
|
|
|
260
261
|
? "Add a Pi account with an Anthropic API key and its own proxy"
|
|
261
262
|
: family === "codex"
|
|
262
263
|
? "Sign in another ChatGPT account, or add an Azure OpenAI key"
|
|
263
|
-
:
|
|
264
|
+
: family === "claude"
|
|
265
|
+
? "Sign in another Claude account, or add an API key or AWS Bedrock"
|
|
266
|
+
: `Sign in another ${FAMILY_LABEL[family]} account`
|
|
264
267
|
}
|
|
265
268
|
tooltipAlign="end"
|
|
266
269
|
onPress={onAdd}
|
|
@@ -315,7 +318,7 @@ function AccountCard({
|
|
|
315
318
|
account: AccountView;
|
|
316
319
|
theme: Theme;
|
|
317
320
|
store: ZeroSubStore;
|
|
318
|
-
/** Paid API accounts (Azure) may take work over by themselves once every subscription is out. */
|
|
321
|
+
/** Paid API accounts (Azure, Bedrock) may take work over by themselves once every subscription is out. */
|
|
319
322
|
paidFallback: boolean;
|
|
320
323
|
onSignIn(): void;
|
|
321
324
|
}) {
|
|
@@ -329,13 +332,18 @@ function AccountCard({
|
|
|
329
332
|
// An Azure OpenAI account's endpoint, key and prices have a form of their own.
|
|
330
333
|
const azure = account.azure !== null;
|
|
331
334
|
const [editingAzure, setEditingAzure] = useState(false);
|
|
332
|
-
|
|
335
|
+
// So do an AWS Bedrock account's region, credentials, models and prices.
|
|
336
|
+
const bedrock = account.bedrock !== null;
|
|
337
|
+
const [editingBedrock, setEditingBedrock] = useState(false);
|
|
338
|
+
const details = bedrock
|
|
339
|
+
? [bedrockCardDetails(account), claudeCardDetails(account)].filter(Boolean).join(" · ")
|
|
340
|
+
: (piCardDetails(account) ?? claudeCardDetails(account) ?? azureCardDetails(account));
|
|
333
341
|
const [confirmRemove, setConfirmRemove] = useState(false);
|
|
334
342
|
const [confirmReset, setConfirmReset] = useState(false);
|
|
335
343
|
const resets = account.usage?.resets ?? null;
|
|
336
344
|
const credits = account.usage?.credits ?? null;
|
|
337
345
|
const extraUsage = account.usage?.extraUsage ? formatExtraUsage(account.usage.extraUsage) : null;
|
|
338
|
-
const plan = azure ? null : formatPlan(account.plan);
|
|
346
|
+
const plan = azure || bedrock ? null : formatPlan(account.plan);
|
|
339
347
|
const summary = usageSummary(account);
|
|
340
348
|
const subtitle = accountSubtitle(account);
|
|
341
349
|
const signedOut = account.status === "signed_out";
|
|
@@ -508,6 +516,15 @@ function AccountCard({
|
|
|
508
516
|
{azure ? (
|
|
509
517
|
<IconButton theme={theme} icon="KeyRound" label="Azure settings" tooltip="Azure settings: endpoint, key and prices" onPress={() => setEditingAzure(true)} />
|
|
510
518
|
) : null}
|
|
519
|
+
{bedrock ? (
|
|
520
|
+
<IconButton
|
|
521
|
+
theme={theme}
|
|
522
|
+
icon="KeyRound"
|
|
523
|
+
label="Bedrock settings"
|
|
524
|
+
tooltip="Bedrock settings: region, credentials, models and prices"
|
|
525
|
+
onPress={() => setEditingBedrock(true)}
|
|
526
|
+
/>
|
|
527
|
+
) : null}
|
|
511
528
|
{account.proxyEditable ? (
|
|
512
529
|
<IconButton theme={theme} icon="Globe" label="Proxy" tooltip="Proxy: the network this account uses" onPress={() => setEditingProxy(true)} />
|
|
513
530
|
) : null}
|
|
@@ -536,7 +553,13 @@ function AccountCard({
|
|
|
536
553
|
{account.isDefault ? <Badge theme={theme} label="Default" tone="accent" /> : null}
|
|
537
554
|
{disabled ? <Badge theme={theme} label="Disabled" /> : null}
|
|
538
555
|
{plan ? <Badge theme={theme} label={plan} /> : null}
|
|
539
|
-
{azure ?
|
|
556
|
+
{azure ? (
|
|
557
|
+
<Badge theme={theme} label="Azure · API" />
|
|
558
|
+
) : bedrock ? (
|
|
559
|
+
<Badge theme={theme} label="Bedrock · API" />
|
|
560
|
+
) : api ? (
|
|
561
|
+
<Badge theme={theme} label="API" />
|
|
562
|
+
) : null}
|
|
540
563
|
{account.kind === "main" ? <Badge theme={theme} label="CLI login" /> : null}
|
|
541
564
|
{account.status === "limited" ? <Badge theme={theme} label="Limit reached" tone="danger" /> : null}
|
|
542
565
|
{account.status === "signed_out" ? <Badge theme={theme} label="Signed out" tone="warning" /> : null}
|
|
@@ -559,9 +582,19 @@ function AccountCard({
|
|
|
559
582
|
|
|
560
583
|
<View style={[{ gap: 10 }, faded]}>
|
|
561
584
|
{signedOut ? (
|
|
562
|
-
<Text style={text.small}>
|
|
585
|
+
<Text style={text.small}>
|
|
586
|
+
{bedrock
|
|
587
|
+
? `AWS refused it${account.apiError ? `: ${account.apiError}` : "."} Fix its credentials, region or models to use this account.`
|
|
588
|
+
: azure && account.apiError
|
|
589
|
+
? `Azure refused the key: ${account.apiError} Enter a working one to use this account.`
|
|
590
|
+
: api
|
|
591
|
+
? "The key was refused. Enter a working one to use this account."
|
|
592
|
+
: "Sign in again to use this account."}
|
|
593
|
+
</Text>
|
|
563
594
|
) : azure ? (
|
|
564
595
|
<AzureUsage theme={theme} account={account} paidFallback={paidFallback} />
|
|
596
|
+
) : bedrock ? (
|
|
597
|
+
<BedrockUsage theme={theme} account={account} paidFallback={paidFallback} />
|
|
565
598
|
) : api ? (
|
|
566
599
|
<Text style={text.small}>Billed per use · used only as the default or when picked for an agent</Text>
|
|
567
600
|
) : windows.length > 0 ? (
|
|
@@ -605,10 +638,10 @@ function AccountCard({
|
|
|
605
638
|
size="small"
|
|
606
639
|
tone="primary"
|
|
607
640
|
icon={api ? "KeyRound" : "LogIn"}
|
|
608
|
-
label={api ? "Fix key" : "Sign in"}
|
|
609
|
-
tooltip={api ? "Enter a working key for this account" : "Sign this account in again"}
|
|
641
|
+
label={bedrock ? "Fix settings" : api ? "Fix key" : "Sign in"}
|
|
642
|
+
tooltip={bedrock ? "Fix this account's AWS credentials, region or models" : api ? "Enter a working key for this account" : "Sign this account in again"}
|
|
610
643
|
tooltipAlign="end"
|
|
611
|
-
onPress={azure ? () => setEditingAzure(true) : api ? () => setEditingApi(true) : onSignIn}
|
|
644
|
+
onPress={azure ? () => setEditingAzure(true) : bedrock ? () => setEditingBedrock(true) : api ? () => setEditingApi(true) : onSignIn}
|
|
612
645
|
/>
|
|
613
646
|
) : disabled ? (
|
|
614
647
|
<Button
|
|
@@ -667,6 +700,9 @@ function AccountCard({
|
|
|
667
700
|
{editingAzure ? (
|
|
668
701
|
<AzureAccountModal theme={theme} store={store} account={account} paidFallback={paidFallback} onClose={() => setEditingAzure(false)} />
|
|
669
702
|
) : null}
|
|
703
|
+
{editingBedrock ? (
|
|
704
|
+
<BedrockAccountModal theme={theme} store={store} account={account} paidFallback={paidFallback} onClose={() => setEditingBedrock(false)} />
|
|
705
|
+
) : null}
|
|
670
706
|
{editingProxy ? <ProxyModal theme={theme} store={store} account={account} onClose={() => setEditingProxy(false)} /> : null}
|
|
671
707
|
<Modal title={`Remove ${account.label}?`} open={confirmRemove} onOpenChange={setConfirmRemove}>
|
|
672
708
|
<Modal.Content>
|
|
@@ -675,7 +711,9 @@ function AccountCard({
|
|
|
675
711
|
? `This only removes the account from ZeroSub. Its folder${account.home ? ` (${account.home})` : ""}, its key${account.launcher ? ` and its terminal script ${account.launcher}` : ""} stay as they are, and you can add it back from Add account. Agents using it move to the default account; their conversations are kept.`
|
|
676
712
|
: account.family === "pi"
|
|
677
713
|
? "This deletes the account's folder and saved key on this machine. Agents using it move to the default account; their conversations are kept."
|
|
678
|
-
:
|
|
714
|
+
: bedrock
|
|
715
|
+
? "This deletes the account's folder on this machine, with its AWS settings (and access key, if it has one) and its token counts. Agents using it move to the default account; their conversations are kept."
|
|
716
|
+
: azure
|
|
679
717
|
? "This deletes the account's saved key and endpoint on this machine, and its token counts. New agents use the default account. Existing ChatGPT conversations on it can't move, so start new agents for them."
|
|
680
718
|
: account.family === "claude"
|
|
681
719
|
? "This signs the account out on this machine and deletes its saved login. Agents using it move to the default account; their conversations are kept."
|
|
@@ -862,7 +900,7 @@ function AutomationSettings({ theme, compact }: { theme: Theme; compact: boolean
|
|
|
862
900
|
/>
|
|
863
901
|
<SettingsSwitch
|
|
864
902
|
label="Use paid API accounts when every subscription is out"
|
|
865
|
-
hint="Off unless you turn it on. When every
|
|
903
|
+
hint="Off unless you turn it on. When every subscription account of a provider is at its limit, signed out or disabled, agents may move to an Azure OpenAI account (ChatGPT) or an AWS Bedrock account (Claude), billed per token (after a banked reset, if those are used automatically), and Claude agents move back once a subscription has room. Off, those are used only as the default or when you pick one for an agent."
|
|
866
904
|
value={settings.values.paidApiFallback}
|
|
867
905
|
disabled={settings.saving}
|
|
868
906
|
onValueChange={(paidApiFallback) => save({ paidApiFallback })}
|
package/client/add-account.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { FAMILY_LABEL, type AccountView, type Family, type LoginMethod, type Log
|
|
|
7
7
|
import { cancelLogin, importAccount, startLogin, submitLoginCode } from "../shared/rpc";
|
|
8
8
|
import { ApiAccountForm } from "./api-account";
|
|
9
9
|
import { AzureAccountForm } from "./azure-account";
|
|
10
|
+
import { BedrockAccountForm } from "./bedrock-account";
|
|
10
11
|
import { useInputStyle } from "./pi-accounts";
|
|
11
12
|
import { describe, useStore, type ZeroSubStore } from "./store";
|
|
12
13
|
import { Button, useText } from "./ui";
|
|
@@ -47,10 +48,10 @@ export function AddAccountModal({
|
|
|
47
48
|
const askProxy = family === "claude" && !accountId;
|
|
48
49
|
const [proxy, setProxy] = useState("");
|
|
49
50
|
const [proxyDone, setProxyDone] = useState(!askProxy);
|
|
50
|
-
// A new Claude account is a subscription to sign in, an API key or token,
|
|
51
|
-
//
|
|
51
|
+
// A new Claude account is a subscription to sign in, an API key or token, a folder that's signed
|
|
52
|
+
// in already, or AWS Bedrock; a new ChatGPT one, a subscription or an Azure OpenAI key. Asked first.
|
|
52
53
|
const askMode = askProxy || (family === "codex" && !accountId);
|
|
53
|
-
const [mode, setMode] = useState<"ask" | "subscription" | "api" | "import">(askMode ? "ask" : "subscription");
|
|
54
|
+
const [mode, setMode] = useState<"ask" | "subscription" | "api" | "import" | "bedrock">(askMode ? "ask" : "subscription");
|
|
54
55
|
const [apiAdded, setApiAdded] = useState<string | null>(null);
|
|
55
56
|
const [apiWarning, setApiWarning] = useState<string | null>(null);
|
|
56
57
|
const [imported, setImported] = useState<string | null>(null);
|
|
@@ -121,7 +122,9 @@ export function AddAccountModal({
|
|
|
121
122
|
const azure = family === "codex";
|
|
122
123
|
const title = accountId
|
|
123
124
|
? "Sign in again"
|
|
124
|
-
: mode === "
|
|
125
|
+
: mode === "bedrock"
|
|
126
|
+
? "Add AWS Bedrock account"
|
|
127
|
+
: mode === "api"
|
|
125
128
|
? azure
|
|
126
129
|
? "Add Azure OpenAI account"
|
|
127
130
|
: "Add Claude API account"
|
|
@@ -139,6 +142,7 @@ export function AddAccountModal({
|
|
|
139
142
|
onSubscription={() => setMode("subscription")}
|
|
140
143
|
onApi={() => setMode("api")}
|
|
141
144
|
onImport={() => setMode("import")}
|
|
145
|
+
onBedrock={() => setMode("bedrock")}
|
|
142
146
|
onCancel={close}
|
|
143
147
|
/>
|
|
144
148
|
);
|
|
@@ -159,7 +163,7 @@ export function AddAccountModal({
|
|
|
159
163
|
) : (
|
|
160
164
|
<ImportStep theme={theme} store={store} onDone={setImported} onCancel={close} />
|
|
161
165
|
);
|
|
162
|
-
} else if (mode === "api") {
|
|
166
|
+
} else if (mode === "api" || mode === "bedrock") {
|
|
163
167
|
const added = apiAdded ? state?.accounts.find((entry) => entry.id === apiAdded) : undefined;
|
|
164
168
|
body = apiAdded ? (
|
|
165
169
|
<>
|
|
@@ -167,8 +171,8 @@ export function AddAccountModal({
|
|
|
167
171
|
<Text style={text.body}>
|
|
168
172
|
{added?.label ?? "The account"} is ready. Make it the default, or pick it for an agent from the account button in
|
|
169
173
|
the message box;{" "}
|
|
170
|
-
{azure && state?.paidApiFallback
|
|
171
|
-
?
|
|
174
|
+
{(azure || mode === "bedrock") && state?.paidApiFallback
|
|
175
|
+
? `ZeroSub moves agents onto it by itself only when every ${azure ? "ChatGPT" : "Claude"} subscription account is out.`
|
|
172
176
|
: "ZeroSub never moves agents onto it by itself."}
|
|
173
177
|
</Text>
|
|
174
178
|
{apiWarning ? <Text style={text.warning}>{apiWarning}</Text> : null}
|
|
@@ -176,6 +180,17 @@ export function AddAccountModal({
|
|
|
176
180
|
<Button theme={theme} tone="primary" label="Done" tooltip="Close this window" tooltipAlign="end" onPress={onClose} />
|
|
177
181
|
</Row>
|
|
178
182
|
</>
|
|
183
|
+
) : mode === "bedrock" ? (
|
|
184
|
+
<BedrockAccountForm
|
|
185
|
+
theme={theme}
|
|
186
|
+
store={store}
|
|
187
|
+
paidFallback={state?.paidApiFallback ?? false}
|
|
188
|
+
onDone={(id, warning) => {
|
|
189
|
+
setApiWarning(warning);
|
|
190
|
+
setApiAdded(id);
|
|
191
|
+
}}
|
|
192
|
+
onCancel={close}
|
|
193
|
+
/>
|
|
179
194
|
) : azure ? (
|
|
180
195
|
<AzureAccountForm
|
|
181
196
|
theme={theme}
|
|
@@ -487,8 +502,9 @@ function describeAccount(account: AccountView): string {
|
|
|
487
502
|
}
|
|
488
503
|
|
|
489
504
|
/**
|
|
490
|
-
* How a new account connects: a Claude one, a subscription to sign in, an API key or token,
|
|
491
|
-
* folder that's signed in already; a ChatGPT one, a subscription to sign in or an
|
|
505
|
+
* How a new account connects: a Claude one, a subscription to sign in, an API key or token, a
|
|
506
|
+
* folder that's signed in already, or AWS Bedrock; a ChatGPT one, a subscription to sign in or an
|
|
507
|
+
* Azure OpenAI key.
|
|
492
508
|
*/
|
|
493
509
|
function ModeStep({
|
|
494
510
|
theme,
|
|
@@ -498,6 +514,7 @@ function ModeStep({
|
|
|
498
514
|
onSubscription,
|
|
499
515
|
onApi,
|
|
500
516
|
onImport,
|
|
517
|
+
onBedrock,
|
|
501
518
|
onCancel,
|
|
502
519
|
}: {
|
|
503
520
|
theme: Theme;
|
|
@@ -509,6 +526,8 @@ function ModeStep({
|
|
|
509
526
|
onSubscription(): void;
|
|
510
527
|
onApi(): void;
|
|
511
528
|
onImport(): void;
|
|
529
|
+
/** Offered for Claude only. */
|
|
530
|
+
onBedrock(): void;
|
|
512
531
|
onCancel(): void;
|
|
513
532
|
}) {
|
|
514
533
|
const text = useText(theme);
|
|
@@ -540,6 +559,14 @@ function ModeStep({
|
|
|
540
559
|
detail="A Claude Code folder (its CLAUDE_CONFIG_DIR) signed in with a subscription: one you set up yourself, or one kept when you removed its account here. No sign-in; it stays where it is."
|
|
541
560
|
onPress={onImport}
|
|
542
561
|
/>
|
|
562
|
+
<Choice
|
|
563
|
+
theme={theme}
|
|
564
|
+
title="AWS Bedrock"
|
|
565
|
+
detail={`Claude Code on Amazon Bedrock in your AWS account, with the host's own AWS credentials, a profile or an access key. Billed per token; ${
|
|
566
|
+
paidFallback ? "used by itself only when every Claude subscription account is out, or when you choose it." : "used only when you choose it."
|
|
567
|
+
}`}
|
|
568
|
+
onPress={onBedrock}
|
|
569
|
+
/>
|
|
543
570
|
</>
|
|
544
571
|
) : (
|
|
545
572
|
<Choice
|