@oh-my-pi/pi-catalog 18.4.2 → 18.4.4
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/CHANGELOG.md +43 -0
- package/dist/types/compat/anthropic.d.ts +6 -0
- package/dist/types/compat/types.d.ts +4 -0
- package/dist/types/hosts.d.ts +13 -0
- package/dist/types/provider-models/openai-compat.d.ts +10 -7
- package/dist/types/types.d.ts +35 -1
- package/dist/types/wire/codex.d.ts +5 -3
- package/package.json +4 -4
- package/src/build.ts +5 -0
- package/src/compat/anthropic.ts +11 -1
- package/src/compat/axes.ts +5 -0
- package/src/compat/collapse.ts +11 -2
- package/src/compat/resolve.ts +13 -3
- package/src/compat/rules/README.md +1 -1
- package/src/compat/rules/auth/commandcode.kdl +10 -4
- package/src/compat/rules/classes/anthropic.kdl +37 -3
- package/src/compat/rules/classes/gemini.kdl +11 -0
- package/src/compat/rules/classes/openai.kdl +22 -0
- package/src/compat/rules/classes/xai.kdl +6 -0
- package/src/compat/rules/providers/anthropic.kdl +6 -0
- package/src/compat/rules/providers/commandcode.kdl +223 -76
- package/src/compat/rules/providers/openai-codex.kdl +20 -2
- package/src/compat/rules/providers/openai.kdl +0 -6
- package/src/compat/rules/providers/web.kdl +8 -0
- package/src/compat/rules/runtime/behavior.kdl +7 -2
- package/src/compat/rules/taxonomy/_collapse.kdl +3 -0
- package/src/compat/rules.json +1 -1
- package/src/compat/types.ts +11 -1
- package/src/discovery/codex.ts +16 -0
- package/src/hosts.ts +47 -0
- package/src/models.json +1 -1
- package/src/provider-models/openai-compat.ts +19 -11
- package/src/types.ts +37 -1
- package/src/wire/codex.ts +5 -3
|
@@ -7296,7 +7296,8 @@ export function modelsDevCatalogFallback(
|
|
|
7296
7296
|
* `baseUrl` overrides the Provider API base path for testing; it is
|
|
7297
7297
|
* normalized to the shared `/provider` root (a trailing `/v1` is stripped)
|
|
7298
7298
|
* so Claude ids route to the Anthropic-compatible Messages endpoint at the
|
|
7299
|
-
* root
|
|
7299
|
+
* root, the ten GPT ids listed in the `api-routes` table to the Responses
|
|
7300
|
+
* endpoint under `/v1`, and every other id to chat completions under `/v1`.
|
|
7300
7301
|
*/
|
|
7301
7302
|
export interface CommandCodeModelManagerConfig {
|
|
7302
7303
|
apiKey?: string;
|
|
@@ -7315,12 +7316,14 @@ function normalizeCommandCodeBasePath(baseUrl: string | undefined): string {
|
|
|
7315
7316
|
* Builds the Command Code model manager: a mixed-protocol OpenAI-compatible
|
|
7316
7317
|
* discovery client. The public `/v1/models` catalog is fetched once per
|
|
7317
7318
|
* options instance; `mapModel` pins each row's transport from the
|
|
7318
|
-
* `api-routes` table (Claude ids to `anthropic-messages`,
|
|
7319
|
-
* `openai-completions`) and seeds
|
|
7320
|
-
* Command Code policy (effort ladders,
|
|
7321
|
-
* applied later by `buildModel` from
|
|
7322
|
-
* mapper never inherits another provider's
|
|
7323
|
-
* or context window.
|
|
7319
|
+
* `api-routes` table (Claude ids to `anthropic-messages`, the listed GPT ids
|
|
7320
|
+
* to `openai-responses`, everything else to `openai-completions`) and seeds
|
|
7321
|
+
* neutral capability defaults. Reviewed Command Code policy (effort ladders,
|
|
7322
|
+
* pricing, limits, modalities) is applied later by `buildModel` from
|
|
7323
|
+
* `providers/commandcode.kdl` — the mapper never inherits another provider's
|
|
7324
|
+
* reasoning, rates, image support, or context window. A successful fetch also
|
|
7325
|
+
* appends the KDL `seed` rows (typesafe/jev), rebased onto the configured
|
|
7326
|
+
* base, because `dynamicModelsAuthoritative` would prune `staticModels`.
|
|
7324
7327
|
*/
|
|
7325
7328
|
export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerConfig): ModelManagerOptions<Api> {
|
|
7326
7329
|
const basePath = normalizeCommandCodeBasePath(config?.baseUrl);
|
|
@@ -7332,8 +7335,8 @@ export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerC
|
|
|
7332
7335
|
baseUrl: discoveryBaseUrl,
|
|
7333
7336
|
}),
|
|
7334
7337
|
dynamicModelsAuthoritative: true,
|
|
7335
|
-
fetchDynamicModels: () => {
|
|
7336
|
-
|
|
7338
|
+
fetchDynamicModels: async () => {
|
|
7339
|
+
const discovered = await fetchOpenAICompatibleModels<Api>({
|
|
7337
7340
|
api: "openai-completions",
|
|
7338
7341
|
provider: "commandcode",
|
|
7339
7342
|
baseUrl: discoveryBaseUrl,
|
|
@@ -7342,8 +7345,9 @@ export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerC
|
|
|
7342
7345
|
// inference. The helper only sends Authorization when set.
|
|
7343
7346
|
apiKey: config?.apiKey,
|
|
7344
7347
|
mapModel: (entry, defaults) => {
|
|
7345
|
-
const route = apiRouteFor("commandcode", defaults.id);
|
|
7346
|
-
const api =
|
|
7348
|
+
const route = apiRouteFor("commandcode", defaults.id)?.api;
|
|
7349
|
+
const api =
|
|
7350
|
+
route === "anthropic-messages" || route === "openai-responses" ? route : "openai-completions";
|
|
7347
7351
|
return {
|
|
7348
7352
|
...defaults,
|
|
7349
7353
|
name: toModelName(entry.name, defaults.name),
|
|
@@ -7373,6 +7377,10 @@ export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerC
|
|
|
7373
7377
|
},
|
|
7374
7378
|
fetch: config?.fetch,
|
|
7375
7379
|
});
|
|
7380
|
+
if (!discovered) return null;
|
|
7381
|
+
const seeds = seedModels("commandcode").map(seed => ({ ...seed, baseUrl: basePath }));
|
|
7382
|
+
const seedIds = new Set(seeds.map(seed => seed.id));
|
|
7383
|
+
return [...discovered.filter(model => !seedIds.has(model.id)), ...seeds];
|
|
7376
7384
|
},
|
|
7377
7385
|
};
|
|
7378
7386
|
}
|
package/src/types.ts
CHANGED
|
@@ -560,6 +560,15 @@ export interface AnthropicCompat {
|
|
|
560
560
|
* `tools.<n>.custom.strict: Extra inputs are not permitted`.
|
|
561
561
|
*/
|
|
562
562
|
disableStrictTools?: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* The endpoint is Amazon Bedrock's Anthropic Messages API (`/anthropic` on
|
|
565
|
+
* bedrock-runtime or bedrock-mantle). Requests drop tool `strict`, fit
|
|
566
|
+
* `metadata.user_id` to Bedrock's request-metadata pattern, and may use
|
|
567
|
+
* on-demand compaction. Detected from the model `baseUrl`; set it in
|
|
568
|
+
* models.yml `compat` for a route the URL check cannot see (a proxy, an
|
|
569
|
+
* `ANTHROPIC_BASE_URL` reroute) or to `false` to opt out.
|
|
570
|
+
*/
|
|
571
|
+
bedrockMessagesApi?: boolean;
|
|
563
572
|
/**
|
|
564
573
|
* Map adaptive thinking (`thinking: { type: "adaptive" }`) to
|
|
565
574
|
* `{ type: "enabled", budget_tokens }`. Vertex AI rejects the `adaptive`
|
|
@@ -587,6 +596,13 @@ export interface AnthropicCompat {
|
|
|
587
596
|
* `input_transformations` under the thinking-binding-controls beta.
|
|
588
597
|
*/
|
|
589
598
|
supportsThinkingBindingControls?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Whether the model replaces `thinking: { type: "disabled" }` with
|
|
601
|
+
* `thinking: { type: "between_tools" }` (Claude Sonnet 5.5). The disabled
|
|
602
|
+
* form is rejected with a 400; `between_tools` skips up-front thinking and
|
|
603
|
+
* only allows progress updates between tool calls.
|
|
604
|
+
*/
|
|
605
|
+
supportsBetweenToolsThinking?: boolean;
|
|
590
606
|
/**
|
|
591
607
|
* Whether the model accepts a forced `tool_choice` (`{ type: "any" }` or
|
|
592
608
|
* `{ type: "tool", name }`). Claude Fable/Mythos 5 reject forced tool use
|
|
@@ -960,9 +976,17 @@ export interface ResolvedOpenAIResponsesCompat extends ResolvedOpenAISharedCompa
|
|
|
960
976
|
export type ResolvedOpenRouterCompat = ResolvedOpenAICompat & ResolvedOpenAIResponsesCompat;
|
|
961
977
|
|
|
962
978
|
/** Fully-resolved anthropic-messages compat view (same contract as `ResolvedOpenAICompat`). */
|
|
963
|
-
export type ResolvedAnthropicCompat = Required<
|
|
979
|
+
export type ResolvedAnthropicCompat = Required<
|
|
980
|
+
Omit<AnthropicCompat, "streamIdleTimeoutMs" | "thinkingLoopGuard" | "bedrockMessagesApi">
|
|
981
|
+
> & {
|
|
964
982
|
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
965
983
|
thinkingLoopGuard?: AnthropicCompat["thinkingLoopGuard"];
|
|
984
|
+
/**
|
|
985
|
+
* Bedrock's Anthropic Messages API (see {@link AnthropicCompat.bedrockMessagesApi}).
|
|
986
|
+
* `true` when detected or configured; otherwise unset, so rows baked before
|
|
987
|
+
* this field keep matching.
|
|
988
|
+
*/
|
|
989
|
+
bedrockMessagesApi?: boolean;
|
|
966
990
|
/**
|
|
967
991
|
* Stream-watchdog idle-timeout fallback in ms for slow reasoning hosts; 0 disables the idle watchdog.
|
|
968
992
|
* Undefined defers to `PI_STREAM_IDLE_TIMEOUT_MS`, then the legacy
|
|
@@ -1201,6 +1225,12 @@ export interface Model<TApi extends Api = Api> {
|
|
|
1201
1225
|
kind?: ModelKind;
|
|
1202
1226
|
/** Grounding transport supported by this chat model. */
|
|
1203
1227
|
webSearch?: WebSearchGrounding;
|
|
1228
|
+
/** Cheaper same-provider model to run hosted web search in this model's place (model id or provider/id). */
|
|
1229
|
+
webSearchModel?: string;
|
|
1230
|
+
/** Whether this chat model can carry the Responses `image_generation` tool itself. */
|
|
1231
|
+
hostedImage?: boolean;
|
|
1232
|
+
/** Same-provider image model to generate images in this model's place (model id or provider/id). */
|
|
1233
|
+
imageModel?: string;
|
|
1204
1234
|
/**
|
|
1205
1235
|
* Structured model identity resolved by the compat engine: vendor lineage
|
|
1206
1236
|
* class, product family, and revision. Baked into models.json rows and
|
|
@@ -1352,6 +1382,12 @@ export interface Model<TApi extends Api = Api> {
|
|
|
1352
1382
|
useResponsesLite?: boolean;
|
|
1353
1383
|
/** Codex Code Mode restriction: model expects tools routed through a programmatic exec surface (mirrors codex-rs `tool_mode`). */
|
|
1354
1384
|
toolMode?: "code_mode_only";
|
|
1385
|
+
/**
|
|
1386
|
+
* Service-tier ids the provider advertises for this model (Codex discovery
|
|
1387
|
+
* `service_tiers[].id`, e.g. `priority`, `ultrafast`). Absent when the
|
|
1388
|
+
* provider publishes no per-model tier list.
|
|
1389
|
+
*/
|
|
1390
|
+
serviceTiers?: readonly string[];
|
|
1355
1391
|
/** Preferred model to switch to when context promotion is triggered (model id or provider/id). */
|
|
1356
1392
|
contextPromotionTarget?: string;
|
|
1357
1393
|
/** Preferred model to use only for compaction (model id or provider/id); the active session model is unchanged. */
|
package/src/wire/codex.ts
CHANGED
|
@@ -9,10 +9,12 @@ export const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
|
9
9
|
* Updated from npm by `bun run check-spoofed-versions --update`.
|
|
10
10
|
*
|
|
11
11
|
* The backend version-gates model availability against this value on both
|
|
12
|
-
* `/models?client_version=` and `/responses
|
|
13
|
-
*
|
|
12
|
+
* `/models?client_version=` and `/responses`, independently of a model's
|
|
13
|
+
* declared `minimal_client_version`: GPT-6.1 Sol declares 0.153.0 yet is
|
|
14
|
+
* omitted from `/models` at 0.155.1 and listed at 0.159.0. An older pin
|
|
15
|
+
* silently hides newer SKUs from discovery.
|
|
14
16
|
*/
|
|
15
|
-
export const CODEX_CLIENT_VERSION = "0.
|
|
17
|
+
export const CODEX_CLIENT_VERSION = "0.159.0";
|
|
16
18
|
|
|
17
19
|
export const OPENAI_HEADERS = {
|
|
18
20
|
BETA: "OpenAI-Beta",
|