Files
nous-portal/README.md
T
AlexKucera 690fcdfe22 feat: Nous Portal provider with subscription OAuth and catalog filters
Registers the native nous-portal provider for pi. Nous retired
agent-key minting (410 session_key_minting_retired), which is where
both existing community extensions end their login. The inference API
accepts the OAuth access token directly, so toAuth hands it over and
no agent key is ever minted or stored.

- Device-code OAuth (subscription) and API-key login
- Live model discovery delegated to openai-completions streaming
- Offline baseline so pi -p and --list-models stay usable
- /nous-catalog cycles full, free and promo; /nous-free jumps to free
2026-11-25 09:29:52 +01:00

62 lines
2.4 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 (409 models) 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 | Models |
|---|---|---|
| full | everything | 409 |
| free | `synthesizedFreeVariant`, also suffixed `:free` | 3 |
| promo | `pricing.original` above the current price | 42 |
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 replaces it with the live list.
## 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.
## Development
```bash
npm install --legacy-peer-deps # typescript + jiti only; pi injects @earendil-works/* at load time
npm run check # tsc --noEmit + node --test
```
## License
GPL-3.0-or-later. See [LICENSE](LICENSE).