Files
xiaomu 0f0e966402 river 0.1.0: River with your API key, per-account models, efforts and live prices (#390)
packages/river (@magpie-community/opencode-river-auth 0.1.0, provider `river`):
River's OpenAI-compatible inference API with the user's API key. Models come
from GET /v1/models, limits, image input and reasoning efforts come from
docs.river.ai, and live prices come from River's public pricing endpoint
(BOOT_PRICES as the fallback). Unknown ids are text-only. A 401 or 403 marks
the sign-in expired. The usage card says "Pay as you go". It adds River's
rows to registry.json and the README.

River runs open-weight models on its own GPU fleet (river.ai). It is not a
relay of other vendors' APIs.

Run at the reviewed head 751e502, merged onto main c0a0fd1, on mote (Bun 1.4.2):
- HOME=$(mktemp -d) bun test: 2975 pass, 8 skip, 0 fail across 250 files.
- bun test packages/river: 25 pass. bun scripts/check.mjs: ok.
- A probe with a fake fetch built from River's documented shapes and today's
  real /api/public/pricing body (ids GLM-5.3, Kimi-K3, DeepSeek-V4.1-Flash):
  - The rows have the documented limits. GLM-5.3 is text-only, the others take images.
  - Each variant carries { reasoningEffort } with the documented levels.
  - The costs come from the live prices.
  - 401 throws signIn "expired" from models and from usage.
  - A 503 or a network failure keeps the previous list.
  - An empty list replaces the bootstrap rows.
  - A provider the user configured is kept.
  - RiverPlugin is the only exported function.
- Today's docs.river.ai/guides/inference-models and inference-controls
  match LIMITS, IMAGES and VARIANTS.
- An earlier review round (at 233919f) broke the code by hand and saw the
  river tests go red.

Not tried: a live River key (I don't have one; the author ran one).
Known gap: GLM-5.3 (pricing id "GLM-5.3") has no LIMITS or VARIANTS row, so
it lists with unknown limits and no efforts. It is text-only, so this is
safe.
2026-10-28 12:55:32 +08:00

22 lines
1.0 KiB
Plaintext

MIT License
Copyright (c) 2026 real-jacket
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.