@oh-my-pi/pi-catalog 18.4.2 → 18.4.3

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.
@@ -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 while every other id uses chat completions under `/v1`.
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`, everything else to
7319
- * `openai-completions`) and seeds neutral capability defaults. Reviewed
7320
- * Command Code policy (effort ladders, pricing, limits, modalities) is
7321
- * applied later by `buildModel` from `providers/commandcode.kdl` — the
7322
- * mapper never inherits another provider's reasoning, rates, image support,
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
- return fetchOpenAICompatibleModels<Api>({
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 = route?.api === "anthropic-messages" ? route.api : "openai-completions";
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
@@ -1201,6 +1201,12 @@ export interface Model<TApi extends Api = Api> {
1201
1201
  kind?: ModelKind;
1202
1202
  /** Grounding transport supported by this chat model. */
1203
1203
  webSearch?: WebSearchGrounding;
1204
+ /** Cheaper same-provider model to run hosted web search in this model's place (model id or provider/id). */
1205
+ webSearchModel?: string;
1206
+ /** Whether this chat model can carry the Responses `image_generation` tool itself. */
1207
+ hostedImage?: boolean;
1208
+ /** Same-provider image model to generate images in this model's place (model id or provider/id). */
1209
+ imageModel?: string;
1204
1210
  /**
1205
1211
  * Structured model identity resolved by the compat engine: vendor lineage
1206
1212
  * class, product family, and revision. Baked into models.json rows and