@oh-my-pi/pi-catalog 18.2.7 → 18.2.9
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 +26 -3
- package/README.md +18 -18
- package/dist/types/compat/auth-ids.d.ts +2 -2
- package/dist/types/compat/axes.d.ts +2 -2
- package/dist/types/compat/catalog-policy.d.ts +7 -0
- package/dist/types/compat/output-limits.d.ts +3 -0
- package/dist/types/compat/provider-ids.d.ts +1 -1
- package/dist/types/compat/tools.d.ts +5 -0
- package/dist/types/compat/types.d.ts +2 -2
- package/dist/types/provider-models/openai-compat.d.ts +26 -0
- package/dist/types/types.d.ts +5 -2
- package/dist/types/wire/singularityapi.d.ts +29 -0
- package/package.json +38 -38
- package/src/compat/auth-ids.ts +4 -0
- package/src/compat/axes.ts +21 -2
- package/src/compat/catalog-policy.ts +28 -0
- package/src/compat/output-limits.ts +12 -0
- package/src/compat/provider-ids.ts +2 -0
- package/src/compat/resolve.ts +4 -2
- package/src/compat/rules/README.md +34 -33
- package/src/compat/rules/auth/_order.kdl +1 -1
- package/src/compat/rules/auth/singularityapi-dev.kdl +22 -0
- package/src/compat/rules/auth/singularityapi-tech.kdl +23 -0
- package/src/compat/rules/classes/gpt-oss.kdl +3 -0
- package/src/compat/rules/classes/xai.kdl +3 -3
- package/src/compat/rules/providers/amazon-bedrock.kdl +1 -1
- package/src/compat/rules/providers/anthropic.kdl +1 -1
- package/src/compat/rules/providers/cloudflare-ai-gateway.kdl +1 -1
- package/src/compat/rules/providers/commandcode.kdl +1 -1
- package/src/compat/rules/providers/cursor.kdl +1 -1
- package/src/compat/rules/providers/google-antigravity.kdl +5 -0
- package/src/compat/rules/providers/kilo.kdl +1 -1
- package/src/compat/rules/providers/litellm.kdl +1 -1
- package/src/compat/rules/providers/native-tools.kdl +4 -0
- package/src/compat/rules/providers/openai.kdl +58 -0
- package/src/compat/rules/providers/opencode-zen.kdl +1 -1
- package/src/compat/rules/providers/openrouter.kdl +108 -0
- package/src/compat/rules/providers/output-limits.kdl +4 -0
- package/src/compat/rules/providers/singularityapi-dev.kdl +92 -0
- package/src/compat/rules/providers/singularityapi-tech.kdl +72 -0
- package/src/compat/rules/providers/tool-free-history.kdl +6 -0
- package/src/compat/rules/providers/vercel-ai-gateway.kdl +1 -1
- package/src/compat/rules/providers/xai-oauth.kdl +8 -1
- package/src/compat/rules/providers/xai.kdl +4 -4
- package/src/compat/rules/providers/xiaomi-token-plan-cn.kdl +23 -0
- package/src/compat/rules/providers/zenmux.kdl +1 -1
- package/src/compat/rules/runtime/behavior.kdl +2 -0
- package/src/compat/rules.json +1 -1
- package/src/compat/tools.ts +12 -0
- package/src/compat/types.ts +2 -2
- package/src/discovery/devin.ts +59 -34
- package/src/models.json +1 -1
- package/src/provider-models/cache-provider-id.ts +31 -0
- package/src/provider-models/descriptors.ts +4 -0
- package/src/provider-models/openai-compat.ts +390 -119
- package/src/types.ts +19 -1
- package/src/wire/singularityapi.ts +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Updated default models for anthropic, amazon-bedrock, cloudflare-ai-gateway, kilo, litellm, opencode-zen, vercel-ai-gateway, and zenmux to claude-opus-5-5
|
|
8
|
+
- Updated default model for commandcode to claude-sonnet-5
|
|
9
|
+
|
|
10
|
+
## [18.2.9] - 2026-09-22
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Local OpenAI-compatible backends—including llama.cpp, LM Studio, vLLM, Ollama, and custom loopback or LAN hosts—now support maxTokens values above 64k without incorrectly applying the hosted OpenAI limit.
|
|
15
|
+
- Fixed Union Alpha requests on OpenCode Go and Zen by using the correct Messages API.
|
|
16
|
+
- Updated SuperGrok’s Grok 4.7 metadata to expose its documented 500K context window and low, medium, high, and xhigh thinking levels.
|
|
17
|
+
- Fixed GPT-OSS tool interactions on Google Antigravity and Gemini CLI so function-call history is preserved correctly.
|
|
18
|
+
- Fixed Devin model discovery for Enterprise credentials by falling back to the legacy Windsurf catalog when native discovery does not return the full model list.
|
|
19
|
+
- Curated Xiaomi Token Plan (China) MiMo V2.6 metadata: context/output limits, reasoning, and image input ([#12841](https://github.com/can1357/oh-my-pi/pull/12841) by [@roboomp](https://github.com/roboomp)).
|
|
20
|
+
|
|
21
|
+
## [18.2.8] - 2026-09-21
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Expanded OpenRouter provider support with embedding, reranking, video generation, text-to-speech, and speech-to-text capabilities, including five new speech-to-text models.
|
|
26
|
+
- Added speech-to-text support to the OpenAI provider.
|
|
27
|
+
|
|
5
28
|
## [18.2.7] - 2026-09-21
|
|
6
29
|
|
|
7
30
|
### Added
|
|
@@ -181,9 +204,9 @@
|
|
|
181
204
|
### Fixed
|
|
182
205
|
|
|
183
206
|
- Fixed OpenCode Go/Zen live model discovery (`GET /v1/models`) missing `x-opencode-session` and omp's `User-Agent`: discovery requests now attribute with the stable install id so the requests OpenCode flags as `Bun fetch` carry the required session header.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
207
|
+
- Fixed GPT-6 Astra requests through GitHub Copilot failing with an unsupported endpoint error ([#10874](https://github.com/can1357/oh-my-pi/pull/10874) by [@xpcmdshell](https://github.com/xpcmdshell)).
|
|
208
|
+
- Fixed GPT-6 Astra showing as free with a 272K-token window in the OpenAI Codex catalog by applying its documented pricing; `/extended-context` enables the wire-advertised 872K-token maximum ([#10980](https://github.com/can1357/oh-my-pi/pull/10980) by [@H4vC](https://github.com/H4vC)).
|
|
209
|
+
- Made extended-context catalog rebuilds faster by resolving each model's maximum window once per process ([#11039](https://github.com/can1357/oh-my-pi/pull/11039) by [@H4vC](https://github.com/H4vC)).
|
|
187
210
|
|
|
188
211
|
## [18.1.9] - 2026-09-04
|
|
189
212
|
|
package/README.md
CHANGED
|
@@ -4,18 +4,18 @@ Model catalog for [oh-my-pi](https://github.com/can1357/oh-my-pi): bundled model
|
|
|
4
4
|
|
|
5
5
|
## What's inside
|
|
6
6
|
|
|
7
|
-
| Module | Purpose
|
|
8
|
-
| ------------------------------- |
|
|
9
|
-
| `models.json` + `models` | Bundled model database (pricing, context windows, modalities, thinking support)
|
|
10
|
-
| `provider-models` | Provider catalog descriptors (`CATALOG_PROVIDERS`), per-provider model resolution rules
|
|
11
|
-
| `discovery` | Runtime model discovery for OpenAI-compatible endpoints, Gemini, Codex, Cursor, Antigravity, Ollama
|
|
12
|
-
| `compat/rules` | Checked-in KDL policy tree: taxonomy (classes/families/revisions), class/provider cascade rules, runtime behavior vocabulary; compiled by `bun run gen:compat` into the committed `rules.json`
|
|
7
|
+
| Module | Purpose |
|
|
8
|
+
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `models.json` + `models` | Bundled model database (pricing, context windows, modalities, thinking support) |
|
|
10
|
+
| `provider-models` | Provider catalog descriptors (`CATALOG_PROVIDERS`), per-provider model resolution rules |
|
|
11
|
+
| `discovery` | Runtime model discovery for OpenAI-compatible endpoints, Gemini, Codex, Cursor, Antigravity, Ollama |
|
|
12
|
+
| `compat/rules` | Checked-in KDL policy tree: taxonomy (classes/families/revisions), class/provider cascade rules, runtime behavior vocabulary; compiled by `bun run gen:compat` into the committed `rules.json` |
|
|
13
13
|
| `compat` | The rule engine: `classifyModel` (taxonomy), `resolveModelPolicy` (cascade), behavior accessors (`api-routes`, `model-limits`, `exclude-models`, `pricing-peer`), collapse, and OpenAI/Anthropic wire builders that consume resolved records |
|
|
14
|
-
| `identity` | Mechanical id utilities: reference resolution against the bundled index, dialects, selection priority, tokenizer families
|
|
15
|
-
| `model-thinking` | Runtime thinking helpers (`getSupportedEfforts`, effort clamping/mapping, wire-id routing) over resolved model records
|
|
16
|
-
| `model-manager` / `model-cache` | Runtime model registry with discovery refresh and on-disk caching
|
|
17
|
-
| `wire` | Wire-level helpers: Codex, Gemini headers, GitHub Copilot
|
|
18
|
-
| `effort` | Reasoning-effort level definitions
|
|
14
|
+
| `identity` | Mechanical id utilities: reference resolution against the bundled index, dialects, selection priority, tokenizer families |
|
|
15
|
+
| `model-thinking` | Runtime thinking helpers (`getSupportedEfforts`, effort clamping/mapping, wire-id routing) over resolved model records |
|
|
16
|
+
| `model-manager` / `model-cache` | Runtime model registry with discovery refresh and on-disk caching |
|
|
17
|
+
| `wire` | Wire-level helpers: Codex, Gemini headers, GitHub Copilot |
|
|
18
|
+
| `effort` | Reasoning-effort level definitions |
|
|
19
19
|
|
|
20
20
|
Import from subpaths (`@oh-my-pi/pi-catalog/<module>`) or the root barrel.
|
|
21
21
|
|
|
@@ -42,13 +42,13 @@ Ships TypeScript source directly (no build step); requires Bun ≥ 1.3.14.
|
|
|
42
42
|
|
|
43
43
|
The `models` subpath (also exported from the root) provides timestamp-aware pricing helpers:
|
|
44
44
|
|
|
45
|
-
| API
|
|
46
|
-
|
|
|
47
|
-
| `calculateCost(model, usage, timestamp?)`
|
|
48
|
-
| `calculateUsageCost(cost, usage, timestamp?)`
|
|
49
|
-
| `calculateUncachedInputCost(cost, promptInputTokens, timestamp?)` | Returns the cost of a fully uncached prompt.
|
|
50
|
-
| `getTimeBasedPricingPeriod(cost, timestamp?)`
|
|
51
|
-
| `getNextTimeBasedPricingTransition(cost, timestamp?)`
|
|
45
|
+
| API | Result |
|
|
46
|
+
| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
47
|
+
| `calculateCost(model, usage, timestamp?)` | Updates and returns `usage.cost` using `model.cost`. |
|
|
48
|
+
| `calculateUsageCost(cost, usage, timestamp?)` | Updates and returns `usage.cost` using a `ModelCost`. |
|
|
49
|
+
| `calculateUncachedInputCost(cost, promptInputTokens, timestamp?)` | Returns the cost of a fully uncached prompt. |
|
|
50
|
+
| `getTimeBasedPricingPeriod(cost, timestamp?)` | Returns `"peak"`, `"off-peak"`, or `undefined` without a schedule. |
|
|
51
|
+
| `getNextTimeBasedPricingTransition(cost, timestamp?)` | Returns the next actual peak/off-peak change strictly after the timestamp, or `undefined` if none exists. |
|
|
52
52
|
|
|
53
53
|
Timestamps are Unix milliseconds; omitted timestamps use the current time for scheduled pricing. Flat token prices are unaffected. Pricing selects the latest applicable effective rate card, then its long-context tier, then the peak/off-peak multiplier. A transition query concerns the recurring tariff, not dated rate-card changes.
|
|
54
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** Every provider with an `auth/<id>.kdl` policy. */
|
|
2
|
-
export type AuthProviderId = "abliteration" | "aiand" | "aimlapi" | "alibaba-coding-plan" | "alibaba-token-plan" | "amazon-bedrock" | "anthropic" | "azure" | "baseten" | "bedrock-mantle" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "commandcode" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "exa" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google" | "google-antigravity" | "google-gemini-cli" | "google-vertex" | "groq" | "huggingface" | "kagi" | "kilo" | "kimi-code" | "litellm" | "llama.cpp" | "lm-studio" | "local" | "meta" | "minimax" | "minimax-code" | "minimax-code-cn" | "mistral" | "moonshot" | "muse-code" | "nanogpt" | "novita" | "nvidia" | "ollama" | "ollama-cloud" | "openai" | "openai-codex" | "openai-codex-device" | "opencode-go" | "opencode-zen" | "openrouter" | "parallel" | "perplexity" | "qianfan" | "qwen-portal" | "sakana" | "siliconflow" | "siliconflow-cn" | "stencil" | "synthetic" | "tavily" | "together" | "typesafe" | "umans" | "venice" | "vercel-ai-gateway" | "vllm" | "wafer-serverless" | "web" | "xai" | "xai-oauth" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "yolo-auto" | "zai" | "zai-coding-plan" | "zenmux" | "zhipu-coding-plan";
|
|
2
|
+
export type AuthProviderId = "abliteration" | "aiand" | "aimlapi" | "alibaba-coding-plan" | "alibaba-token-plan" | "amazon-bedrock" | "anthropic" | "azure" | "baseten" | "bedrock-mantle" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "commandcode" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "exa" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google" | "google-antigravity" | "google-gemini-cli" | "google-vertex" | "groq" | "huggingface" | "kagi" | "kilo" | "kimi-code" | "litellm" | "llama.cpp" | "lm-studio" | "local" | "meta" | "minimax" | "minimax-code" | "minimax-code-cn" | "mistral" | "moonshot" | "muse-code" | "nanogpt" | "novita" | "nvidia" | "ollama" | "ollama-cloud" | "openai" | "openai-codex" | "openai-codex-device" | "opencode-go" | "opencode-zen" | "openrouter" | "parallel" | "perplexity" | "qianfan" | "qwen-portal" | "sakana" | "siliconflow" | "siliconflow-cn" | "singularityapi-dev" | "singularityapi-tech" | "stencil" | "synthetic" | "tavily" | "together" | "typesafe" | "umans" | "venice" | "vercel-ai-gateway" | "vllm" | "wafer-serverless" | "web" | "xai" | "xai-oauth" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "yolo-auto" | "zai" | "zai-coding-plan" | "zenmux" | "zhipu-coding-plan";
|
|
3
3
|
/** Providers whose policy declares a `login` flow (the `/login` roster). */
|
|
4
|
-
export type LoginProviderId = "abliteration" | "aiand" | "alibaba-coding-plan" | "alibaba-token-plan" | "anthropic" | "baseten" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "commandcode" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "exa" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google-antigravity" | "google-gemini-cli" | "huggingface" | "kagi" | "kilo" | "kimi-code" | "litellm" | "llama.cpp" | "lm-studio" | "meta" | "minimax-code" | "minimax-code-cn" | "moonshot" | "muse-code" | "nanogpt" | "novita" | "nvidia" | "ollama" | "ollama-cloud" | "openai-codex" | "openai-codex-device" | "opencode-go" | "opencode-zen" | "openrouter" | "parallel" | "perplexity" | "qianfan" | "qwen-portal" | "sakana" | "siliconflow" | "siliconflow-cn" | "stencil" | "synthetic" | "tavily" | "together" | "typesafe" | "umans" | "venice" | "vercel-ai-gateway" | "vllm" | "wafer-serverless" | "xai" | "xai-oauth" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "yolo-auto" | "zai" | "zai-coding-plan" | "zenmux" | "zhipu-coding-plan";
|
|
4
|
+
export type LoginProviderId = "abliteration" | "aiand" | "alibaba-coding-plan" | "alibaba-token-plan" | "anthropic" | "baseten" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "commandcode" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "exa" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google-antigravity" | "google-gemini-cli" | "huggingface" | "kagi" | "kilo" | "kimi-code" | "litellm" | "llama.cpp" | "lm-studio" | "meta" | "minimax-code" | "minimax-code-cn" | "moonshot" | "muse-code" | "nanogpt" | "novita" | "nvidia" | "ollama" | "ollama-cloud" | "openai-codex" | "openai-codex-device" | "opencode-go" | "opencode-zen" | "openrouter" | "parallel" | "perplexity" | "qianfan" | "qwen-portal" | "sakana" | "siliconflow" | "siliconflow-cn" | "singularityapi-dev" | "singularityapi-tech" | "stencil" | "synthetic" | "tavily" | "together" | "typesafe" | "umans" | "venice" | "vercel-ai-gateway" | "vllm" | "wafer-serverless" | "xai" | "xai-oauth" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "yolo-auto" | "zai" | "zai-coding-plan" | "zenmux" | "zhipu-coding-plan";
|
|
@@ -25,8 +25,8 @@ export interface AxisDef {
|
|
|
25
25
|
shape: AxisShape;
|
|
26
26
|
/** Wire axes only: records this key exists on. */
|
|
27
27
|
records?: readonly CompatRecordName[];
|
|
28
|
-
/** Closed value vocabulary for
|
|
29
|
-
values?: readonly string[];
|
|
28
|
+
/** Closed value vocabulary for scalars / arrays (strings, and booleans on flag axes). */
|
|
29
|
+
values?: readonly (string | boolean)[];
|
|
30
30
|
/**
|
|
31
31
|
* Object axes only: payload child names are literal wire JSON keys copied
|
|
32
32
|
* verbatim (`extra-body`). Default object payloads author kebab-case names
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Model } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The `catalog` axis bag authored in the KDL cascade rules for a model,
|
|
4
|
+
* memoized per distinct model. Frozen: the bag is shared across callers, so it
|
|
5
|
+
* must stay read-only — extract the value you need rather than handing it on.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveCatalogPolicy(model: Model): Readonly<Record<string, unknown>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Every chat-model provider with a catalog entry (`default-model` in its provider rules). */
|
|
2
|
-
export type KnownProvider = "abliteration" | "aiand" | "aimlapi" | "alibaba-coding-plan" | "alibaba-token-plan" | "amazon-bedrock" | "anthropic" | "azure" | "baseten" | "bedrock-mantle" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "commandcode" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google" | "google-antigravity" | "google-gemini-cli" | "google-vertex" | "groq" | "huggingface" | "kilo" | "kimi-code" | "litellm" | "lm-studio" | "local" | "meta" | "minimax" | "minimax-code" | "minimax-code-cn" | "mistral" | "moonshot" | "muse-code" | "nanogpt" | "novita" | "nvidia" | "ollama" | "ollama-cloud" | "openai" | "openai-codex" | "opencode-go" | "opencode-zen" | "openrouter" | "qianfan" | "qwen-portal" | "sakana" | "siliconflow" | "siliconflow-cn" | "synthetic" | "together" | "typesafe" | "umans" | "venice" | "vercel-ai-gateway" | "vllm" | "wafer-serverless" | "web" | "xai" | "xai-oauth" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "yolo-auto" | "zai" | "zenmux" | "zhipu-coding-plan";
|
|
2
|
+
export type KnownProvider = "abliteration" | "aiand" | "aimlapi" | "alibaba-coding-plan" | "alibaba-token-plan" | "amazon-bedrock" | "anthropic" | "azure" | "baseten" | "bedrock-mantle" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "commandcode" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google" | "google-antigravity" | "google-gemini-cli" | "google-vertex" | "groq" | "huggingface" | "kilo" | "kimi-code" | "litellm" | "lm-studio" | "local" | "meta" | "minimax" | "minimax-code" | "minimax-code-cn" | "mistral" | "moonshot" | "muse-code" | "nanogpt" | "novita" | "nvidia" | "ollama" | "ollama-cloud" | "openai" | "openai-codex" | "opencode-go" | "opencode-zen" | "openrouter" | "qianfan" | "qwen-portal" | "sakana" | "siliconflow" | "siliconflow-cn" | "singularityapi-dev" | "singularityapi-tech" | "synthetic" | "together" | "typesafe" | "umans" | "venice" | "vercel-ai-gateway" | "vllm" | "wafer-serverless" | "web" | "xai" | "xai-oauth" | "xiaomi" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-sgp" | "yolo-auto" | "zai" | "zenmux" | "zhipu-coding-plan";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Model } from "../types.js";
|
|
2
|
+
/** Whether the transport exposes native tools that an empty caller catalog cannot disable. */
|
|
3
|
+
export declare function requiresNativeTools(model: Model): boolean;
|
|
4
|
+
/** Whether disabling tools requires a history without prior tool calls or results. */
|
|
5
|
+
export declare function requiresToolFreeHistoryForToolOptOut(model: Model): boolean;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `behavior.ts`, `resolve.ts`) exposes to consumers.
|
|
6
6
|
*/
|
|
7
7
|
import type { Effort } from "../effort.js";
|
|
8
|
-
import type { Api, ThinkingControlMode, TokenCost } from "../types.js";
|
|
8
|
+
import type { Api, KindApiKind, ThinkingControlMode, TokenCost } from "../types.js";
|
|
9
9
|
import type { RevisionOp } from "./revision.js";
|
|
10
10
|
/** Class-membership matcher kinds, most to least specific. */
|
|
11
11
|
export type MatcherKind = "exact" | "bounded" | "namespace" | "prefix" | "glob";
|
|
@@ -620,7 +620,7 @@ export interface CompiledProvider {
|
|
|
620
620
|
/** Present only for providers enrolled in `generate-models.ts` discovery. */
|
|
621
621
|
discovery?: CompiledProviderDiscovery;
|
|
622
622
|
/** Non-chat model kinds mapped to their runtime transport APIs. */
|
|
623
|
-
kindApis?: Partial<Record<
|
|
623
|
+
kindApis?: Partial<Record<KindApiKind, Api>>;
|
|
624
624
|
/** Authored bundled rows, when the provider cannot be discovered at generation time. */
|
|
625
625
|
seed?: CompiledSeed;
|
|
626
626
|
}
|
|
@@ -661,3 +661,29 @@ export interface CharmHyperModelManagerConfig {
|
|
|
661
661
|
* alive by a stale bundled row.
|
|
662
662
|
*/
|
|
663
663
|
export declare function charmHyperModelManagerOptions(config?: CharmHyperModelManagerConfig): ModelManagerOptions<"openai-completions">;
|
|
664
|
+
export interface SingularityApiModelManagerConfig {
|
|
665
|
+
apiKey?: string;
|
|
666
|
+
baseUrl?: string;
|
|
667
|
+
fetch?: FetchImpl;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* `singularityapi-dev` — SingularityAPI's pay-as-you-go universal gateway
|
|
671
|
+
* (`api.singularityapi.dev`): chat completions over a 300+ model catalog,
|
|
672
|
+
* plus image generation for the rows that advertise it.
|
|
673
|
+
* `GET /v1/models` publishes each row's per-endpoint capabilities — context
|
|
674
|
+
* window, max output tokens, and per-million pricing as 12-decimal strings —
|
|
675
|
+
* with `cache-control: no-store`, so discovery reads limits and tariffs
|
|
676
|
+
* straight off the wire and the endpoint list picks each row's transport.
|
|
677
|
+
* Rows without a reasoning vocabulary stay non-reasoning; reviewed KDL rules
|
|
678
|
+
* own the ladders the gateway leaves implicit (DeepSeek Flash/Pro, GPT-5.6
|
|
679
|
+
* flagships), because a model discovered as non-reasoning never sends a
|
|
680
|
+
* `reasoning_effort` and the gateway requires one alongside tools.
|
|
681
|
+
*/
|
|
682
|
+
export declare function singularityApiDevModelManagerOptions(config?: SingularityApiModelManagerConfig): ModelManagerOptions<Api>;
|
|
683
|
+
/**
|
|
684
|
+
* `singularityapi-tech` — SingularityAPI's slot-reserved DeepSeek lanes
|
|
685
|
+
* (`api.singularityapi.tech`). `/v1/models` answers with bare `{id}` rows and
|
|
686
|
+
* no capability metadata, so rows keep the discovery defaults and the
|
|
687
|
+
* reviewed KDL rules own the wire shape, limits patch, and effort ladder.
|
|
688
|
+
*/
|
|
689
|
+
export declare function singularityApiTechModelManagerOptions(config?: SingularityApiModelManagerConfig): ModelManagerOptions<Api>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -5,13 +5,16 @@ export type { KnownProvider } from "./provider-models/descriptors.js";
|
|
|
5
5
|
export type KnownApi = "openai-completions" | "openai-responses" | "openrouter" | "openai-codex-responses" | "azure-openai-responses" | "anthropic-messages" | "bedrock-converse-stream" | "google-generative-ai" | "google-gemini-cli" | "google-vertex" | "ollama-chat" | "cursor-agent" | "gitlab-duo-agent" | "devin-agent";
|
|
6
6
|
export type Api = KnownApi | (string & {});
|
|
7
7
|
/** Catalog kinds used to isolate role-specific runners from session chat models. */
|
|
8
|
-
export declare const MODEL_KINDS: readonly ["chat", "tiny", "image", "tts", "stt", "search", "judge"];
|
|
8
|
+
export declare const MODEL_KINDS: readonly ["chat", "tiny", "image", "tts", "stt", "search", "judge", "embedding", "rerank", "video"];
|
|
9
9
|
/** Technical capability of a catalog model; absent model kinds mean chat. */
|
|
10
10
|
export type ModelKind = (typeof MODEL_KINDS)[number];
|
|
11
|
+
/** Kinds a provider maps to a runner transport through `kind-apis` in its KDL; discovery drops rows of these kinds when the provider declares no API. */
|
|
12
|
+
export declare const KIND_API_KINDS: readonly ["image", "tts", "stt", "embedding", "rerank", "video"];
|
|
13
|
+
export type KindApiKind = (typeof KIND_API_KINDS)[number];
|
|
11
14
|
/** Grounding transport available to chat models selected by the web role. */
|
|
12
15
|
export type WebSearchGrounding = "gemini" | "anthropic" | "codex" | "xai" | "openrouter";
|
|
13
16
|
/** Non-chat runner protocols accepted by catalog seeds, outside the chat dispatch union. */
|
|
14
|
-
export declare const RUNNER_APIS: readonly ["local-inference", "web-search", "typesafe", "openrouter-decisions", "openai-images", "openrouter-images", "xai-tts", "openai-speech"];
|
|
17
|
+
export declare const RUNNER_APIS: readonly ["local-inference", "web-search", "typesafe", "openrouter-decisions", "openai-images", "openrouter-images", "xai-tts", "openai-speech", "openai-embeddings", "openrouter-rerank", "openrouter-video", "openai-transcriptions"];
|
|
15
18
|
/** Resolve a model's kind while preserving chat semantics for existing catalog rows. */
|
|
16
19
|
export declare function modelKind(model: Pick<Model, "kind">): ModelKind;
|
|
17
20
|
/** Canonical thinking transport used by a model. */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SingularityAPI gateways, shared so a host migration — or a self-hosted
|
|
3
|
+
* proxy override — touches a single module.
|
|
4
|
+
*
|
|
5
|
+
* SingularityAPI ships two unrelated products behind one brand: the
|
|
6
|
+
* pay-as-you-go universal gateway (`singularityapi-dev`) and the
|
|
7
|
+
* slot-reserved DeepSeek lanes (`singularityapi-tech`). They accept disjoint
|
|
8
|
+
* keys, so each provider resolves its own canonical endpoint from here.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SINGULARITYAPI_DEV_API_BASE_URL = "https://api.singularityapi.dev/v1";
|
|
11
|
+
export declare const SINGULARITYAPI_TECH_API_BASE_URL = "https://api.singularityapi.tech/v1";
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a configured SingularityAPI base URL onto its gateway's `/v1`
|
|
14
|
+
* surface.
|
|
15
|
+
*
|
|
16
|
+
* Every consumer must agree on this, because they key different things off the
|
|
17
|
+
* result: discovery and inference target it, and the model-cache namespace is
|
|
18
|
+
* hashed from it. `ModelRegistry` hashes the raw configured value while the
|
|
19
|
+
* model-manager options hash a `/v1`-suffixed one, so a disagreement would
|
|
20
|
+
* split the namespace discovery writes from the one the registry reads and the
|
|
21
|
+
* authoritative roster would never come back.
|
|
22
|
+
*
|
|
23
|
+
* `canonical` names the product the caller belongs to: a blank or
|
|
24
|
+
* whitespace-only value means "not configured" and resolves to that canonical
|
|
25
|
+
* host, while anything else keeps its host and gains the `/v1` segment if it
|
|
26
|
+
* omits one. Passing the wrong product's canonical URL would silently point a
|
|
27
|
+
* provider at the other gateway, so there is no default.
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeSingularityApiBaseUrl(baseUrl: string | undefined, canonical: string): string;
|
package/package.json
CHANGED
|
@@ -1,51 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"type": "module",
|
|
3
2
|
"name": "@oh-my-pi/pi-catalog",
|
|
4
|
-
"version": "18.2.
|
|
3
|
+
"version": "18.2.9",
|
|
5
4
|
"description": "Model catalog for omp: bundled model database, provider discovery descriptors, model identity, classification, and equivalence",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"catalog",
|
|
8
|
+
"discovery",
|
|
9
|
+
"llm",
|
|
10
|
+
"models"
|
|
11
|
+
],
|
|
6
12
|
"homepage": "https://omp.sh",
|
|
7
|
-
"
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/can1357/oh-my-pi/issues"
|
|
15
|
+
},
|
|
8
16
|
"license": "MIT",
|
|
17
|
+
"author": "Stencil Labs, Inc.",
|
|
9
18
|
"repository": {
|
|
10
19
|
"type": "git",
|
|
11
20
|
"url": "git+https://github.com/can1357/oh-my-pi.git",
|
|
12
21
|
"directory": "packages/catalog"
|
|
13
22
|
},
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/can1357/oh-my-pi/issues"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"ai",
|
|
19
|
-
"llm",
|
|
20
|
-
"models",
|
|
21
|
-
"catalog",
|
|
22
|
-
"discovery"
|
|
23
|
-
],
|
|
24
|
-
"main": "./src/index.ts",
|
|
25
|
-
"types": "./dist/types/index.d.ts",
|
|
26
|
-
"scripts": {
|
|
27
|
-
"check": "oxlint . && oxfmt --check --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts' && bun run check:types",
|
|
28
|
-
"check:types": "tsgo -p tsconfig.json --noEmit",
|
|
29
|
-
"lint": "oxlint .",
|
|
30
|
-
"test": "bun test --parallel",
|
|
31
|
-
"fix": "oxlint --fix --fix-suggestions . && bun run fmt",
|
|
32
|
-
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'",
|
|
33
|
-
"gen:models": "bun scripts/generate-models.ts",
|
|
34
|
-
"gen:compat": "bun scripts/compile-compat.ts",
|
|
35
|
-
"gen:proto": "bun scripts/generate-protocols.ts"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@oh-my-pi/omptype": "18.2.7",
|
|
39
|
-
"@oh-my-pi/pi-utils": "18.2.7"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@bgotink/kdl": "0.4.0",
|
|
43
|
-
"@oh-my-pi/pi-ai": "18.2.7",
|
|
44
|
-
"@types/bun": "^1.3.14"
|
|
45
|
-
},
|
|
46
|
-
"engines": {
|
|
47
|
-
"bun": ">=1.3.14"
|
|
48
|
-
},
|
|
49
23
|
"files": [
|
|
50
24
|
"src",
|
|
51
25
|
"README.md",
|
|
@@ -54,6 +28,9 @@
|
|
|
54
28
|
"THIRD-PARTY-NOTICES.txt",
|
|
55
29
|
"dist/types"
|
|
56
30
|
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"main": "./src/index.ts",
|
|
33
|
+
"types": "./dist/types/index.d.ts",
|
|
57
34
|
"exports": {
|
|
58
35
|
".": {
|
|
59
36
|
"types": "./dist/types/index.d.ts",
|
|
@@ -100,5 +77,28 @@
|
|
|
100
77
|
"import": "./src/*.ts"
|
|
101
78
|
},
|
|
102
79
|
"./*.js": "./src/*.ts"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"check": "oxlint . && oxfmt --check --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts' && bun run check:types",
|
|
83
|
+
"check:types": "tsgo -p tsconfig.json --noEmit",
|
|
84
|
+
"lint": "oxlint .",
|
|
85
|
+
"test": "bun test --parallel",
|
|
86
|
+
"fix": "oxlint --fix --fix-suggestions . && bun run fmt",
|
|
87
|
+
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'",
|
|
88
|
+
"gen:models": "bun scripts/generate-models.ts",
|
|
89
|
+
"gen:compat": "bun scripts/compile-compat.ts",
|
|
90
|
+
"gen:proto": "bun scripts/generate-protocols.ts"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@oh-my-pi/omptype": "18.2.9",
|
|
94
|
+
"@oh-my-pi/pi-utils": "18.2.9"
|
|
95
|
+
},
|
|
96
|
+
"devDependencies": {
|
|
97
|
+
"@bgotink/kdl": "0.4.0",
|
|
98
|
+
"@oh-my-pi/pi-ai": "18.2.9",
|
|
99
|
+
"@types/bun": "^1.3.14"
|
|
100
|
+
},
|
|
101
|
+
"engines": {
|
|
102
|
+
"bun": ">=1.3.14"
|
|
103
103
|
}
|
|
104
104
|
}
|
package/src/compat/auth-ids.ts
CHANGED
|
@@ -67,6 +67,8 @@ export type AuthProviderId =
|
|
|
67
67
|
| "sakana"
|
|
68
68
|
| "siliconflow"
|
|
69
69
|
| "siliconflow-cn"
|
|
70
|
+
| "singularityapi-dev"
|
|
71
|
+
| "singularityapi-tech"
|
|
70
72
|
| "stencil"
|
|
71
73
|
| "synthetic"
|
|
72
74
|
| "tavily"
|
|
@@ -146,6 +148,8 @@ export type LoginProviderId =
|
|
|
146
148
|
| "sakana"
|
|
147
149
|
| "siliconflow"
|
|
148
150
|
| "siliconflow-cn"
|
|
151
|
+
| "singularityapi-dev"
|
|
152
|
+
| "singularityapi-tech"
|
|
149
153
|
| "stencil"
|
|
150
154
|
| "synthetic"
|
|
151
155
|
| "tavily"
|
package/src/compat/axes.ts
CHANGED
|
@@ -29,8 +29,8 @@ export interface AxisDef {
|
|
|
29
29
|
shape: AxisShape;
|
|
30
30
|
/** Wire axes only: records this key exists on. */
|
|
31
31
|
records?: readonly CompatRecordName[];
|
|
32
|
-
/** Closed value vocabulary for
|
|
33
|
-
values?: readonly string[];
|
|
32
|
+
/** Closed value vocabulary for scalars / arrays (strings, and booleans on flag axes). */
|
|
33
|
+
values?: readonly (string | boolean)[];
|
|
34
34
|
/**
|
|
35
35
|
* Object axes only: payload child names are literal wire JSON keys copied
|
|
36
36
|
* verbatim (`extra-body`). Default object payloads author kebab-case names
|
|
@@ -284,6 +284,25 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
284
284
|
shape: "scalar",
|
|
285
285
|
values: ["freeform", "function"],
|
|
286
286
|
},
|
|
287
|
+
"requires-native-tools": { key: "requiresNativeTools", set: "catalog", shape: "scalar", values: [true, false] },
|
|
288
|
+
"requires-tool-free-history-for-tool-opt-out": {
|
|
289
|
+
key: "requiresToolFreeHistoryForToolOptOut",
|
|
290
|
+
set: "catalog",
|
|
291
|
+
shape: "scalar",
|
|
292
|
+
values: [true, false],
|
|
293
|
+
},
|
|
294
|
+
"preserves-max-output-tokens": {
|
|
295
|
+
key: "preservesMaxOutputTokens",
|
|
296
|
+
set: "catalog",
|
|
297
|
+
shape: "scalar",
|
|
298
|
+
values: [true, false],
|
|
299
|
+
},
|
|
300
|
+
"omit-max-output-tokens": {
|
|
301
|
+
key: "omitMaxOutputTokens",
|
|
302
|
+
set: "catalog",
|
|
303
|
+
shape: "scalar",
|
|
304
|
+
values: [true, false],
|
|
305
|
+
},
|
|
287
306
|
"clamp-context-override": { key: "clampContextOverride", set: "catalog", shape: "scalar" },
|
|
288
307
|
"context-promotion-target": { key: "contextPromotionTarget", set: "catalog", shape: "scalar" },
|
|
289
308
|
"context-window-floor": { key: "contextWindowFloor", set: "catalog", shape: "scalar" },
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { toModelSpec } from "../provider-models/bundled-references";
|
|
2
|
+
import type { Model } from "../types";
|
|
3
|
+
import { resolveModelPolicy } from "./resolve";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Rule-owned catalog-axis policy by model. Resolve once per process rather
|
|
7
|
+
* than walking the static policy cascade on every accessor call. The key
|
|
8
|
+
* mirrors the cascade target inputs — `providerType ?? provider`, api, model
|
|
9
|
+
* id, and the reasoning flag; identity-derived class/family/revision facts are
|
|
10
|
+
* a pure function of provider + id. Bounded: one entry per distinct model.
|
|
11
|
+
*/
|
|
12
|
+
const catalogPolicyCache = new Map<string, Readonly<Record<string, unknown>>>();
|
|
13
|
+
const CATALOG_POLICY_CACHE_MAX = 8192;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The `catalog` axis bag authored in the KDL cascade rules for a model,
|
|
17
|
+
* memoized per distinct model. Frozen: the bag is shared across callers, so it
|
|
18
|
+
* must stay read-only — extract the value you need rather than handing it on.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveCatalogPolicy(model: Model): Readonly<Record<string, unknown>> {
|
|
21
|
+
const key = `${model.provider}\u0000${model.providerType ?? ""}\u0000${model.api}\u0000${model.id}\u0000${model.reasoning ? 1 : 0}`;
|
|
22
|
+
const cached = catalogPolicyCache.get(key);
|
|
23
|
+
if (cached !== undefined) return cached;
|
|
24
|
+
const policy = Object.freeze({ ...resolveModelPolicy(toModelSpec(model)).catalog });
|
|
25
|
+
if (catalogPolicyCache.size >= CATALOG_POLICY_CACHE_MAX) catalogPolicyCache.clear();
|
|
26
|
+
catalogPolicyCache.set(key, policy);
|
|
27
|
+
return policy;
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Model } from "../types";
|
|
2
|
+
import { resolveCatalogPolicy } from "./catalog-policy";
|
|
3
|
+
|
|
4
|
+
/** Whether discovery and transport policy allow preserving a caller's output cap. */
|
|
5
|
+
export function supportsOutputTokenLimit(model: Model): boolean {
|
|
6
|
+
const policy = resolveCatalogPolicy(model);
|
|
7
|
+
return (
|
|
8
|
+
model.omitMaxOutputTokens !== true &&
|
|
9
|
+
policy.omitMaxOutputTokens !== true &&
|
|
10
|
+
policy.preservesMaxOutputTokens !== false
|
|
11
|
+
);
|
|
12
|
+
}
|
package/src/compat/resolve.ts
CHANGED
|
@@ -562,7 +562,7 @@ function detectOpenAICompat(
|
|
|
562
562
|
dropThinkingWhenReasoningEffort: false,
|
|
563
563
|
nativeKimiK3Reasoning: false,
|
|
564
564
|
zaiReasoningEffortDialect: false,
|
|
565
|
-
clampOutputToModelMax:
|
|
565
|
+
clampOutputToModelMax: d.isLocalOpenAICompatBackend,
|
|
566
566
|
stripImageInput: false,
|
|
567
567
|
thinkingLoopGuard: undefined,
|
|
568
568
|
rejectRootObjectUnion: false,
|
|
@@ -765,7 +765,9 @@ function resolveOpenAIResponsesPolicy(
|
|
|
765
765
|
wireModelIdMode: isOpenRouter ? "openrouter" : "raw",
|
|
766
766
|
toolSchemaFlavor: facts.is("kimi") ? "moonshot-mfjs" : undefined,
|
|
767
767
|
alwaysSendMaxTokens: facts.is("kimi"),
|
|
768
|
-
clampOutputToModelMax:
|
|
768
|
+
clampOutputToModelMax:
|
|
769
|
+
PROXY_OPENAI_COMPAT_PROVIDERS[backendProvider] !== true &&
|
|
770
|
+
(LOCAL_OPENAI_COMPAT_PROVIDERS[backendProvider] === true || hasLocalLoopbackBaseUrl(baseUrl)),
|
|
769
771
|
supportsObfuscationOptOut: isOpenAIUrl || provider === "openai",
|
|
770
772
|
officialEndpoint: isOfficialOpenAIEndpoint(provider, baseUrl),
|
|
771
773
|
harmonyLeakMitigation: false,
|