pi-openmodel-provider 0.2.9 → 0.2.11
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/skills/pi-openmodel-info/SKILL.md +15 -0
- package/AGENTS.md +2 -0
- package/CHANGELOG.md +11 -0
- package/README.md +5 -4
- package/index.ts +2 -1
- package/package.json +1 -1
- package/src/models.ts +8 -3
|
@@ -17,6 +17,21 @@ pi-openmodel-provider is a custom provider that connects pi to [OpenModel.ai](ht
|
|
|
17
17
|
- **DeepSeek-V4-Flash** with 1M context window
|
|
18
18
|
- **NOT** OpenRouter — this is a different service called OpenModel.ai
|
|
19
19
|
|
|
20
|
+
## Model discovery
|
|
21
|
+
|
|
22
|
+
Models are fetched live from OpenModel's API at startup:
|
|
23
|
+
|
|
24
|
+
- **Pricing & capabilities:** `https://api.openmodel.ai/web/v1/models` (public, no auth needed)
|
|
25
|
+
- **Protocol info:** `https://api.openmodel.ai/v1/models` (requires API key — if unavailable, protocols are inferred from provider)
|
|
26
|
+
|
|
27
|
+
If the API key is not configured yet, models still load — protocols are inferred automatically from the provider name.
|
|
28
|
+
|
|
29
|
+
## Thinking levels
|
|
30
|
+
|
|
31
|
+
Reasoning models support thinking levels:
|
|
32
|
+
- **Messages protocol:** minimal → low, low → medium, medium → high
|
|
33
|
+
- **Responses protocol:** `reasoning_effort` levels (low, medium, high)
|
|
34
|
+
|
|
20
35
|
## Available commands
|
|
21
36
|
|
|
22
37
|
- `/openmodel` — Show provider status
|
package/AGENTS.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
- This package is **pi-openmodel-provider** for OpenModel.ai, **NOT** OpenRouter.
|
|
4
4
|
- OpenModel is a multi-model AI gateway, similar to OpenRouter but a different service.
|
|
5
|
+
- Models are fetched dynamically from OpenModel's API at startup — no hardcoded model list.
|
|
6
|
+
- If the `/v1/models` endpoint fails (no API key), protocols are inferred from the provider.
|
|
5
7
|
- See `.agents/skills/pi-openmodel-info/SKILL.md` for full documentation.
|
|
6
8
|
- Follow [CONTRIBUTING.md](CONTRIBUTING.md) before changing code.
|
|
7
9
|
- Use [RELEASE.md](RELEASE.md) for release process.
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.10] - 2026-06-22
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Legacy `/v1/models` endpoint failing without API key (models now load without auth)
|
|
12
|
+
- `require("node:os")` bug in `/openmodel` command (ESM compatibility)
|
|
13
|
+
- Added fallback protocol inference when legacy endpoint unavailable
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Test: recovers when legacy endpoint fails with 401
|
|
17
|
+
|
|
8
18
|
## [0.2.9] - 2026-06-20
|
|
9
19
|
|
|
10
20
|
### Added
|
|
@@ -109,6 +119,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
109
119
|
- Import path extensions (.ts → .js)
|
|
110
120
|
- Process import in models.ts
|
|
111
121
|
|
|
122
|
+
[0.2.10]: https://github.com/IvanGabrielYarupaitanRivera/pi-openmodel-provider/releases/tag/v0.2.10
|
|
112
123
|
[0.2.9]: https://github.com/IvanGabrielYarupaitanRivera/pi-openmodel-provider/releases/tag/v0.2.9
|
|
113
124
|
[0.2.6]: https://github.com/IvanGabrielYarupaitanRivera/pi-openmodel-provider/releases/tag/v0.2.6
|
|
114
125
|
[0.2.5]: https://github.com/IvanGabrielYarupaitanRivera/pi-openmodel-provider/releases/tag/v0.2.5
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A [pi](https://github.com/earendil-works/pi-mono) custom provider that connects pi to [OpenModel.ai](https://www.openmodel.ai) — a unified AI API gateway.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/pi-openmodel-provider)
|
|
6
6
|
|
|
7
7
|
> **Disclaimer:** This is an unofficial, community-maintained package. I am not affiliated with, endorsed by, or connected to OpenModel in any way. This provider simply forwards requests to the public OpenModel API using your own API key.
|
|
8
8
|
|
|
@@ -57,10 +57,10 @@ Models are fetched live from OpenModel's API at startup, so new models show up w
|
|
|
57
57
|
|
|
58
58
|
## Model discovery
|
|
59
59
|
|
|
60
|
-
On startup, the provider fetches models from two
|
|
60
|
+
On startup, the provider fetches models from two endpoints:
|
|
61
61
|
|
|
62
|
-
- **
|
|
63
|
-
- **
|
|
62
|
+
- **Pricing & capabilities:** `https://api.openmodel.ai/web/v1/models` (public, no auth needed)
|
|
63
|
+
- **Protocol info:** `https://api.openmodel.ai/v1/models` (requires API key — if unavailable, protocols are inferred from the provider)
|
|
64
64
|
|
|
65
65
|
Pricing, context window, reasoning support, and vision capabilities are all provided by the API — no hardcoded data.
|
|
66
66
|
|
|
@@ -148,6 +148,7 @@ npm run test:models
|
|
|
148
148
|
npm run test:auth
|
|
149
149
|
npm run test:pricing
|
|
150
150
|
npm run test:stability
|
|
151
|
+
npm run test:edge
|
|
151
152
|
```
|
|
152
153
|
|
|
153
154
|
## Contributing
|
package/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
formatHealthStatus,
|
|
14
14
|
} from "./src/stability.ts"
|
|
15
15
|
import { friendlyMessage } from "./src/errors.ts"
|
|
16
|
+
import { homedir } from "node:os"
|
|
16
17
|
|
|
17
18
|
export default async function (pi: ExtensionAPI) {
|
|
18
19
|
let models: Awaited<ReturnType<typeof fetchOpenModelModels>> = []
|
|
@@ -70,7 +71,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
70
71
|
let hasApiKey = false
|
|
71
72
|
try {
|
|
72
73
|
const { readFileSync } = await import("node:fs")
|
|
73
|
-
const authPath = `${
|
|
74
|
+
const authPath = `${homedir()}/.pi/agent/auth.json`
|
|
74
75
|
const content = readFileSync(authPath, "utf-8")
|
|
75
76
|
const data = JSON.parse(content)
|
|
76
77
|
hasApiKey = !!(data.openmodel?.access || data.openmodel?.refresh)
|
package/package.json
CHANGED
package/src/models.ts
CHANGED
|
@@ -172,7 +172,7 @@ export async function fetchOpenModelModels(options?: {
|
|
|
172
172
|
|
|
173
173
|
const [webModels, legacyModels] = await Promise.all([
|
|
174
174
|
fetchWebModels({ fetchImpl }),
|
|
175
|
-
fetchLegacyModels({ fetchImpl }),
|
|
175
|
+
fetchLegacyModels({ fetchImpl }).catch(() => new Map()),
|
|
176
176
|
])
|
|
177
177
|
|
|
178
178
|
const models: OpenModelProviderModel[] = []
|
|
@@ -185,8 +185,13 @@ export async function fetchOpenModelModels(options?: {
|
|
|
185
185
|
|
|
186
186
|
const legacy = legacyModels.get(id)
|
|
187
187
|
const protocols = legacy?.supported_protocols ?? []
|
|
188
|
-
|
|
189
|
-
if (!api)
|
|
188
|
+
let api = determineApi(protocols, web.provider_key)
|
|
189
|
+
if (!api) {
|
|
190
|
+
// Fallback: infer protocol from provider
|
|
191
|
+
if (["openai"].includes(web.provider_key)) api = "openai-responses"
|
|
192
|
+
else if (["gemini"].includes(web.provider_key)) api = "google-generative-ai"
|
|
193
|
+
else api = "anthropic-messages"
|
|
194
|
+
}
|
|
190
195
|
|
|
191
196
|
const inputPrice = pricePerMillion(web.prices.input_cost_per_token as number)
|
|
192
197
|
const outputPrice = pricePerMillion(web.prices.output_cost_per_token as number)
|