115 lines
3.3 KiB
Markdown
115 lines
3.3 KiB
Markdown
# pi-unigpt
|
|
|
|
Use [uniGPT](https://unigpt.uni-graz.at), the University of Graz's AI
|
|
platform, as a model provider in [pi](https://pi.dev).
|
|
|
|
Models are discovered automatically, and their limits come from pi's model
|
|
catalog, so there is no model list to maintain. Tool calling, streaming, and
|
|
image input work.
|
|
|
|
## Requirements
|
|
|
|
- pi **1.5.x** and Node.js **22.19+**
|
|
- A uniGPT **API key**. If you don't have one, ask the uniGPT team at the
|
|
[IDea_Lab](https://idea-lab.uni-graz.at/en/digital-innovation-lab/unigpt-and-studigpt).
|
|
|
|
## Setup
|
|
|
|
**1. Install the extension**
|
|
|
|
```sh
|
|
pi install git:imsc.uni-graz.at/git/behackl/pi-unigpt
|
|
```
|
|
|
|
To stay on a fixed release instead of following the latest version, add the
|
|
tag: `…/pi-unigpt@v0.1.0`.
|
|
|
|
**2. Log in**
|
|
|
|
Start pi (or run `/reload` if it is already running) and enter:
|
|
|
|
```text
|
|
/login unigpt
|
|
```
|
|
|
|
Paste your API key into the masked dialog, **not into the chat**. Pi checks
|
|
the key and reports how many models it can use.
|
|
|
|
**3. Pick a model**
|
|
|
|
Run `/model` and choose one of the models listed under `unigpt`.
|
|
|
|
**4. Optional: make uniGPT your default**
|
|
|
|
Add this to `~/.pi/agent/settings.json` to start pi with a uniGPT model:
|
|
|
|
```json
|
|
{
|
|
"defaultProvider": "unigpt",
|
|
"defaultModel": "gpt-5.4"
|
|
}
|
|
```
|
|
|
|
## Commands
|
|
|
|
| Command | Purpose |
|
|
| --- | --- |
|
|
| `/login unigpt` | Save and verify your API key |
|
|
| `/model` | Pick a model (also reloads the model list) |
|
|
| `/unigpt-refresh` | Reload the model list and report any problem |
|
|
| `/logout` | Remove the saved key from pi (it stays valid at uniGPT) |
|
|
|
|
## Keeping your key out of auth.json
|
|
|
|
Pi saves the key unencrypted in `~/.pi/agent/auth.json`, readable only by
|
|
your user account. To avoid that, edit the `unigpt` entry there to read the
|
|
key from an environment variable or a password manager:
|
|
|
|
```json
|
|
{ "unigpt": { "type": "api_key", "key": "${UNIGPT_API_KEY}" } }
|
|
```
|
|
|
|
```json
|
|
{ "unigpt": { "type": "api_key", "key": "!op read op://Private/uniGPT/credential" } }
|
|
```
|
|
|
|
## Good to know
|
|
|
|
- **Thinking levels are off.** uniGPT applies a fixed reasoning effort per
|
|
model and ignores pi's setting. Reasoning models still reason.
|
|
- **Costs show as zero.** That means "not tracked", not "free".
|
|
- **Model limits** come from pi's catalog. Models pi doesn't know get 128k
|
|
context and 16k output; update pi to pick up newer ones. To override a
|
|
value, use `modelOverrides` in `~/.pi/agent/models.json`:
|
|
|
|
```json
|
|
{ "providers": { "unigpt": { "modelOverrides": { "gpt-5.4": { "contextWindow": 200000 } } } } }
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
- **No uniGPT models in `/model`:** run `/unigpt-refresh`; it names the
|
|
problem (rejected key, unreachable server, empty model list).
|
|
- **`pi -p` can't find a uniGPT model:** print mode doesn't fetch model
|
|
lists. Start pi interactively once after logging in.
|
|
- **One model fails with HTTP 500:** that deployment is broken on the
|
|
server; pick another model and tell the uniGPT team.
|
|
- **Install fails with `spawn npm ENOENT`:** you use pnpm instead of npm.
|
|
Add `"npmCommand": ["pnpm"]` to `~/.pi/agent/settings.json`.
|
|
|
|
Report bugs at <https://imsc.uni-graz.at/git/behackl/pi-unigpt/issues>.
|
|
Include the `/unigpt-refresh` output and the model you used, never your
|
|
API key.
|
|
|
|
## Development
|
|
|
|
```sh
|
|
pnpm install
|
|
pnpm run ci # type check + tests
|
|
```
|
|
|
|
Tests use fake keys and a local server; they never contact uniGPT.
|
|
|
|
## License
|
|
|
|
[MIT](LICENSE)
|