@neilurk12/pi-opengateway 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/config.example.json +15 -0
- package/dist/index.js +5 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# pi-opengateway
|
|
2
|
+
|
|
3
|
+
pi extension that registers an [OpenGateway](https://opengateway.gitlawb.com) provider for the pi coding agent. Uses the OpenAI-compatible completions API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi install npm:@neilurk12/pi-opengateway
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For project-local install:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pi install -l @neilurk12/pi-opengateway
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or from local checkout (development):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pi install /absolute/path/to/pi-opengateway
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Configuration
|
|
24
|
+
|
|
25
|
+
Create a config file at one of these paths (first match wins):
|
|
26
|
+
|
|
27
|
+
1. **Global**: `~/.pi/agent/opengateway.json`
|
|
28
|
+
2. **Project**: `.pi/opengateway.json`
|
|
29
|
+
|
|
30
|
+
See [`config.example.json`](./config.example.json) for the required shape:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"baseUrl": "https://your-gateway.example.com/v1",
|
|
35
|
+
"apiKey": "your-api-key-here",
|
|
36
|
+
"models": [
|
|
37
|
+
{
|
|
38
|
+
"id": "model-id",
|
|
39
|
+
"name": "Model Display Name",
|
|
40
|
+
"reasoning": false,
|
|
41
|
+
"input": ["text"],
|
|
42
|
+
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
|
|
43
|
+
"contextWindow": 128000,
|
|
44
|
+
"maxTokens": 4096
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Fields
|
|
51
|
+
|
|
52
|
+
| Field | Required | Description |
|
|
53
|
+
|-------|----------|-------------|
|
|
54
|
+
| `baseUrl` | Yes | Gateway API endpoint (include `/v1` or equivalent) |
|
|
55
|
+
| `apiKey` | Yes | API key for authentication |
|
|
56
|
+
| `models[]` | Yes | Array of model definitions |
|
|
57
|
+
| `models[].id` | Yes | Model ID sent to the API |
|
|
58
|
+
| `models[].name` | Yes | Display name shown in pi |
|
|
59
|
+
| `models[].reasoning` | Yes | Whether the model supports extended thinking |
|
|
60
|
+
| `models[].input` | Yes | Supported input types: `["text"]` or `["text", "image"]` |
|
|
61
|
+
| `models[].cost` | Yes | Token costs (can be zeroes) |
|
|
62
|
+
| `models[].contextWindow` | Yes | Max context window in tokens |
|
|
63
|
+
| `models[].maxTokens` | Yes | Max output tokens |
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
Once configured, the gateway models appear in pi's model picker under the "OpenGateway" provider. Select them like any other model.
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install
|
|
73
|
+
npm run build
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Notes
|
|
77
|
+
|
|
78
|
+
- Extensions run with full system permissions. Review code before installing any pi package.
|
|
79
|
+
- Config is loaded at startup. Restart pi after changing config.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseUrl": "https://opengateway.gitlawb.com/v1",
|
|
3
|
+
"apiKey": "your-api-key-here",
|
|
4
|
+
"models": [
|
|
5
|
+
{
|
|
6
|
+
"id": "mimo-v2.5-pro",
|
|
7
|
+
"name": "MiMo 2.5 Pro (Gateway)",
|
|
8
|
+
"reasoning": true,
|
|
9
|
+
"input": ["text"],
|
|
10
|
+
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
|
|
11
|
+
"contextWindow": 1048576,
|
|
12
|
+
"maxTokens": 16384
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{readFileSync as r}from"fs";import{join as t}from"path";import i from"os";function s(){let n=[t(i.homedir(),".pi","agent","opengateway.json"),t(process.cwd(),".pi","opengateway.json")];for(let e of n)try{let o=r(e,"utf-8");return JSON.parse(o)}catch{}return null}function f(n){let e=s();if(!e){n.registerCommand("opengateway",{description:"Show OpenGateway config status",handler:async(o,a)=>{a.hasUI&&a.ui.notify(`No config found. Create one at:
|
|
2
|
+
~/.pi/agent/opengateway.json (global)
|
|
3
|
+
.pi/opengateway.json (project)
|
|
4
|
+
|
|
5
|
+
See config.example.json for the required shape.`,"warning")}});return}n.registerProvider("opengateway",{name:"OpenGateway",baseUrl:e.baseUrl,apiKey:e.apiKey,api:"openai-completions",models:e.models})}export{f as default};
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neilurk12/pi-opengateway",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "pi extension — OpenGateway provider (OpenAI-compatible)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi",
|
|
8
|
+
"pi-package",
|
|
9
|
+
"pi-extension",
|
|
10
|
+
"opengateway",
|
|
11
|
+
"openai",
|
|
12
|
+
"provider",
|
|
13
|
+
"gateway"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/Neil-urk12/pi-dots.git"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"config.example.json",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.js",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"pi": {
|
|
32
|
+
"extensions": [
|
|
33
|
+
"./dist/index.js"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"dev": "tsup --watch"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"tsup": "^8.5.1",
|
|
45
|
+
"typescript": "^6.0.3"
|
|
46
|
+
},
|
|
47
|
+
"pnpm": {
|
|
48
|
+
"onlyBuiltDependencies": [
|
|
49
|
+
"esbuild"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|