- provider fetchModels: pin that an empty live list keeps the last good list instead of the baseline. - tokenRequest: pin the OAuth error mapping (error -> code, error_description -> message, body excerpt when absent). - overlap test: give the session a Nous model so the setModel half of the supersede guard is asserted (exactly one switch, by the winner). - README: drop the hard-coded live catalog counts (409 / 3 / 42); they are a 2026-11-25 snapshot that drifts silently. /model shows the live list. No production-code change. Tests: 20 (was 18).
65 lines
3.3 KiB
Markdown
65 lines
3.3 KiB
Markdown
# pi-nous-portal
|
|
|
|
Nous Portal provider for [pi](https://github.com/earendil-works/pi): subscription OAuth and API key, without agent-key minting.
|
|
|
|
## Why this exists
|
|
|
|
Nous retired Hermes-style agent-key minting (`POST /api/oauth/agent-key` returns `410 session_key_minting_retired`). Both existing community extensions end their login at that endpoint, so neither can sign in with a Portal subscription. The inference API now accepts the **OAuth access token directly** as a bearer credential, so this extension never mints or stores an agent key.
|
|
|
|
## Requirements
|
|
|
|
- pi 1.6.0 or newer (`@earendil-works/pi-ai` native provider interface)
|
|
- Node.js 22+
|
|
- A Nous Portal subscription, or an inference API key from the Portal
|
|
|
|
## Getting started
|
|
|
|
```bash
|
|
# from a checkout
|
|
ln -s "$PWD" ~/.pi/agent/extensions/nous-portal
|
|
```
|
|
|
|
Then in pi:
|
|
|
|
- `/login nous-portal` offers two methods: **Sign in to Nous Portal (subscription)** for the device-code OAuth flow, or **Nous Portal API key** to store an `sk-nous-…` key.
|
|
- The API-key route also reads `$NOUS_API_KEY`.
|
|
- `/model` lists the live catalog in interactive sessions.
|
|
|
|
### Catalog filters
|
|
|
|
```text
|
|
/nous-catalog cycle /model between full, free and promo
|
|
/nous-free jump to free models (again returns to full)
|
|
```
|
|
|
|
| Catalog | Live signal |
|
|
|---|---|
|
|
| full | every chat model except Hermes-branded ids (none in the catalog as of 2026-11-25) |
|
|
| free | `synthesizedFreeVariant`, also suffixed `:free` |
|
|
| promo | `pricing.original` above the current price |
|
|
|
|
The choice is saved in `~/.pi/agent/nous-portal-catalog` and survives restarts.
|
|
|
|
### Offline baseline
|
|
|
|
`pi -p` and `pi --list-models` never fetch live catalogs (pi hard-codes `allowModelNetwork: false` there), so the provider ships a small static baseline so it is always usable. Interactive pi overlays the live list on the baseline by model id; a baseline id that disappears from the live catalog stays listed, with its frozen baseline price and context, until the next release.
|
|
|
|
## Known limits
|
|
|
|
- `upstage/solar-mini4:free` is left out of the baseline on purpose: it alone requires a `tags` body field that the other free models reject with a 500, so no single request shape serves all of them.
|
|
- Subscription quota is per day. When the "Today" gauge is exhausted, inference returns `503 ChatGPT subscription inference is temporarily unavailable`. Purchased credits keep the API-key route working.
|
|
- Requests to the portal's OAuth endpoints send a browser-like `User-Agent`, `Origin` and `Referer` (only to `portal.nousresearch.com`, never to inference). This gets past the Vercel browser checkpoint that otherwise rejects CLI clients. It is a robustness and terms-of-use risk, not a security one: if Nous tightens the checkpoint or treats the client as evasion, login can break or the account can be flagged.
|
|
|
|
## Development
|
|
|
|
```bash
|
|
npm install --legacy-peer-deps --no-package-lock # typescript + jiti only; pi injects @earendil-works/* at load time
|
|
npm run check # tsc --noEmit + node --test
|
|
```
|
|
|
|
Typechecking needs a local pi install: `tsconfig.json` `paths` point `@earendil-works/pi-ai` and `pi-coding-agent` at the type declarations under `~/.pi/agent/install/releases/<version>/`. Update those three paths when pi is upgraded. The extension itself runs against any pi with the native provider interface; only `tsc` is pinned.
|
|
|
|
## License
|
|
|
|
GPL-3.0-or-later. See [LICENSE](LICENSE).
|