Files
nous-portal/README.md
T
AlexKucera b71363efb9 build: move release scripts and harden publish
publish.sh and test_npm_package.sh now live in scripts/ and cd to the
repo root, so they run from any directory. publish.sh polls npm until
the released version resolves: the first release ended inside the
registry's processing window, when a fresh install still gets the
0.0.0-stage placeholder. It also reopens an empty Unreleased section
after the rename and refuses an empty one before the version bump, so
a refused release leaves the tree clean.

test_npm_package.sh switches pi between the symlink checkout and
npm:pi-nous-portal. Only one may be installed: pi identifies npm
packages by name and local ones by path, so both register the provider
twice.
2026-11-25 16:51:36 +01:00

83 lines
4.2 KiB
Markdown

# pi-nous-portal
An unofficial, community-maintained provider that lets [pi](https://github.com/earendil-works/pi) sign in to Nous Portal and use its models. Not affiliated with Nous Research.
## Why this exists
Nous retired Hermes-style agent-key minting. `POST /api/oauth/agent-key` returns `410 session_key_minting_retired`, and both existing community extensions end their login at that endpoint, so neither can sign in with a Portal subscription. The inference API does accept the OAuth access token itself as a bearer credential, so this extension never mints or stores an agent key.
## Requirements
- pi 1.6.0 or newer, for the `@earendil-works/pi-ai` native provider interface
- Node.js 22 or newer
- a Nous Portal subscription, or an inference API key from the Portal
## Install
```bash
pi install npm:pi-nous-portal
```
To run from a checkout instead, symlink it into pi's extensions directory:
```bash
ln -s "$PWD" ~/.pi/agent/extensions/nous-portal
```
## Use
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, because pi hard-codes `allowModelNetwork: false` there. The provider ships a small static baseline so those modes still list something. 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. 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 empty, 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`, and only to `portal.nousresearch.com`, never to inference. This gets past the Vercel browser checkpoint that otherwise rejects CLI clients. It is a 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. The `paths` in `tsconfig.json` point `@earendil-works/pi-ai` and `pi-coding-agent` at the type declarations under `~/.pi/agent/install/releases/<version>/`, so update those three paths when pi is upgraded. The extension itself runs on any pi with the native provider interface. Only `tsc` is pinned.
`./scripts/test_npm_package.sh` switches pi between this checkout and the published package, so you can try a release without hunting for the symlink. Run it with `dev` or `npm` to pick a side.
## Releasing
```bash
./scripts/publish.sh # release the version in package.json
./scripts/publish.sh patch # bump first; minor and major work too
```
The script runs the checks, shows the tarball contents, moves the `Unreleased` section of the changelog under the new version, commits, tags, publishes to npm, and pushes. npm asks for your 2FA code during the publish. npm then takes a few minutes to serve the new version, and the script waits until it resolves. You need `npm login` with publish rights to the package first.
## License
GPL-3.0-or-later. See [LICENSE](LICENSE).