On a signed-in agy, `agy models` takes about 4.4s and `agy acp`'s
session/new about 3s. provider.models() needed three calls before
claude-opus-5-5, claude-sonnet-5-5 and gpt-oss-120b showed up, and
OpenCode 2.x calls it once.
What changed:
- packages/agy-cli/index.mjs:
- The offered-model probe now starts in listAgyModels' .then, as soon as
a non-empty list arrives and a caller asked for probeOffered. It no
longer waits for the next models() call. A hung or failed `agy models`
still never spawns the probe.
- probeSignedIn reuses the `agy models` stdout it already has. The same
parser (parseAgyModels, split out of listAgyModels) fills
cachedModelCatalog, and the probe starts. Sign-in waits for the probe
for at most 3s.
- The offer (acpOfferedModels, acpOfferedKey, offeredProbeAt and any
in-flight probe) is forgotten when agyPath changes and after a new
sign-in finishes. A generation counter drops the answer of a probe
that started before the reset.
- provider.warming() returns a promise while a list or probe is still
running, and null when nothing is.
- scripts/opencode2.mjs, copied byte for byte to every
packages/*/opencode2.mjs: after the first background refresh, the
adapter awaits hooks.provider.warming() once, for at most 60s, and then
refreshes once more. It does not loop. Plugins without warming() behave
as before.
- Not done: the issue's on-disk catalog cache (point 3), skipped as asked.
Known gap: agy-cli has no `config` hook, so under OpenCode 2.x the adapter
lists no provider for it. refresh() returns before it calls
provider.models(), so the follow-up refresh can't add agy's models on 2.x
until agy-cli gets a config hook.
Tests: test/testkit.mjs's fake agy takes a sessionNewDelayMs. The new
tests in test/catalog.mjs set 1.5s on both `agy models` and session/new
and wait for state through warming(), with no fixed sleeps:
- On a slow cold start, the first models() after warming lists Claude and
GPT, from one probe spawn.
- authorize() on a signed-in agy fills the catalog, and the next models()
runs no second `agy models`.
- The sign-in wait is bounded: with a 6s session/new, sign-in returns in
about 4.5s.
- Changing agyPath probes again.
The hang test now awaits warming() before it counts acp spawns.
scripts/opencode2.test.mjs: the warming list is read a second time when
warming ends, and only once when nothing is warming.
Run on Linux (a separate test Mac was over its load limit):
- packages/agy-cli bun test: 17 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
- bun scripts/check.mjs (all packages): ok.
- Root bun test in a temp HOME: 8530 pass, 19 skip, 0 fail.
Broken by hand on Linux, each red, then restored green:
- No probe in the .then: the slow cold-start test.
- probeSignedIn drops the list: the authorize and bounded-wait tests.
- agyPath change keeps the old offer: the agyPath test.
- Unbounded sign-in wait: the bounded-wait test (7514ms).
- Probe also on a failed listing: the hang test.
- origin/main's index.mjs with the new tests: all four #1064 tests.
- Adapter reads the list once: the warming adapter test, and the
copy-identity check.
Not tried: a real agy (no Google sign-in, no network). The reset after
login.finish has no unit test of its own.
Reported-by: hiee3
gumloop
Gumloop (gumloop.com) with your API key, in
OpenCode and magpie. Gumloop serves
an OpenAI-compatible chat completions API at https://ws.gumloop.com/api/v1; this
plugin signs every request with your key and user id, so agents reach its models
like any other provider, with magpie's multi-account fallback.
Provider id: gumloop
Sign-in
Gumloop → Settings → Connectors → Gumloop API Key: create a key, and copy the
User ID shown on the same page. magpie plugin login gumloop (or the sign-in
button in the app) asks for:
| Prompt | Required | Used for |
|---|---|---|
| API key | yes | Authorization: Bearer <key> |
| User ID | yes | x-auth-key: <user id> |
| Account email | no | names the account in magpie |
| Credits left | no | starts the credit estimate (see below) |
The key and user id are checked against GET api.gumloop.com/api/v1/models before
they are kept. They are stored as { "type": "api", "key", "metadata": { "userId", … } }
in magpie's plugin-auth.json (permissions 600). A key Gumloop refuses marks the
account for sign-in again.
Models
The models your account can use, listed per account from GET /models: active,
unrestricted chat models that call tools. Gumloop's own router (gumloop-chew),
image, voice, transcription and classifier models are left out. Context is the
model's short window where Gumloop gives one, since every call bills the whole
context.
Model ids use the account catalog's names, such as gumloop/glm-5.3.
The plugin translates these to the chat endpoint's route IDs (for example,
accounts/fireworks/models/glm-5p3). Older aliases such as glm-5p3 still work.
MiniMax M3 is temporarily omitted: on 2026-11-11 Gumloop's route rejected even
minimal requests with Extra inputs are not permitted, field: 'provider'.
MiniMax M3.1 Flash is supported. Muse and MiniMax M3.1 Flash require a nonempty
system or developer message; if none is supplied, the plugin adds "You are a
helpful assistant." Existing nonempty instructions are preserved.
Requests are rewritten the way Gumloop takes them: max_completion_tokens becomes
max_tokens, reasoning_effort becomes reasoning.effort, streams ask for their
usage, and a model's output cap is learned from its first refusal. Set
{"cache1h": true} in the plugin's options to opt into a 1-hour Anthropic prompt
cache TTL on Claude requests.
Credits
Gumloop's API has no balance endpoint, so the usage card is an estimate:
- each call is priced from its token usage at list price (OpenRouter's prices, re-read every 12 hours; Fireworks-hosted models at the standard Fireworks endpoint price, excluding spot tiers; Z.AI and Gemma use their provider endpoints; built-in prices when OpenRouter can't be reached), at $0.005 a credit, rounded up to a whole credit per call, as Gumloop bills;
- the result is taken off the balance you gave, from when you gave it.
Prices and rounding are estimates, not a reconciliation with Gumloop's invoice. Provider discounts, routing changes and unavailable live long-context rates can make the estimate differ. Models with no known price are counted as unpriced, not as free calls.
Spend on gumloop.com itself (flows, Gumball) shows only when you calibrate again. A stream stopped mid-way never reports its usage; the card counts those so you know to recalibrate. An out-of-credits refusal sets the estimate to 0 and sends the request to the next account.
Gumloop does not document its credit-limit error format and no live exhaustion
response has been captured. The plugin assumes HTTP 403 with a structured
credit_limit_exceeded code signals an exhausted Gumloop account; HTTP 402
responses (such as an upstream provider's "Insufficient credits") pass
through without zeroing the estimate. Other chat 403s check GET /models with
the same credentials: HTTP 200 keeps the sign-in, HTTP 401/403 marks it
expired, and a network failure or other status leaves the original refusal
unchanged.
To calibrate, sign in again with the credits gumloop.com shows (bottom left), or set them in the plugin's options, applied once per value:
magpie plugin options gumloop '{"balance": {"<user id or email>": 7142}, "allowance": 20000}'
balance is a number for every account or an object keyed by user id or email.
Each distinct options.balance number is applied once; if you top up back to the
same number as before, sign in again with the balance prompt (which timestamps
each calibration) or pass a different number.
allowance (optional, same forms) is the plan's monthly credits; with it the card
shows used / allowance instead of what is left.
In magpie, the estimate is kept in gumloop-ledger.json in magpie's config
directory. In OpenCode, it is kept in memory for the session so project folders
are never written to.
Ledger updates use a filesystem ticket lock (Lamport's bakery algorithm) and
re-read the latest data before changing it. Each attempt has a unique
gumloop-ledger.json.lock.<pid>.<uuid>.json record. A complete record is
published by atomic rename, first announcing ticket selection, then its ticket.
Contenders enter in ticket/name order and remove only their own records on
release. There is no reusable shared lock pathname that competing recoverers
could accidentally unlink after a new owner acquires it.
After a host crash, the next update removes a dead owner's lock records,
unfinished lock .tmp files, and leftover gumloop-ledger.json.<pid>.<seq>.tmp
files immediately when process.kill(pid, 0) reports ESRCH (no such
process), or once a file's mtime is older than 30 seconds (LOCK_STALE_MS)
even if the OS has reused that PID for another live process. Unrecognized
gumloop-ledger.json.lock.* filenames are ignored. Normal process exit
attempts cleanup, but recovery does not depend on exit handlers running. This
requires a coherent local filesystem; network filesystems and simultaneous
hosts using the old lock protocol are not supported.
Acquisition waits up to 250 ms in 5 ms intervals. Windows sharing errors on reads, renames and cleanup are retried within bounded 250 ms deadlines. Waiting blocks the plugin host's JavaScript thread. When the wait runs out (another host holds the lock), or the ledger can't be read or acquired, the change hasn't run: the host keeps it in memory, without failing the chat, and runs it once, in order, the next time it holds the lock and can read the ledger: on its next update, from a retry timer (25 ms, doubling to 5 s, each waiting 25 ms), or on normal exit, which waits up to 2 s. A busy peer delays a charge; it doesn't lose it. A host killed (not exited) with changes kept, or before its ledger rename, loses them; the previous complete ledger remains available and later requests recover.
Short-lived hosts may terminate immediately after receiving a completion.
The plugin therefore finishes accounting before releasing terminal SSE frames
or a JSON response within the existing 4-million-character parsing limit.
Ordinary SSE content still streams as it arrives; response bytes are preserved.
Complete ordinary lines are released even when the next line is partial.
SSE accounting finishes at [DONE], or EOF when that marker is absent.
The tap retains at most 256 KiB of incomplete SSE line or terminal-tail bytes.
If that limit is exceeded, it records an unbilled estimate once before releasing
the held bytes, then passes through the remaining stream with backpressure.
It does not charge a provisional usage value from an oversized terminal tail.
Oversized JSON retains the existing pass-through and unbilled-estimate behavior.
Install
magpie plugin add ./packages/gumloop
magpie plugin login gumloop
magpie provider test gumloop
magpie quota
In OpenCode, add the package under plugin and sign in with opencode auth login.
The package includes separate OpenCode 1.x and 2.x entrypoints; email and balance
remain optional in both login flows.
Development
bun test
bun scripts/check.mjs gumloop # in a magpie-community/plugins checkout
Thanks to vwfactory-dsh, whose Gumloop relay worked out the API, the request rewrites and the billing rules.
MIT. Not affiliated with Gumloop.