samrito-pi-preset 1.0.1 → 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/README.md +14 -8
- package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/LICENSE +7 -0
- package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/README.md +78 -5
- package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/package.json +8 -5
- package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/model-capabilities.ts +12 -1
- package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/model-ui.ts +21 -1
- package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/provider.ts +12 -3
- package/node_modules/@samrito/pi-cliproxyapi-provider/src/reasoning-levels.ts +59 -0
- package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/types.ts +22 -0
- package/package.json +4 -4
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/data/models-dev-fallback.json +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/extensions/index.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/auth.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/cache.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/catalog.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/codex-compat.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/commands.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/config.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/cpa.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/discovery.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/matching.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/model-api.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/models-dev.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/network.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/registration.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/runtime.ts +0 -0
- /package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/settings.ts +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# samrito-pi-preset
|
|
2
2
|
|
|
3
3
|
A portable [pi](https://pi.dev) package that bundles this machine's extension
|
|
4
|
-
collection (including the
|
|
4
|
+
collection (including the `@samrito/pi-cliproxyapi-provider` provider) under a single
|
|
5
5
|
`pi install`-able package.
|
|
6
6
|
|
|
7
7
|
Install it from npm in one command:
|
|
@@ -55,7 +55,7 @@ managed separately, or copy the directory to the target machine.
|
|
|
55
55
|
| `@juicesharp/rpiv-todo` | ^2.9.0 | `index.ts` |
|
|
56
56
|
| `@narumitw/pi-btw` | ^0.58.1 | `dist/index.ts` |
|
|
57
57
|
| `pi-background-tasks` | ^2.5.0 | `extensions/*.ts` (2) |
|
|
58
|
-
|
|
|
58
|
+
| `@samrito/pi-cliproxyapi-provider` | ^0.16.0 | `extensions/index.ts` |
|
|
59
59
|
| `pi-goal-x` | ^0.31.2 | `extensions/goal.ts` |
|
|
60
60
|
| `pi-tool-display` | ^0.5.0 | `index.ts` |
|
|
61
61
|
| `pi-zentui` | ^0.23.0 | `extensions/zentui/index.ts` |
|
|
@@ -427,12 +427,18 @@ node scripts/setup.mjs [--skip-install] [--force-config]
|
|
|
427
427
|
- **Paths are relative to this package.** `pi.extensions` points into
|
|
428
428
|
`node_modules/`, so the directory must stay where it was installed (or be
|
|
429
429
|
re-installed). Moving it requires re-running `pi install`.
|
|
430
|
-
- **
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
430
|
+
- **The provider is a fork.** `@samrito/pi-cliproxyapi-provider` is a fork of
|
|
431
|
+
the upstream `pi-cliproxyapi-provider`, adding thinking levels derived from
|
|
432
|
+
models.dev `reasoning_options`. It keeps the upstream settings namespace,
|
|
433
|
+
config paths, cache directory, and `/cliproxyapi` command, so it is a drop-in
|
|
434
|
+
replacement — but the two must not be installed together, since both register
|
|
435
|
+
the same provider and command and pi rejects the duplicate.
|
|
436
|
+
- **No vendor-locked provider is bundled.** The vendor-scoped provider package
|
|
437
|
+
that was previously excluded from this bundle must not be re-introduced. CI
|
|
438
|
+
enforces this with a grep over tracked files (the term is assembled at runtime
|
|
439
|
+
in the workflow so the guard cannot match its own source), and
|
|
440
|
+
`scripts/pi-package-lib.mjs`'s `EXCLUDED_PACKAGES` lists what is deliberately
|
|
441
|
+
skipped — currently empty.
|
|
436
442
|
- **Traditional token publishing should stay disabled.** npm's *Require
|
|
437
443
|
two-factor authentication and disallow tokens* setting affects only traditional
|
|
438
444
|
token auth: "Your trusted publishers will continue to work normally, as they
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 Richard Hao
|
|
4
|
+
Copyright (c) 2026 samrito (modifications to this fork)
|
|
5
|
+
|
|
6
|
+
This package is a fork of pi-cliproxyapi-provider
|
|
7
|
+
(https://github.com/0xRichardH/pi-cliproxyapi-provider) by Richard Hao,
|
|
8
|
+
distributed under the MIT License reproduced below. The original copyright
|
|
9
|
+
notice is retained as the license requires; the modifications in this fork are
|
|
10
|
+
copyright their respective author.
|
|
4
11
|
|
|
5
12
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
13
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
# pi-cliproxyapi-provider
|
|
1
|
+
# @samrito/pi-cliproxyapi-provider
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> A fork of [pi-cliproxyapi-provider](https://github.com/0xRichardH/pi-cliproxyapi-provider)
|
|
4
|
+
> by Richard Hao (MIT). This fork adds model thinking levels sourced from
|
|
5
|
+
> models.dev. It is a drop-in replacement: the settings namespace, config paths,
|
|
6
|
+
> cache directory, and `/cliproxyapi` command are unchanged, so existing
|
|
7
|
+
> configuration keeps working. Do not install it alongside the original — both
|
|
8
|
+
> register the same provider and command, and pi rejects the duplicate.
|
|
9
|
+
|
|
10
|
+
`@samrito/pi-cliproxyapi-provider` registers one [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) instance as a pi model provider. It discovers models from CLIProxyAPI's OpenAI-compatible `/v1/models` endpoint and enriches them with provider-specific metadata from [models.dev](https://models.dev/). Mixed catalogs use OpenAI Completions by default, while GPT-5.6 family models (including Codex variants) use the Responses API so pi can read their usage data. Canonical `/v1/models` owners such as `openai` select the matching provider metadata; aliases can override that selection when a proxy routes billing differently.
|
|
4
11
|
|
|
5
12
|
## Install
|
|
6
13
|
|
|
7
14
|
Install from npm:
|
|
8
15
|
|
|
9
16
|
```bash
|
|
10
|
-
pi install npm
|
|
17
|
+
pi install npm:@samrito/pi-cliproxyapi-provider
|
|
11
18
|
```
|
|
12
19
|
|
|
13
20
|
Or install from GitHub:
|
|
14
21
|
|
|
15
22
|
```bash
|
|
16
|
-
pi install git:github.com/
|
|
23
|
+
pi install git:github.com/xiangsam/pi-cliproxyapi-provider@master
|
|
17
24
|
```
|
|
18
25
|
|
|
19
26
|
You can omit `@master`, but pinning a branch, tag, or commit makes Git installs reproducible:
|
|
20
27
|
|
|
21
28
|
```bash
|
|
22
|
-
pi install git:github.com/
|
|
29
|
+
pi install git:github.com/xiangsam/pi-cliproxyapi-provider@a28f326
|
|
23
30
|
```
|
|
24
31
|
|
|
25
32
|
Restart pi after installing, then run:
|
|
@@ -96,6 +103,72 @@ The same setting can be placed in project `.pi/settings.json`; project settings
|
|
|
96
103
|
|
|
97
104
|
Use `"full"` only when the selected CLIProxyAPI route and upstream account actually support that limit. Requests above `272000` input tokens also use the higher models.dev context-pricing tier where one is defined.
|
|
98
105
|
|
|
106
|
+
### Thinking levels
|
|
107
|
+
|
|
108
|
+
The provider derives each model's selectable thinking levels from the
|
|
109
|
+
`reasoning_options` field in models.dev metadata. When a model publishes an
|
|
110
|
+
effort list, exactly those levels appear in Pi's thinking selector:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
deepseek-flash reasoning_options: [{"type":"effort","values":["low","high","max"]}]
|
|
114
|
+
-> Pi offers off, low, high, max
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Two details make this more than cosmetic:
|
|
118
|
+
|
|
119
|
+
- **Absent levels are hidden, not defaulted.** models.dev publishes an
|
|
120
|
+
exhaustive list, so every level it omits is explicitly marked unsupported. This
|
|
121
|
+
matters because Pi otherwise offers levels up to `high` using the provider
|
|
122
|
+
default, and a proxy that validates the level rejects the request. CLIProxyAPI
|
|
123
|
+
does exactly that: an unsupported level comes back as
|
|
124
|
+
`400 level "medium" not supported, valid levels: low, high, max`.
|
|
125
|
+
- **`xhigh` and `max` only appear when the list names them.** Pi hides extended
|
|
126
|
+
levels unless a model maps them explicitly, which is why `max` was previously
|
|
127
|
+
unreachable for models that support it.
|
|
128
|
+
|
|
129
|
+
Only `type: "effort"` publishes levels. `toggle` and `budget_tokens` describe
|
|
130
|
+
other reasoning shapes and are ignored, so those models keep Pi's default. A
|
|
131
|
+
built-in rule for the GPT-5.6 family remains as a fallback for models whose
|
|
132
|
+
metadata carries no effort list; where models.dev publishes one, it wins, because
|
|
133
|
+
it tracks the model's current capability and the rule does not.
|
|
134
|
+
|
|
135
|
+
> **Levels describe the model, not your proxy.** models.dev publishes the
|
|
136
|
+
> canonical capability, and a CLIProxyAPI route can accept a different set. A
|
|
137
|
+
> mismatch that offers a level the proxy rejects makes Pi send a request that
|
|
138
|
+
> fails with `400`. Correct it with the override below.
|
|
139
|
+
|
|
140
|
+
#### Correcting a level list
|
|
141
|
+
|
|
142
|
+
When a proxy serves a model differently from its published metadata, or when
|
|
143
|
+
the models.dev match lands on a different provider, override the map in Pi's own
|
|
144
|
+
`~/.pi/agent/models.json`:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"providers": {
|
|
149
|
+
"cpa": {
|
|
150
|
+
"modelOverrides": {
|
|
151
|
+
"deepseek-flash": {
|
|
152
|
+
"thinkingLevelMap": {
|
|
153
|
+
"off": "none",
|
|
154
|
+
"minimal": null,
|
|
155
|
+
"low": "low",
|
|
156
|
+
"medium": null,
|
|
157
|
+
"high": "high",
|
|
158
|
+
"xhigh": null,
|
|
159
|
+
"max": "max"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
This layer is applied by Pi after the provider registers its models, so it wins
|
|
169
|
+
over both models.dev and the built-in rules. Use `null` to hide a level the
|
|
170
|
+
proxy rejects. Replace `cpa` with your configured provider name.
|
|
171
|
+
|
|
99
172
|
### Model and display configuration
|
|
100
173
|
|
|
101
174
|
Run `/cliproxyapi config` in Pi TUI mode to edit every package-level `settings.json` value. The tabbed panel has `Connection`, `Models`, and `Display` sections; it controls the GPT-5.6 context-window mode and whether the model selector shows the published strict tool-schema capability.
|
package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/package.json
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "pi-cliproxyapi-provider",
|
|
3
|
-
"version": "0.
|
|
2
|
+
"name": "@samrito/pi-cliproxyapi-provider",
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Pi provider package for CLIProxyAPI with automatic model discovery and models.dev enrichment.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
],
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/
|
|
18
|
+
"url": "git+https://github.com/xiangsam/pi-cliproxyapi-provider.git"
|
|
19
19
|
},
|
|
20
20
|
"bugs": {
|
|
21
|
-
"url": "https://github.com/
|
|
21
|
+
"url": "https://github.com/xiangsam/pi-cliproxyapi-provider/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/xiangsam/pi-cliproxyapi-provider#readme",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
22
26
|
},
|
|
23
|
-
"homepage": "https://github.com/0xRichardH/pi-cliproxyapi-provider#readme",
|
|
24
27
|
"files": [
|
|
25
28
|
"src",
|
|
26
29
|
"extensions",
|
|
@@ -15,9 +15,20 @@ interface ModelCapabilityRule {
|
|
|
15
15
|
overrides: ModelCapabilityOverrides;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Fallback level map for the GPT-5.6 family, used only when models.dev publishes
|
|
20
|
+
* no effort list for the model.
|
|
21
|
+
*
|
|
22
|
+
* `minimal` is explicitly unsupported. Measured against a live CLIProxyAPI
|
|
23
|
+
* instance, gpt-5.6-sol, -terra, and -luna all answer
|
|
24
|
+
* `400 level "minimal" not supported, valid levels: low, medium, high, xhigh, max`,
|
|
25
|
+
* so offering it produces a failing request. models.dev omits `minimal` for the
|
|
26
|
+
* same models, which is why this rule is the fallback rather than the source of
|
|
27
|
+
* truth; it stays correct by hiding what the model does not accept.
|
|
28
|
+
*/
|
|
18
29
|
const GPT_5_6_THINKING_LEVEL_MAP: ThinkingLevelMap = {
|
|
19
30
|
off: "none",
|
|
20
|
-
minimal:
|
|
31
|
+
minimal: null,
|
|
21
32
|
low: "low",
|
|
22
33
|
medium: "medium",
|
|
23
34
|
high: "high",
|
package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/model-ui.ts
RENAMED
|
@@ -75,13 +75,33 @@ function detailItems(model: ProviderModelConfigLike, override: ProviderModelOver
|
|
|
75
75
|
];
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Render the thinking levels pi will actually offer.
|
|
80
|
+
*
|
|
81
|
+
* Listing `Object.keys(thinkingLevelMap)` would be misleading: a key is present
|
|
82
|
+
* with value `null` precisely to mean "unsupported, hidden", so the keys alone
|
|
83
|
+
* include levels the user can never select. Show the mapped values instead and
|
|
84
|
+
* state the count of explicitly unsupported levels.
|
|
85
|
+
*/
|
|
86
|
+
function thinkingLevelSummary(map: ProviderModelConfigLike["thinkingLevelMap"]): string {
|
|
87
|
+
if (!map) return "none";
|
|
88
|
+
|
|
89
|
+
const offered = Object.entries(map)
|
|
90
|
+
.filter(([, value]) => typeof value === "string")
|
|
91
|
+
.map(([level]) => level);
|
|
92
|
+
const hidden = Object.values(map).filter((value) => value === null).length;
|
|
93
|
+
if (offered.length === 0) return "none";
|
|
94
|
+
|
|
95
|
+
return hidden > 0 ? `${offered.join(", ")} (${hidden} unsupported)` : offered.join(", ");
|
|
96
|
+
}
|
|
97
|
+
|
|
78
98
|
function details(model: ProviderModelConfigLike): string[] {
|
|
79
99
|
return [
|
|
80
100
|
`Name: ${model.name}`,
|
|
81
101
|
`API: ${model.api ?? "openai-completions (provider default)"}`,
|
|
82
102
|
`Input: ${model.input.join(", ")}`,
|
|
83
103
|
`Cost: in ${model.cost.input}, out ${model.cost.output}, cache read ${model.cost.cacheRead}, cache write ${model.cost.cacheWrite}`,
|
|
84
|
-
`Thinking map: ${
|
|
104
|
+
`Thinking map: ${thinkingLevelSummary(model.thinkingLevelMap)}`,
|
|
85
105
|
`Other compat: ${formattedOtherCompat(model)}`,
|
|
86
106
|
];
|
|
87
107
|
}
|
package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/provider.ts
RENAMED
|
@@ -2,6 +2,7 @@ import type { CpaModel } from "./cpa.ts";
|
|
|
2
2
|
import { findMetadataMatch, type MetadataMatchMethod } from "./matching.ts";
|
|
3
3
|
import { getModelApiOverride, isGpt56Model, type ModelApiContext } from "./model-api.ts";
|
|
4
4
|
import { getModelCapabilityOverrides } from "./model-capabilities.ts";
|
|
5
|
+
import { thinkingLevelMapFromReasoningOptions } from "./reasoning-levels.ts";
|
|
5
6
|
import type { Gpt56ContextWindowMode } from "./settings.ts";
|
|
6
7
|
import type {
|
|
7
8
|
InputModality,
|
|
@@ -83,14 +84,22 @@ function modelFromMetadata(
|
|
|
83
84
|
const capabilityOverrides = getModelCapabilityOverrides(capabilityContext);
|
|
84
85
|
const api = getModelApiOverride(capabilityContext);
|
|
85
86
|
|
|
87
|
+
// Precedence: models.dev wins when it publishes a level list, because that
|
|
88
|
+
// list tracks the model's current capability while the rules were written
|
|
89
|
+
// against an older catalog. Measured against a live CLIProxyAPI instance, the
|
|
90
|
+
// gpt-5.6 rule is now stale: it maps `minimal`, which the proxy rejects with
|
|
91
|
+
// `400 level "minimal" not supported`, whereas the models.dev list for the
|
|
92
|
+
// same model omits `minimal` and matches the proxy exactly. The rules still
|
|
93
|
+
// fill the gap when metadata is absent or carries no effort list.
|
|
94
|
+
const thinkingLevelMap =
|
|
95
|
+
thinkingLevelMapFromReasoningOptions(metadata.reasoning_options) ?? capabilityOverrides.thinkingLevelMap;
|
|
96
|
+
|
|
86
97
|
return {
|
|
87
98
|
id: cpaModel.id,
|
|
88
99
|
name: metadata.name ?? cpaModel.id,
|
|
89
100
|
reasoning: capabilityOverrides.reasoning ?? metadata.reasoning ?? PI_MODEL_DEFAULTS.reasoning,
|
|
90
101
|
...(api ? { api } : {}),
|
|
91
|
-
...(
|
|
92
|
-
? { thinkingLevelMap: capabilityOverrides.thinkingLevelMap }
|
|
93
|
-
: {}),
|
|
102
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
94
103
|
input: inputFromMetadata(metadata),
|
|
95
104
|
cost: costFromMetadata(metadata),
|
|
96
105
|
contextWindow: contextWindowForModel(capabilityContext, metadata.limit?.context, gpt56ContextWindow),
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ThinkingLevelMap } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { ModelsDevReasoningOption } from "./types.ts";
|
|
3
|
+
|
|
4
|
+
/** pi thinking levels in ascending depth, excluding `off`. */
|
|
5
|
+
const PI_THINKING_LEVELS = ["minimal", "low", "medium", "high", "xhigh", "max"] as const;
|
|
6
|
+
|
|
7
|
+
/** The models.dev effort value that means "thinking disabled". */
|
|
8
|
+
const EFFORT_OFF = "none";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Convert models.dev `reasoning_options` into a pi `ThinkingLevelMap`.
|
|
12
|
+
*
|
|
13
|
+
* models.dev publishes an exhaustive `type: "effort"` list for models whose
|
|
14
|
+
* reasoning depth is selectable, using the same vocabulary pi exposes (`none`
|
|
15
|
+
* plus `minimal`..`max`). The conversion is total in both directions:
|
|
16
|
+
*
|
|
17
|
+
* - a level present in the list maps to itself, so pi sends that exact value
|
|
18
|
+
* - a level absent from the list maps to `null`, which hides it in pi's UI
|
|
19
|
+
* - pi's `off` maps to models.dev `none`, which the list may signal either as
|
|
20
|
+
* an effort value or as a separate `toggle` entry
|
|
21
|
+
*
|
|
22
|
+
* Null-ing absent levels is the point of this function. Because the list is
|
|
23
|
+
* exhaustive, leaving a level `undefined` would let pi offer it using the
|
|
24
|
+
* provider default, and a proxy that validates the level rejects the request.
|
|
25
|
+
* CLIProxyAPI does exactly that: it answers an unsupported level with
|
|
26
|
+
* `400 level "medium" not supported, valid levels: low, high, max`.
|
|
27
|
+
*
|
|
28
|
+
* `off` needs both signals because models.dev splits the ability to disable
|
|
29
|
+
* thinking from the level list. A model can publish `["low","high","max"]`
|
|
30
|
+
* alongside `{type: "toggle"}`, meaning thinking is selectable only within those
|
|
31
|
+
* levels but can still be switched off; reading the effort list alone would hide
|
|
32
|
+
* `off` from a model that supports it. 296 catalog entries have this shape,
|
|
33
|
+
* including `deepseek/deepseek-flash`, which a live CLIProxyAPI instance accepts
|
|
34
|
+
* `reasoning_effort: "none"` for.
|
|
35
|
+
*
|
|
36
|
+
* Returns `undefined` when the model publishes no effort list, so callers keep
|
|
37
|
+
* their own default. A lone `toggle` or `budget_tokens` entry enumerates no
|
|
38
|
+
* levels and cannot be expressed as a level map, so it is ignored.
|
|
39
|
+
*/
|
|
40
|
+
export function thinkingLevelMapFromReasoningOptions(
|
|
41
|
+
options: ModelsDevReasoningOption[] | undefined,
|
|
42
|
+
): ThinkingLevelMap | undefined {
|
|
43
|
+
const effort = options?.find(
|
|
44
|
+
(option) => option.type === "effort" && Array.isArray(option.values) && option.values.length > 0,
|
|
45
|
+
);
|
|
46
|
+
const values = effort?.values;
|
|
47
|
+
if (!values) return undefined;
|
|
48
|
+
|
|
49
|
+
const offered = new Set(values);
|
|
50
|
+
const canDisableThinking =
|
|
51
|
+
offered.has(EFFORT_OFF) || (options?.some((option) => option.type === "toggle") ?? false);
|
|
52
|
+
const map: ThinkingLevelMap = {
|
|
53
|
+
off: canDisableThinking ? EFFORT_OFF : null,
|
|
54
|
+
};
|
|
55
|
+
for (const level of PI_THINKING_LEVELS) {
|
|
56
|
+
map[level] = offered.has(level) ? level : null;
|
|
57
|
+
}
|
|
58
|
+
return map;
|
|
59
|
+
}
|
package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/types.ts
RENAMED
|
@@ -36,6 +36,12 @@ export interface ModelsDevMetadata {
|
|
|
36
36
|
sourceProvider?: string;
|
|
37
37
|
name?: string;
|
|
38
38
|
reasoning?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* How the model exposes reasoning control. Only `type: "effort"` entries carry
|
|
41
|
+
* a level list that maps onto pi thinking levels; `toggle` and `budget_tokens`
|
|
42
|
+
* describe other shapes and are not converted.
|
|
43
|
+
*/
|
|
44
|
+
reasoning_options?: ModelsDevReasoningOption[];
|
|
39
45
|
modalities?: {
|
|
40
46
|
input?: string[];
|
|
41
47
|
output?: string[];
|
|
@@ -64,6 +70,22 @@ export interface ModelsDevMetadata {
|
|
|
64
70
|
|
|
65
71
|
export type ModelsDevCatalog = Record<string, ModelsDevMetadata>;
|
|
66
72
|
|
|
73
|
+
/**
|
|
74
|
+
* One entry of a models.dev `reasoning_options` array.
|
|
75
|
+
*
|
|
76
|
+
* `type` is kept as a plain string because models.dev adds shapes over time
|
|
77
|
+
* (currently `effort`, `toggle`, and `budget_tokens`) and unknown ones must be
|
|
78
|
+
* ignored rather than rejected.
|
|
79
|
+
*/
|
|
80
|
+
export interface ModelsDevReasoningOption {
|
|
81
|
+
type: string;
|
|
82
|
+
/** Levels for `type: "effort"`, drawn from the same vocabulary pi uses. */
|
|
83
|
+
values?: string[];
|
|
84
|
+
/** Token bounds for `type: "budget_tokens"`. */
|
|
85
|
+
min?: number;
|
|
86
|
+
max?: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
67
89
|
export interface ProviderModelConfigLike {
|
|
68
90
|
id: string;
|
|
69
91
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "samrito-pi-preset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Portable pi agent setup: bundles the extension collection and user config templates so another machine can be brought up with one install.",
|
|
6
6
|
"keywords": [
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"node_modules/@juicesharp/rpiv-ask-user-question/index.ts",
|
|
34
34
|
"node_modules/@juicesharp/rpiv-todo/index.ts",
|
|
35
35
|
"node_modules/@narumitw/pi-btw/dist/index.ts",
|
|
36
|
+
"node_modules/@samrito/pi-cliproxyapi-provider/extensions/index.ts",
|
|
36
37
|
"node_modules/pi-background-tasks/extensions/anthropic-attribution.ts",
|
|
37
38
|
"node_modules/pi-background-tasks/extensions/background-tasks.ts",
|
|
38
|
-
"node_modules/pi-cliproxyapi-provider/extensions/index.ts",
|
|
39
39
|
"node_modules/pi-goal-x/extensions/goal.ts",
|
|
40
40
|
"node_modules/pi-tool-display/index.ts",
|
|
41
41
|
"node_modules/pi-zentui/extensions/zentui/index.ts"
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@juicesharp/rpiv-ask-user-question": "^2.9.0",
|
|
55
55
|
"@juicesharp/rpiv-todo": "^2.9.0",
|
|
56
56
|
"@narumitw/pi-btw": "^0.58.1",
|
|
57
|
+
"@samrito/pi-cliproxyapi-provider": "^0.16.0",
|
|
57
58
|
"pi-background-tasks": "^2.5.0",
|
|
58
|
-
"pi-cliproxyapi-provider": "^0.15.30",
|
|
59
59
|
"pi-goal-x": "^0.31.2",
|
|
60
60
|
"pi-tool-display": "^0.5.0",
|
|
61
61
|
"pi-zentui": "^0.23.0"
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@juicesharp/rpiv-ask-user-question",
|
|
66
66
|
"@juicesharp/rpiv-todo",
|
|
67
67
|
"@narumitw/pi-btw",
|
|
68
|
+
"@samrito/pi-cliproxyapi-provider",
|
|
68
69
|
"pi-background-tasks",
|
|
69
|
-
"pi-cliproxyapi-provider",
|
|
70
70
|
"pi-goal-x",
|
|
71
71
|
"pi-tool-display",
|
|
72
72
|
"pi-zentui"
|
|
File without changes
|
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/auth.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/cache.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/catalog.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/commands.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/config.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/cpa.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/discovery.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/matching.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/model-api.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/models-dev.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/network.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/runtime.ts
RENAMED
|
File without changes
|
/package/node_modules/{pi-cliproxyapi-provider → @samrito/pi-cliproxyapi-provider}/src/settings.ts
RENAMED
|
File without changes
|