pi-umans-provider 1.0.2
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/AGENTS.md +56 -0
- package/LICENSE +21 -0
- package/README.md +193 -0
- package/custom-models.json +1 -0
- package/index.ts +700 -0
- package/models.json +102 -0
- package/package.json +37 -0
- package/patch.json +66 -0
- package/scripts/update-models.js +263 -0
- package/tsconfig.json +12 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## DO NOT EDIT — Auto-generated Files
|
|
4
|
+
|
|
5
|
+
The following files are **idempotent** and regenerated by `scripts/update-models.js`. Never edit them directly — your changes will be overwritten on the next model sync.
|
|
6
|
+
|
|
7
|
+
| File | Why it's auto-generated |
|
|
8
|
+
|------|------------------------|
|
|
9
|
+
| `models.json` | Built from the provider API. `update-models.js` fetches models, preserves curated data for known IDs, and writes this file. |
|
|
10
|
+
| `README.md` (model table) | The table under `## Available Models` is replaced in-place by `update-models.js` after merging base models → patch → custom models. |
|
|
11
|
+
|
|
12
|
+
## Correct Files to Edit
|
|
13
|
+
|
|
14
|
+
When a model needs overrides, new properties, or corrections, edit the appropriate source file below. These are the **source of truth** that the update script reads but never writes.
|
|
15
|
+
|
|
16
|
+
| File | Purpose |
|
|
17
|
+
|------|---------|
|
|
18
|
+
| `patch.json` | Per-model overrides keyed by model ID. Add reasoning flags, compat settings, pricing corrections, thinking level maps, etc. Applied on top of `models.json` at runtime and for README generation. |
|
|
19
|
+
| `custom-models.json` | Models that don't exist in the provider API (hidden models, router endpoints, cross-provider aliases). Merged after patch. Format: array of full model objects (same schema as `models.json` entries). |
|
|
20
|
+
| `index.ts` | Provider extension code. |
|
|
21
|
+
| `scripts/update-models.js` | The sync script itself (edit only if changing how models are fetched/transformed). |
|
|
22
|
+
|
|
23
|
+
## Data Flow
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Provider API ──fetch──► models.json ──apply──► patch.json ──merge──► custom-models.json
|
|
27
|
+
│ │ │
|
|
28
|
+
└────────────────────────────┴──────────────────────┘
|
|
29
|
+
│
|
|
30
|
+
README model table
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
1. `models.json` — base data from the provider API (auto-generated, DO NOT EDIT)
|
|
34
|
+
2. `patch.json` — overrides applied on top (EDIT THIS for corrections/enrichments)
|
|
35
|
+
3. `custom-models.json` — additional models not in the API (EDIT THIS for new models)
|
|
36
|
+
4. README table — rendered from the merged result of all three (auto-generated, DO NOT EDIT)
|
|
37
|
+
|
|
38
|
+
## Common Tasks
|
|
39
|
+
|
|
40
|
+
### Add a compat setting or override pricing for an existing model
|
|
41
|
+
→ Edit `patch.json`. Add an entry keyed by the model's `id`.
|
|
42
|
+
|
|
43
|
+
### Add a model not available in the provider API
|
|
44
|
+
→ Edit `custom-models.json`. Add a full model object to the array.
|
|
45
|
+
|
|
46
|
+
### Update models from the provider API
|
|
47
|
+
→ Run `node scripts/update-models.js` (may require an API key env var).
|
|
48
|
+
|
|
49
|
+
### Regenerate the README model table
|
|
50
|
+
→ Run `node scripts/update-models.js` — it updates both `models.json` and the README table.
|
|
51
|
+
|
|
52
|
+
## TL;DR
|
|
53
|
+
|
|
54
|
+
- **Never edit `models.json`** — edit `patch.json` instead.
|
|
55
|
+
- **Never edit the README model table** — run the update script instead.
|
|
56
|
+
- `patch.json` and `custom-models.json` are the source files you should modify.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
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,193 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🔗 pi-umans-provider
|
|
4
|
+
|
|
5
|
+
**Coding-optimized models through [UMANS](https://code.umans.ai)**
|
|
6
|
+
|
|
7
|
+
_A [pi](https://github.com/earendil-works/pi-coding-agent) provider extension with reasoning, vision, and live plan status._
|
|
8
|
+
|
|
9
|
+
[](https://github.com/earendil-works/pi-coding-agent)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **OpenAI-compatible API** - Uses UMANS's `/v1/chat/completions` endpoint
|
|
19
|
+
- **Reasoning models** - `reasoning_effort`-controlled thinking, surfaced as `reasoning_content`
|
|
20
|
+
- **Vision models** - Image input on all models
|
|
21
|
+
- **Tool use** - Function calling support across all models
|
|
22
|
+
- **Streaming** - Real-time token streaming
|
|
23
|
+
- **Subscription-based** - All models included in your plan, no per-token cost
|
|
24
|
+
- **Usage status bar** — Displays your plan, concurrent sessions, and remaining requests in the pi footer
|
|
25
|
+
|
|
26
|
+
## Available Models
|
|
27
|
+
|
|
28
|
+
| Model | Base | Context | Vision | Reasoning | Max Output |
|
|
29
|
+
|-------|------|---------|--------|-----------|------------|
|
|
30
|
+
| Coder | Kimi K2.7-Code | 262K | ✅ | ✅ | 33K |
|
|
31
|
+
| Flash | Qwen3.6-35B-A3B | 262K | ✅ | ✅ | 33K |
|
|
32
|
+
| GLM 5.2 | GLM-5.2 | 406K | ❌ | ✅ | 131K |
|
|
33
|
+
| GLM 5.2 NVFP4 (experimental, short test from Jun 29) | GLM-5.2 | 406K | ❌ | ✅ | 131K |
|
|
34
|
+
| Kimi K2.7 Code | Kimi K2.7-Code | 262K | ✅ | ✅ | 33K |
|
|
35
|
+
| Qwen3.6 35B A3B | Qwen3.6-35B-A3B | 262K | ✅ | ✅ | 33K |
|
|
36
|
+
|
|
37
|
+
> **Note:** `umans-flash-beta` is deprecated (sunset 2026-06-07). Use `umans-flash` instead.
|
|
38
|
+
> `umans-qwen3.6-35b-a3b` is a technical alias for `umans-flash`.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### Option 1: Using `pi install` (Recommended)
|
|
43
|
+
|
|
44
|
+
Install directly from GitHub:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pi install https://github.com/monotykamary/pi-umans-provider
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then set your API key and run pi:
|
|
51
|
+
```bash
|
|
52
|
+
# Recommended: add to auth.json
|
|
53
|
+
# See Authentication section below
|
|
54
|
+
|
|
55
|
+
# Or set as environment variable
|
|
56
|
+
export UMANS_API_KEY=your-api-key-here
|
|
57
|
+
|
|
58
|
+
pi
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Get your API key from [code.umans.ai](https://code.umans.ai).
|
|
62
|
+
|
|
63
|
+
### Option 2: Manual Clone
|
|
64
|
+
|
|
65
|
+
1. Clone this repository:
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/monotykamary/pi-umans-provider.git
|
|
68
|
+
cd pi-umans-provider
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
2. Set your UMANS API key:
|
|
72
|
+
```bash
|
|
73
|
+
# Recommended: add to auth.json
|
|
74
|
+
# See Authentication section below
|
|
75
|
+
|
|
76
|
+
# Or set as environment variable
|
|
77
|
+
export UMANS_API_KEY=your-api-key-here
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
3. Run pi with the extension:
|
|
81
|
+
```bash
|
|
82
|
+
pi -e /path/to/pi-umans-provider
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Authentication
|
|
86
|
+
|
|
87
|
+
The UMANS API key can be configured in multiple ways (resolved in this order):
|
|
88
|
+
|
|
89
|
+
1. **`auth.json`** (recommended) — Add to `~/.pi/agent/auth.json`:
|
|
90
|
+
```json
|
|
91
|
+
{ "umans": { "type": "api_key", "key": "your-api-key" } }
|
|
92
|
+
```
|
|
93
|
+
The `key` field supports literal values, env var names, and shell commands (prefix with `!`). See [pi's auth file docs](https://github.com/badlogic/pi-mono) for details.
|
|
94
|
+
2. **Runtime override** — Use the `--api-key` CLI flag
|
|
95
|
+
3. **Environment variable** — Set `UMANS_API_KEY`
|
|
96
|
+
|
|
97
|
+
Get your API key from [code.umans.ai](https://code.umans.ai).
|
|
98
|
+
|
|
99
|
+
## Environment Variables
|
|
100
|
+
|
|
101
|
+
| Variable | Required | Description |
|
|
102
|
+
|----------|----------|-------------|
|
|
103
|
+
| `UMANS_API_KEY` | No | Your UMANS API key (fallback if not in auth.json) |
|
|
104
|
+
|
|
105
|
+
## Configuration
|
|
106
|
+
|
|
107
|
+
Add to your pi configuration for automatic loading:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"extensions": [
|
|
112
|
+
"/path/to/pi-umans-provider"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Usage
|
|
118
|
+
|
|
119
|
+
Once loaded, select a model with:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
/model umans umans-coder
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Or use `/models` to browse all available UMANS models.
|
|
126
|
+
|
|
127
|
+
### Recommended Models
|
|
128
|
+
|
|
129
|
+
- **`umans-coder`** — Best for complex, coding-heavy workloads. Optimized for coding agents.
|
|
130
|
+
- **`umans-flash`** — Fastest model for low-latency iteration with tools.
|
|
131
|
+
- **`umans-kimi-k2.7`** — Moonshot's Kimi K2.7-Code for the hardest, multi-step coding tasks. Reasoning is always on.
|
|
132
|
+
|
|
133
|
+
### Reasoning Effort
|
|
134
|
+
|
|
135
|
+
For reasoning models, control thinking depth:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
/reasoning high
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Levels: `off`, `minimal`, `low`, `medium`, `high` (default: `medium`). `off` disables reasoning (maps to `reasoning_effort: none`); `minimal` is mapped to the nearest UMANS level.
|
|
142
|
+
|
|
143
|
+
## Usage Status Bar
|
|
144
|
+
|
|
145
|
+
Once authenticated, the pi footer shows your UMANS account status:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
Code Max (Founding Seat) | ⟠ 1/4
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- **Plan name** — Your current subscription plan
|
|
152
|
+
- **`⟠ N/M`** — Active concurrent sessions / max concurrent sessions
|
|
153
|
+
- **`⇄ N`** — Remaining requests in the current window (shown when limited)
|
|
154
|
+
|
|
155
|
+
The concurrent-session count is tracked locally: it's optimistically incremented the moment an agent run starts (no API call needed — the server has a brief registration lag anyway), reconciled with UMANS's `/v1/usage` endpoint after each agent run ends, and lightly polled while idle so the baseline stays fresh. The plan name and request budget are fetched on session start and model selection.
|
|
156
|
+
|
|
157
|
+
## API Compatibility
|
|
158
|
+
|
|
159
|
+
The UMANS API follows OpenAI conventions with these differences (handled via `patch.json` and `before_provider_request` hook):
|
|
160
|
+
|
|
161
|
+
| Aspect | OpenAI Native | UMANS |
|
|
162
|
+
|--------|-------------|-------|
|
|
163
|
+
| Reasoning control | `reasoning_effort` | `reasoning_effort` (`none`/`low`/`medium`/`high`; default `medium`) |
|
|
164
|
+
| Developer role | Varies | ❌ Not supported (use system role) |
|
|
165
|
+
| Reasoning content | `reasoning_content` | `reasoning_content` (DeepSeek-style field) |
|
|
166
|
+
| `requiresReasoningContentOnAssistantMessages` | — | ✅ Required — preserves thinking in history |
|
|
167
|
+
| Pricing | Per-token | Subscription-based ($0/M) |
|
|
168
|
+
|
|
169
|
+
The extension also sanitizes orphaned `tool_calls` in conversation history. Context compaction can
|
|
170
|
+
drop tool result messages while keeping the assistant message that made the tool call, causing a
|
|
171
|
+
400 error from the API. The `before_provider_request` hook detects this and inserts synthetic tool results.
|
|
172
|
+
|
|
173
|
+
## Updating Models
|
|
174
|
+
|
|
175
|
+
To refresh the model list from the UMANS API:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm run update-models
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
This fetches from `/v1/models/info`, updates `models.json`, and regenerates the README model table. Idempotent — safe to run repeatedly.
|
|
182
|
+
|
|
183
|
+
## API Documentation
|
|
184
|
+
|
|
185
|
+
- UMANS: https://code.umans.ai
|
|
186
|
+
- OpenAI-compatible endpoint: `https://api.code.umans.ai/v1`
|
|
187
|
+
- Models endpoint: `https://api.code.umans.ai/v1/models`
|
|
188
|
+
- Models info: `https://api.code.umans.ai/v1/models/info`
|
|
189
|
+
- Usage endpoint: `https://api.code.umans.ai/v1/usage`
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|