Files
plugins/packages/gumloop
yetone 1823ff3a13 proc: deepzora and gumloop ask the shared proc.mjs whether a lock's owner lives (#1164)
#1198 (yetihan) moved 15 packages' liveness checks onto scripts/proc.mjs,
so a Linux zombie no longer holds a lock. Two were left on a bare
kill(pid, 0), which answers for a zombie as for a live process:

- deepzora's bridge lock (bridge.mjs lock(), the same code as
  reasonix-desktop's, which #1198 fixed): a zombie owner left "Another
  bridge operation is running" until the zombie was reaped.
- gumloop's ledger lock peers (gumloop.mjs isAlive): a zombie peer was
  counted live, so its ticket was waited on.

Both now import a synced proc.mjs (scripts/sync-proc.mjs lists 17
copies; both package.json files ship it). gumloop's crash-window test
writes its instrumented copy into a temp dir, so proc.mjs is copied
beside it. A new guard in scripts/proc.test.mjs fails when any package
file outside tests and proc.mjs calls kill(pid, 0).

deepzora 0.2.1, gumloop 0.1.2.

Run (mote, HOME=$(mktemp -d)):
- bun test scripts/proc.test.mjs packages/deepzora packages/gumloop:
  111 pass, 0 fail. node --test scripts/proc.test.mjs: 9 pass.
- deepzora node --test deepzora.test.mjs: 13 pass.
- node scripts/sync-proc.mjs --check: ok. bun scripts/check.mjs: ok.

Broken by hand: main's bridge.mjs and gumloop.mjs with the new tests:
the guard names both files, and the copies test fails on deepzora.

Not tried: a real zombie owner for these two (#1198's fork-based
zombie check covers proc.mjs itself); a real Gumloop or DeepZora
account. gumloop under node --test fails 3 of 3 on bun:test imports,
the same on origin/main.
2026-11-16 12:31:01 +08:00
..

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.