Files
plugins/packages/river
yetone 0135b7b0ea agy-cli 0.1.32: the first model list after warming has agy's Claude and GPT models (#1064)
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
2026-11-13 10:59:13 +08:00
..

river

River (river.ai) with your API key, in OpenCode and magpie. River serves an OpenAI-compatible inference API at https://api.river.ai/v1; this plugin signs every request with your key, so agents reach its models like any other provider — multi-account, fallback, quotas and all.

Provider id: river

Sign-in

A River API key, created on the API Keys page of the River Console (rv_…). The key is stored as { "type": "api", "key": "rv_…" } in OpenCode's auth.json and magpie's plugin-auth.json (permissions 600); a key River refuses marks the account for sign-in again.

Models

The models your key can use, listed per account from GET /v1/models. Context and output limits come from River's docs, prices from River's public pricing endpoint (the same rates billing uses), and the documented reasoning efforts (reasoning_effort) from API controls:

Model Efforts
DeepSeek-V4.1-Flash(-1017) none / low / high / max
Kimi-K3 none / max
Nemotron-3.5-Super-VL none / high
GLM-5.3-Flash low / high / max (reasoning required)
Qwen3.8-27B-FP8 none / low / medium / xhigh

Every inference model streams, reasons and calls tools. Image input is limited to the models the docs list for it (Kimi-K3, DeepSeek ×2, Nemotron, GLM-5.3-Flash, Qwen3.8-27B-FP8); GLM-5.3 is text-only, and a model the docs don't list yet defaults to text-only rather than being assumed to see images.

Usage

River meters a prepaid balance per request and publishes no endpoint that reads it, so the usage card shows the sign-in state and "Pay as you go" rather than invented numbers; spend and balance live in the River Console.

Install

magpie plugin add @magpie-community/opencode-river-auth
magpie plugin login river
magpie provider test river

In OpenCode, add the same package under plugin and sign in with opencode auth login.

Development

bun test
bun scripts/check.mjs river

MIT. Not affiliated with River.