@linxiraos/pi-catalog 1.4.7 → 1.4.10
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 +6 -21
- package/dist/types/compat/auth-ids.d.ts +2 -2
- package/dist/types/compat/catalog-policy.d.ts +6 -4
- package/dist/types/compat/factory-droid.d.ts +7 -1
- package/dist/types/compat/provider-ids.d.ts +1 -1
- package/dist/types/compat/resolve.d.ts +1 -1
- package/dist/types/compat/revision.d.ts +2 -0
- package/dist/types/compat/server-side-fallback.d.ts +6 -4
- package/dist/types/compat/types.d.ts +3 -1
- package/dist/types/discovery/cursor-proto.d.ts +8 -0
- package/dist/types/discovery/openai-compatible.d.ts +6 -0
- package/dist/types/model-manager.d.ts +11 -1
- package/dist/types/model-thinking.d.ts +4 -0
- package/dist/types/models.d.ts +16 -0
- package/dist/types/pricing.d.ts +66 -6
- package/dist/types/provider-models/openai-compat.d.ts +18 -13
- package/dist/types/types.d.ts +14 -19
- package/dist/types/utils.d.ts +8 -0
- package/package.json +4 -4
- package/src/compat/auth-ids.ts +5 -0
- package/src/compat/axes.ts +21 -9
- package/src/compat/catalog-policy.d.ts +9 -0
- package/src/compat/catalog-policy.ts +14 -10
- package/src/compat/collapse.ts +1 -1
- package/src/compat/factory-droid.d.ts +7 -1
- package/src/compat/factory-droid.ts +9 -1
- package/src/compat/provider-ids.d.ts +1 -1
- package/src/compat/provider-ids.ts +2 -0
- package/src/compat/resolve.d.ts +1 -1
- package/src/compat/resolve.ts +4 -5
- package/src/compat/revision.d.ts +2 -0
- package/src/compat/revision.ts +10 -0
- package/src/compat/rules/README.md +3 -1
- package/src/compat/rules/auth/_order.kdl +1 -1
- package/src/compat/rules/auth/mistral.kdl +4 -0
- package/src/compat/rules/auth/modular.kdl +9 -0
- package/src/compat/rules/auth/scaleway.kdl +17 -0
- package/src/compat/rules/classes/anthropic.kdl +5 -0
- package/src/compat/rules/classes/deepseek.kdl +1 -1
- package/src/compat/rules/classes/gemini.kdl +1 -1
- package/src/compat/rules/classes/xai.kdl +1 -1
- package/src/compat/rules/providers/anthropic.kdl +8 -4
- package/src/compat/rules/providers/cursor.kdl +10 -0
- package/src/compat/rules/providers/deepseek.kdl +2 -2
- package/src/compat/rules/providers/factory-droid.kdl +219 -13
- package/src/compat/rules/providers/modular.kdl +35 -0
- package/src/compat/rules/providers/openai-codex.kdl +1 -1
- package/src/compat/rules/providers/sambanova.kdl +2 -0
- package/src/compat/rules/providers/scaleway.kdl +179 -0
- package/src/compat/rules/runtime/behavior.kdl +13 -0
- package/src/compat/rules.json +1 -1
- package/src/compat/server-side-fallback.d.ts +9 -0
- package/src/compat/server-side-fallback.ts +7 -5
- package/src/compat/types.d.ts +3 -1
- package/src/compat/types.ts +3 -1
- package/src/discovery/codex.ts +2 -9
- package/src/discovery/cursor-proto.d.ts +8 -0
- package/src/discovery/cursor-proto.ts +12 -1
- package/src/discovery/factory-droid.ts +35 -11
- package/src/discovery/openai-compatible.d.ts +6 -0
- package/src/discovery/openai-compatible.ts +1 -1
- package/src/model-cache.ts +32 -58
- package/src/model-catalog-format.ts +5 -8
- package/src/model-manager.d.ts +11 -1
- package/src/model-manager.ts +85 -143
- package/src/model-thinking.d.ts +4 -0
- package/src/model-thinking.ts +10 -0
- package/src/model-tokenizer.ts +13 -12
- package/src/models.d.ts +16 -0
- package/src/models.json +1 -1
- package/src/models.ts +32 -1
- package/src/pricing.d.ts +66 -6
- package/src/pricing.ts +59 -94
- package/src/provider-models/catalog-snapshot.json.zst +0 -0
- package/src/provider-models/catalog-snapshot.json.zst.d.ts +3 -0
- package/src/provider-models/descriptors.ts +2 -0
- package/src/provider-models/openai-compat.d.ts +18 -13
- package/src/provider-models/openai-compat.ts +120 -71
- package/src/types.d.ts +14 -19
- package/src/types.ts +11 -18
- package/src/utils.d.ts +8 -0
- package/src/utils.ts +18 -0
- package/src/wire/factory-droid.ts +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { USER_AGENT, getInstallId } from "@linxiraos/pi-utils";
|
|
2
2
|
import * as logger from "@linxiraos/pi-utils/logger";
|
|
3
3
|
import { toClinePassPublicModelId } from "../cline-pass-model-id";
|
|
4
4
|
import {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { resolveAnthropicApiVersion } from "../compat/anthropic";
|
|
14
14
|
import { xaiResponsesReasoningEffortMap } from "../compat/openai";
|
|
15
15
|
import { hasModelScopedEffortLadder, resolveModelPolicy } from "../compat/resolve";
|
|
16
|
-
import { compareRevision, parseRevision } from "../compat/revision";
|
|
16
|
+
import { compareRevision, parseRevision, revisionAtLeast } from "../compat/revision";
|
|
17
17
|
import { providerEntries, seedModels } from "../compat/providers";
|
|
18
18
|
import { billingVariantPlain, classifyModel, discoveryVocabulary } from "../compat/taxonomy";
|
|
19
19
|
import {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
fetchOpenAICompatibleModels,
|
|
22
22
|
type OpenAICompatibleModelMapperContext,
|
|
23
23
|
type OpenAICompatibleModelRecord,
|
|
24
|
+
withOpenAICompatibleDiscoveryTimeout,
|
|
24
25
|
} from "../discovery/openai-compatible";
|
|
25
26
|
import { Effort, THINKING_EFFORTS } from "../effort";
|
|
26
27
|
import { FIREWORKS_FAST_SUFFIX, toFireworksPublicModelId } from "../fireworks-model-id";
|
|
@@ -43,15 +44,7 @@ import {
|
|
|
43
44
|
type TokenCost,
|
|
44
45
|
runnerApiKind,
|
|
45
46
|
} from "../types";
|
|
46
|
-
import {
|
|
47
|
-
discoveryFetch,
|
|
48
|
-
isAnthropicOAuthToken,
|
|
49
|
-
isRecord,
|
|
50
|
-
toBoolean,
|
|
51
|
-
toNumber,
|
|
52
|
-
toPositiveNumber,
|
|
53
|
-
toPositiveNumberOrNull,
|
|
54
|
-
} from "../utils";
|
|
47
|
+
import { discoveryFetch, isAnthropicOAuthToken, isRecord, toBoolean, toNumber, toPositiveNumber } from "../utils";
|
|
55
48
|
import { ALIBABA_TOKEN_PLAN_BASE_URL, parseAlibabaTokenPlanCredential } from "../wire/alibaba-token-plan";
|
|
56
49
|
import { normalizeCharmHyperBaseUrl } from "../wire/charm-hyper";
|
|
57
50
|
import { CLINEPASS_API_BASE_URL, clinePassClientHeaders } from "../wire/cline-pass";
|
|
@@ -73,20 +66,12 @@ import {
|
|
|
73
66
|
} from "../wire/singularityapi";
|
|
74
67
|
import { isXiaomiTokenPlanKey } from "../wire/xiaomi-token-plan";
|
|
75
68
|
import { createBundledReferenceMap, createReferenceResolver, toModelSpec } from "./bundled-references";
|
|
69
|
+
import catalogSnapshotPath from "./catalog-snapshot.json.zst" with { type: "file" };
|
|
76
70
|
import { getDefaultModelDiscoveryBaseUrl, resolveModelCacheProviderId } from "./cache-provider-id";
|
|
77
71
|
import { getClinePassModelMetadata } from "./cline-pass";
|
|
78
72
|
import type { ModelManagerConfig } from "./descriptor-types";
|
|
79
73
|
import { filterModelsDevCatalogRows } from "./models-dev-policies";
|
|
80
74
|
|
|
81
|
-
function revisionAtLeast(revision: string | undefined, floor: string): boolean {
|
|
82
|
-
if (revision === undefined) return false;
|
|
83
|
-
const parsedRevision = parseRevision(revision);
|
|
84
|
-
const parsedFloor = parseRevision(floor);
|
|
85
|
-
return (
|
|
86
|
-
parsedRevision !== undefined && parsedFloor !== undefined && compareRevision(parsedRevision, parsedFloor) >= 0
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
75
|
function isGlmReasoningIdentity(provider: string, modelId: string, floor: string): boolean {
|
|
91
76
|
const identity = classifyModel(provider, modelId, { lenient: true });
|
|
92
77
|
if (identity.class !== "glm" || !revisionAtLeast(identity.revision, floor)) return false;
|
|
@@ -99,24 +84,6 @@ const MODELS_DEV_URL = "https://catalog.stencil.so/models.json.zstd";
|
|
|
99
84
|
/** Little-endian magic number opening every zstd frame (RFC 8878). */
|
|
100
85
|
const ZSTD_MAGIC = 0xfd2fb528;
|
|
101
86
|
|
|
102
|
-
/**
|
|
103
|
-
* Uses a cancellable timer rather than the native abort-timeout helper so
|
|
104
|
-
* successful fast discovery requests do not leave armed timeout signals for
|
|
105
|
-
* concurrent GC to trip over later.
|
|
106
|
-
*/
|
|
107
|
-
async function withCatalogDiscoveryTimeout<T>(timeoutMs: number, run: (signal: AbortSignal) => Promise<T>): Promise<T> {
|
|
108
|
-
const controller = new AbortController();
|
|
109
|
-
const timer = setTimeout(
|
|
110
|
-
() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")),
|
|
111
|
-
timeoutMs,
|
|
112
|
-
);
|
|
113
|
-
try {
|
|
114
|
-
return await run(controller.signal);
|
|
115
|
-
} finally {
|
|
116
|
-
clearTimeout(timer);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
87
|
const ANTHROPIC_BASE_URL = "https://api.anthropic.com/v1";
|
|
121
88
|
const ANTHROPIC_OAUTH_BETA =
|
|
122
89
|
"claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,redact-thinking-2026-02-12,context-management-2025-06-27,prompt-caching-scope-2026-01-05,mid-conversation-system-2026-04-07,advanced-tool-use-2025-11-20,effort-2025-11-24,extended-cache-ttl-2025-04-11";
|
|
@@ -215,7 +182,37 @@ const CATALOG_USER_AGENT = USER_AGENT;
|
|
|
215
182
|
* Transient failures reuse the last in-memory payload for callers that only
|
|
216
183
|
* need best-effort metadata.
|
|
217
184
|
*/
|
|
185
|
+
async function parseCatalogBytes(bytes: Uint8Array): Promise<unknown> {
|
|
186
|
+
const isZstd = bytes.length >= 4 && new DataView(bytes.buffer, bytes.byteOffset).getUint32(0, true) === ZSTD_MAGIC;
|
|
187
|
+
const text = new TextDecoder().decode(isZstd ? await Bun.zstdDecompress(bytes) : bytes);
|
|
188
|
+
return JSON.parse(text);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The committed snapshot, decompressed once per process.
|
|
193
|
+
*
|
|
194
|
+
* `gen:models` writes the exact payload shape this function returns, so the
|
|
195
|
+
* offline source and the live source are interchangeable downstream. A
|
|
196
|
+
* snapshot that fails to parse is reported, not cached, so the next caller
|
|
197
|
+
* retries instead of inheriting a poisoned cache.
|
|
198
|
+
*/
|
|
199
|
+
let catalogSnapshot: unknown;
|
|
200
|
+
let catalogSnapshotInflight: Promise<unknown> | undefined;
|
|
201
|
+
|
|
202
|
+
function readCatalogSnapshot(): Promise<unknown> {
|
|
203
|
+
if (catalogSnapshot !== undefined) return Promise.resolve(catalogSnapshot);
|
|
204
|
+
catalogSnapshotInflight ??= (async () => {
|
|
205
|
+
const bytes = new Uint8Array(await Bun.file(catalogSnapshotPath).arrayBuffer());
|
|
206
|
+
catalogSnapshot = await parseCatalogBytes(bytes);
|
|
207
|
+
return catalogSnapshot;
|
|
208
|
+
})().finally(() => {
|
|
209
|
+
catalogSnapshotInflight = undefined;
|
|
210
|
+
});
|
|
211
|
+
return catalogSnapshotInflight;
|
|
212
|
+
}
|
|
213
|
+
|
|
218
214
|
export function fetchWellKnownModels(fetchImpl?: FetchImpl, signal?: AbortSignal): Promise<unknown> {
|
|
215
|
+
if (!fetchImpl) return waitForCatalogRequest(readCatalogSnapshot(), signal);
|
|
219
216
|
const session = getCatalogSession(fetchImpl);
|
|
220
217
|
return fetchRevalidatedWellKnownModels(fetchImpl, signal).catch(error => {
|
|
221
218
|
if (session.hasPayload) return session.payload;
|
|
@@ -226,8 +223,9 @@ export function fetchWellKnownModels(fetchImpl?: FetchImpl, signal?: AbortSignal
|
|
|
226
223
|
function fetchRevalidatedWellKnownModels(fetchImpl?: FetchImpl, signal?: AbortSignal): Promise<unknown> {
|
|
227
224
|
const session = getCatalogSession(fetchImpl);
|
|
228
225
|
if (!session.inflight) {
|
|
229
|
-
session.inflight =
|
|
230
|
-
|
|
226
|
+
session.inflight = withOpenAICompatibleDiscoveryTimeout(
|
|
227
|
+
DEFAULT_OPENAI_COMPATIBLE_DISCOVERY_TIMEOUT_MS,
|
|
228
|
+
transportSignal => fetchCatalogPayload(fetchImpl ?? discoveryFetch(), session, transportSignal),
|
|
231
229
|
).finally(() => {
|
|
232
230
|
session.inflight = null;
|
|
233
231
|
});
|
|
@@ -239,7 +237,9 @@ function fetchRevalidatedWellKnownModelsWithTimeout(
|
|
|
239
237
|
fetchImpl?: FetchImpl,
|
|
240
238
|
timeoutMs = DEFAULT_OPENAI_COMPATIBLE_DISCOVERY_TIMEOUT_MS,
|
|
241
239
|
): Promise<unknown> {
|
|
242
|
-
|
|
240
|
+
// Same source rule as {@link fetchWellKnownModels}: no transport, no network.
|
|
241
|
+
if (!fetchImpl) return readCatalogSnapshot();
|
|
242
|
+
return withOpenAICompatibleDiscoveryTimeout(timeoutMs, signal => fetchRevalidatedWellKnownModels(fetchImpl, signal));
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
async function fetchCatalogPayload(
|
|
@@ -545,6 +545,8 @@ function mapWithBundledReference<TApi extends Api>(
|
|
|
545
545
|
return {
|
|
546
546
|
...defaults,
|
|
547
547
|
name,
|
|
548
|
+
contextWindow: toPositiveNumber(entry.context_length, defaults.contextWindow),
|
|
549
|
+
maxTokens: toPositiveNumber(entry.max_completion_tokens, defaults.maxTokens),
|
|
548
550
|
};
|
|
549
551
|
}
|
|
550
552
|
// Generic `/models` rows describe the chat roster. Do not make a bundled
|
|
@@ -672,7 +674,7 @@ async function fetchOllamaNativeModels(
|
|
|
672
674
|
* Ollama's cloud catalog reports for stock models.
|
|
673
675
|
*/
|
|
674
676
|
const OLLAMA_FALLBACK_CONTEXT_WINDOW = 128_000;
|
|
675
|
-
/** Cap max output tokens at a value that matches
|
|
677
|
+
/** Cap max output tokens at a value that matches OMP's other openai-responses defaults. */
|
|
676
678
|
const OLLAMA_DEFAULT_MAX_TOKENS = 8192;
|
|
677
679
|
|
|
678
680
|
interface OllamaResolvedMetadata {
|
|
@@ -1594,13 +1596,12 @@ export function novitaModelManagerOptions(
|
|
|
1594
1596
|
export const DEEPINFRA_BASE_URL = "https://api.deepinfra.com/v1/openai";
|
|
1595
1597
|
/**
|
|
1596
1598
|
* `filter=with_meta` attaches per-model `metadata` (limits, pricing, tags);
|
|
1597
|
-
* `sort_by=
|
|
1598
|
-
* (upstream-negotiated API key; never rebrand this outbound value)
|
|
1599
|
+
* `sort_by=zeta` asks DeepInfra to return models in zeta-priority order
|
|
1599
1600
|
* (earlier = better). The mapper does not stamp `priority` yet — see
|
|
1600
1601
|
* `mapDeepinfraModel` — but the params are sent so discovery picks the
|
|
1601
1602
|
* ordering up as soon as the server honors it.
|
|
1602
1603
|
*/
|
|
1603
|
-
const DEEPINFRA_MODELS_QUERY = "?filter=with_meta&sort_by=
|
|
1604
|
+
const DEEPINFRA_MODELS_QUERY = "?filter=with_meta&sort_by=zeta";
|
|
1604
1605
|
const DEEPINFRA_EFFORTS = [Effort.Low, Effort.Medium, Effort.High] as const;
|
|
1605
1606
|
|
|
1606
1607
|
/** DeepInfra OpenAI-compatible discovery configuration. */
|
|
@@ -1710,7 +1711,7 @@ function mapDeepinfraModel(
|
|
|
1710
1711
|
* Bespoke fetch instead of `fetchOpenAICompatibleModels`: the shared helper
|
|
1711
1712
|
* cannot carry the `filter`/`sort_by` query params and re-sorts results by id,
|
|
1712
1713
|
* which would destroy DeepInfra's priority ordering once the server honors
|
|
1713
|
-
* `sort_by=
|
|
1714
|
+
* `sort_by=zeta`. Response order is preserved (dedupe keeps the first, i.e.
|
|
1714
1715
|
* highest-priority, occurrence).
|
|
1715
1716
|
*/
|
|
1716
1717
|
async function fetchDeepinfraModels(options: {
|
|
@@ -1726,8 +1727,9 @@ async function fetchDeepinfraModels(options: {
|
|
|
1726
1727
|
const fetchImpl = discoveryFetch(options.fetch);
|
|
1727
1728
|
let payload: unknown;
|
|
1728
1729
|
try {
|
|
1729
|
-
const response = await
|
|
1730
|
-
|
|
1730
|
+
const response = await withOpenAICompatibleDiscoveryTimeout(
|
|
1731
|
+
DEFAULT_OPENAI_COMPATIBLE_DISCOVERY_TIMEOUT_MS,
|
|
1732
|
+
signal => fetchImpl(`${options.baseUrl}/models${DEEPINFRA_MODELS_QUERY}`, { method: "GET", headers, signal }),
|
|
1731
1733
|
);
|
|
1732
1734
|
if (!response.ok) {
|
|
1733
1735
|
return null;
|
|
@@ -2285,7 +2287,7 @@ async function loadSiliconFlowModelsDevReferences(
|
|
|
2285
2287
|
try {
|
|
2286
2288
|
// Bounded: this enrichment is optional, so a stalled models.dev must not
|
|
2287
2289
|
// hold back the authoritative endpoint request that runs after it.
|
|
2288
|
-
const payload = await
|
|
2290
|
+
const payload = await withOpenAICompatibleDiscoveryTimeout(SILICONFLOW_MODELS_DEV_REFERENCE_TIMEOUT_MS, signal =>
|
|
2289
2291
|
fetchWellKnownModels(fetchImpl, signal),
|
|
2290
2292
|
);
|
|
2291
2293
|
return createModelsDevReferenceMap<"openai-completions">(
|
|
@@ -2829,7 +2831,7 @@ const CLINE_PASS_LIVE_CATALOG_URL = "https://openrouter.ai/api/v1/models";
|
|
|
2829
2831
|
/** Enrichment tier, never authoritative: any failure degrades to the bundled path. */
|
|
2830
2832
|
async function fetchClinePassLiveCatalog(fetchImpl: FetchImpl): Promise<ClinePassLiveCatalog | undefined> {
|
|
2831
2833
|
try {
|
|
2832
|
-
const response = await
|
|
2834
|
+
const response = await withOpenAICompatibleDiscoveryTimeout(5_000, signal =>
|
|
2833
2835
|
fetchImpl(CLINE_PASS_LIVE_CATALOG_URL, { signal }),
|
|
2834
2836
|
);
|
|
2835
2837
|
if (!response.ok) return undefined;
|
|
@@ -3008,7 +3010,7 @@ async function fetchClinePassModels(
|
|
|
3008
3010
|
// The roster is authoritative for ids; the live reference catalog is a pure
|
|
3009
3011
|
// enrichment tier fetched alongside and tolerated away (offline → bundle).
|
|
3010
3012
|
const [response, liveCatalog] = await Promise.all([
|
|
3011
|
-
|
|
3013
|
+
withOpenAICompatibleDiscoveryTimeout(5_000, signal =>
|
|
3012
3014
|
fetchImpl(CLINEPASS_MODELS_URL, { signal, headers: clinePassClientHeaders() }),
|
|
3013
3015
|
),
|
|
3014
3016
|
fetchClinePassLiveCatalog(fetchImpl),
|
|
@@ -4423,7 +4425,7 @@ export async function fetchLmStudioNativeModelMetadata(
|
|
|
4423
4425
|
if (options?.signal !== undefined) {
|
|
4424
4426
|
return fetchMetadata(options.signal);
|
|
4425
4427
|
}
|
|
4426
|
-
return
|
|
4428
|
+
return withOpenAICompatibleDiscoveryTimeout(LM_STUDIO_NATIVE_METADATA_TIMEOUT_MS, fetchMetadata);
|
|
4427
4429
|
}
|
|
4428
4430
|
|
|
4429
4431
|
export interface LmStudioModelManagerConfig {
|
|
@@ -4516,7 +4518,7 @@ function toSyntheticStringList(value: unknown): readonly string[] {
|
|
|
4516
4518
|
|
|
4517
4519
|
/**
|
|
4518
4520
|
* Translate Synthetic's per-model `reasoning_effort` vocabulary into an effort
|
|
4519
|
-
* ladder. Every advertised value that names an
|
|
4521
|
+
* ladder. Every advertised value that names an OMP tier maps verbatim; `none`
|
|
4520
4522
|
* is the thinking-off state rather than a tier of its own, so it backs the
|
|
4521
4523
|
* `minimal` selector through the wire map (same shape as the Fireworks
|
|
4522
4524
|
* `minimal → none` map) and gives these routes a real no-thinking tier.
|
|
@@ -4715,9 +4717,9 @@ export interface BasetenModelManagerConfig {
|
|
|
4715
4717
|
fetch?: FetchImpl;
|
|
4716
4718
|
}
|
|
4717
4719
|
|
|
4718
|
-
// A previous version of
|
|
4720
|
+
// A previous version of OMP shipped these models without reasoning levels.
|
|
4719
4721
|
// We've since fixed that (V4-generation whitelist). This const lets us bust
|
|
4720
|
-
// the cache so that users on that version of
|
|
4722
|
+
// the cache so that users on that version of OMP pick up the reasoning levels
|
|
4721
4723
|
// immediately.
|
|
4722
4724
|
const BASETEN_CACHE_MIGRATION_MODEL_IDS = [
|
|
4723
4725
|
"zai-org/GLM-5.3",
|
|
@@ -4747,10 +4749,10 @@ export function basetenModelManagerOptions(
|
|
|
4747
4749
|
const features = Array.isArray(raw.supported_features) ? raw.supported_features : [];
|
|
4748
4750
|
const modalities = Array.isArray(raw.input_modalities) ? raw.input_modalities : [];
|
|
4749
4751
|
|
|
4750
|
-
// Baseten's discovery flags are not enough to enable
|
|
4752
|
+
// Baseten's discovery flags are not enough to enable OMP reasoning for every
|
|
4751
4753
|
// model. Only models with a verified Baseten reasoning policy are enabled
|
|
4752
4754
|
// here; an unknown model may use a different reasoning wire shape or effort
|
|
4753
|
-
// vocabulary, which
|
|
4755
|
+
// vocabulary, which OMP must not guess.
|
|
4754
4756
|
const identity = classifyModel("baseten", defaults.id, { lenient: true });
|
|
4755
4757
|
const isSupportedBasetenReasoningModel =
|
|
4756
4758
|
(identity.class === "kimi" && identity.family === "k3") ||
|
|
@@ -4771,8 +4773,6 @@ export function basetenModelManagerOptions(
|
|
|
4771
4773
|
cacheWrite: 0,
|
|
4772
4774
|
};
|
|
4773
4775
|
|
|
4774
|
-
const contextWindow = toPositiveNumber(raw.context_length, reference?.contextWindow ?? defaults.contextWindow);
|
|
4775
|
-
const maxTokens = toPositiveNumber(raw.max_completion_tokens, reference?.maxTokens ?? defaults.maxTokens);
|
|
4776
4776
|
const baseModel = mapWithBundledReference(entry, defaults, reference);
|
|
4777
4777
|
|
|
4778
4778
|
return {
|
|
@@ -4780,8 +4780,6 @@ export function basetenModelManagerOptions(
|
|
|
4780
4780
|
reasoning,
|
|
4781
4781
|
input: vision ? ["text", "image"] : ["text"],
|
|
4782
4782
|
cost,
|
|
4783
|
-
contextWindow,
|
|
4784
|
-
maxTokens,
|
|
4785
4783
|
...(supportsTools === false ? { supportsTools } : {}),
|
|
4786
4784
|
};
|
|
4787
4785
|
},
|
|
@@ -5446,7 +5444,7 @@ interface StepfunModelRecord extends OpenAICompatibleModelRecord {
|
|
|
5446
5444
|
|
|
5447
5445
|
/**
|
|
5448
5446
|
* Translate StepFun's per-model `reasoning_effort_support_list` into a ladder.
|
|
5449
|
-
* Every advertised value that names an
|
|
5447
|
+
* Every advertised value that names an OMP tier maps verbatim, in OMP's tier
|
|
5450
5448
|
* order; a row advertising nothing (or only tiers this client does not know)
|
|
5451
5449
|
* resolves to no thinking, so the wire path never sends a `reasoning_effort`
|
|
5452
5450
|
* the endpoint rejects. Same shape as `mapOpenRouterThinking` for OpenRouter's
|
|
@@ -6394,7 +6392,9 @@ async function fetchLiteLLMRichModelsInternal<TApi extends Api>(
|
|
|
6394
6392
|
if (options.signal !== undefined) {
|
|
6395
6393
|
return fetchModels(options.signal);
|
|
6396
6394
|
}
|
|
6397
|
-
return options.timeoutMs !== undefined
|
|
6395
|
+
return options.timeoutMs !== undefined
|
|
6396
|
+
? withOpenAICompatibleDiscoveryTimeout(options.timeoutMs, fetchModels)
|
|
6397
|
+
: fetchModels();
|
|
6398
6398
|
}
|
|
6399
6399
|
|
|
6400
6400
|
export async function fetchLiteLLMRichModels<TApi extends Api>(
|
|
@@ -6545,13 +6545,7 @@ export function nanoGptModelManagerOptions(
|
|
|
6545
6545
|
const maxOutputTokens = entry.max_output_tokens ?? entry.max_completion_tokens;
|
|
6546
6546
|
const mapped = mapWithBundledReference(
|
|
6547
6547
|
{ ...entry, max_completion_tokens: maxOutputTokens },
|
|
6548
|
-
|
|
6549
|
-
? defaults
|
|
6550
|
-
: {
|
|
6551
|
-
...defaults,
|
|
6552
|
-
contextWindow: toPositiveNumberOrNull(entry.context_length),
|
|
6553
|
-
maxTokens: toPositiveNumberOrNull(maxOutputTokens),
|
|
6554
|
-
},
|
|
6548
|
+
defaults,
|
|
6555
6549
|
reference,
|
|
6556
6550
|
);
|
|
6557
6551
|
return {
|
|
@@ -6784,7 +6778,7 @@ export function githubCopilotModelManagerOptions(config?: GithubCopilotModelMana
|
|
|
6784
6778
|
fetchDynamicModels: async () => {
|
|
6785
6779
|
const fetchImpl = discoveryFetch(config?.fetch);
|
|
6786
6780
|
const requestBaseUrl = isPersonalGitHubCopilotBaseUrl(baseUrl)
|
|
6787
|
-
? ((await
|
|
6781
|
+
? ((await withOpenAICompatibleDiscoveryTimeout(DEFAULT_OPENAI_COMPATIBLE_DISCOVERY_TIMEOUT_MS, signal =>
|
|
6788
6782
|
discoverGitHubCopilotApiEndpoint(apiKey, fetchImpl, signal),
|
|
6789
6783
|
)) ?? baseUrl)
|
|
6790
6784
|
: baseUrl;
|
|
@@ -6926,6 +6920,22 @@ export function githubCopilotModelManagerOptions(config?: GithubCopilotModelMana
|
|
|
6926
6920
|
}
|
|
6927
6921
|
: {}),
|
|
6928
6922
|
};
|
|
6923
|
+
// Cross-provider fallback references (e.g. a Cursor
|
|
6924
|
+
// collapsed family for an enterprise-only sibling id)
|
|
6925
|
+
// carry provider-specific wire routing that must not
|
|
6926
|
+
// transfer: the off-tier `requestModelId` pin would send
|
|
6927
|
+
// every Copilot request under the `-none` sibling id
|
|
6928
|
+
// regardless of thinking level.
|
|
6929
|
+
if (reference && reference.provider !== "github-copilot") {
|
|
6930
|
+
delete base.requestModelId;
|
|
6931
|
+
if (base.thinking) {
|
|
6932
|
+
// `base` is a shallow copy of the shared global
|
|
6933
|
+
// reference: clone before deleting or the bundled
|
|
6934
|
+
// entry loses its routing process-wide.
|
|
6935
|
+
base.thinking = { ...base.thinking };
|
|
6936
|
+
delete base.thinking.effortRouting;
|
|
6937
|
+
}
|
|
6938
|
+
}
|
|
6929
6939
|
const defaultCost = copilotTierCost(tokenPrices.defaultTier);
|
|
6930
6940
|
if (defaultCost) {
|
|
6931
6941
|
// Cache writes are not reported per tier; retain the bundled provider rate.
|
|
@@ -7779,6 +7789,8 @@ const MODELS_DEV_PROVIDER_DESCRIPTORS_SPECIALIZED: readonly ModelsDevProviderDes
|
|
|
7779
7789
|
return { api: "openai-completions" as const, baseUrl: ZENMUX_OPENAI_BASE_URL };
|
|
7780
7790
|
},
|
|
7781
7791
|
}),
|
|
7792
|
+
// --- Modular ---
|
|
7793
|
+
openAiCompletionsDescriptor("modular", "modular", "https://api.modular.com/v1"),
|
|
7782
7794
|
];
|
|
7783
7795
|
/** All provider descriptors for models.dev data mapping in generate-models.ts. */
|
|
7784
7796
|
export const MODELS_DEV_PROVIDER_DESCRIPTORS: readonly ModelsDevProviderDescriptor[] = [
|
|
@@ -8223,3 +8235,40 @@ export function singularityApiTechModelManagerOptions(
|
|
|
8223
8235
|
): ModelManagerOptions<Api> {
|
|
8224
8236
|
return singularityApiModelManagerOptions("singularityapi-tech", SINGULARITYAPI_TECH_API_BASE_URL, config);
|
|
8225
8237
|
}
|
|
8238
|
+
|
|
8239
|
+
// ---------------------------------------------------------------------------
|
|
8240
|
+
// Scaleway
|
|
8241
|
+
// ---------------------------------------------------------------------------
|
|
8242
|
+
|
|
8243
|
+
/**
|
|
8244
|
+
* Scaleway discovery configuration: the API key plus optional base-URL and
|
|
8245
|
+
* fetch overrides. Consumed by {@link scalewayModelManagerOptions}, and
|
|
8246
|
+
* exported for extensions and tests that construct the manager directly.
|
|
8247
|
+
*/
|
|
8248
|
+
export interface ScalewayModelManagerConfig {
|
|
8249
|
+
apiKey?: string;
|
|
8250
|
+
baseUrl?: string;
|
|
8251
|
+
fetch?: FetchImpl;
|
|
8252
|
+
}
|
|
8253
|
+
|
|
8254
|
+
/**
|
|
8255
|
+
* Scaleway model manager: plain OpenAI-compatible chat completions at
|
|
8256
|
+
* `api.scaleway.ai/v1` (fr-par serverless Generative APIs). `/v1/models`
|
|
8257
|
+
* returns bare ids, so the authored seed in `providers/scaleway.kdl` is the
|
|
8258
|
+
* reference each live row merges names, modalities, prices, and limits from;
|
|
8259
|
+
* a successful fetch is the complete roster and prunes retired rows.
|
|
8260
|
+
*/
|
|
8261
|
+
export function scalewayModelManagerOptions(
|
|
8262
|
+
config?: ScalewayModelManagerConfig,
|
|
8263
|
+
): ModelManagerOptions<"openai-completions"> {
|
|
8264
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
8265
|
+
api: "openai-completions",
|
|
8266
|
+
providerId: "scaleway",
|
|
8267
|
+
defaultBaseUrl: "https://api.scaleway.ai/v1",
|
|
8268
|
+
config,
|
|
8269
|
+
dynamicModelsAuthoritative: true,
|
|
8270
|
+
requireApiKey: true,
|
|
8271
|
+
filterModel: (_entry, model) => !isExcludedModel("scaleway", model.id),
|
|
8272
|
+
mapModel: mapWithBundledReference,
|
|
8273
|
+
});
|
|
8274
|
+
}
|
package/src/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ModelIdentity } from "./compat/types";
|
|
2
2
|
import type { Effort } from "./effort";
|
|
3
|
+
import type { DatedCostCard } from "./pricing";
|
|
3
4
|
export type { FetchImpl } from "@linxiraos/pi-utils";
|
|
4
5
|
export type { KnownProvider } from "./provider-models/descriptors";
|
|
5
6
|
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" | "factory-droid-agent" | "gitlab-duo-agent" | "devin-agent" | "apple-foundation-models";
|
|
@@ -477,8 +478,6 @@ export interface OpenAICompat {
|
|
|
477
478
|
clampOutputToModelMax?: boolean;
|
|
478
479
|
/** Strip image inputs before encoding (text-only serving of a multimodal id). */
|
|
479
480
|
stripImageInput?: boolean;
|
|
480
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
481
|
-
thinkingLoopGuard?: "gemini" | "deepseek" | "xai";
|
|
482
481
|
}
|
|
483
482
|
/**
|
|
484
483
|
* Compatibility settings for anthropic-messages API.
|
|
@@ -676,8 +675,6 @@ export interface AnthropicCompat {
|
|
|
676
675
|
* contract override it. Default: 10485760.
|
|
677
676
|
*/
|
|
678
677
|
maxImagePayloadBytes?: number;
|
|
679
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
680
|
-
thinkingLoopGuard?: "gemini" | "deepseek" | "xai";
|
|
681
678
|
/**
|
|
682
679
|
* Drop the enabled `thinking` config and replayed thinking blocks when the
|
|
683
680
|
* conversation is not thinking-led (a proxy contract for non-interleaved
|
|
@@ -887,8 +884,6 @@ export interface ResolvedOpenAISharedCompat {
|
|
|
887
884
|
toolSchemaFlavor?: OpenAICompat["toolSchemaFlavor"];
|
|
888
885
|
/** Strip image inputs before encoding (text-only serving of a multimodal id). */
|
|
889
886
|
stripImageInput: boolean;
|
|
890
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
891
|
-
thinkingLoopGuard?: OpenAICompat["thinkingLoopGuard"];
|
|
892
887
|
/** Flatten/reject leftover root `anyOf`/`oneOf` unions in strict tool schemas (xAI's function-calling validator 400s on them). */
|
|
893
888
|
rejectRootObjectUnion: boolean;
|
|
894
889
|
/** Retry without strict tools when the host rejects a strict grammar as too large (OpenRouter-Anthropic compiled-grammar overflow). */
|
|
@@ -900,7 +895,7 @@ export interface ResolvedOpenAISharedCompat {
|
|
|
900
895
|
* `buildModel`; request handlers read fields and never detect, resolve, or
|
|
901
896
|
* allocate.
|
|
902
897
|
*/
|
|
903
|
-
export type ResolvedOpenAICompat = ResolvedOpenAISharedCompat & Required<Omit<OpenAICompat, "supportsDeveloperRole" | "supportsReasoningEffort" | "trustExplicitThinkingOnly" | "reasoningEffortMap" | "supportsReasoningParams" | "supportsReasoningSummary" | "statefulResponses" | "supportsSamplingParams" | "supportsPenaltyAndStopParams" | "thinkingFormat" | "kimiApiFormat" | "reasoningDisableMode" | "omitReasoningEffort" | "includeEncryptedReasoning" | "filterReasoningHistory" | "disableReasoningOnForcedToolChoice" | "disableReasoningOnToolChoice" | "disableReasoningWithTools" | "supportsToolChoice" | "supportsForcedToolChoice" | "supportsNamedToolChoice" | "reasoningContentField" | "mistralReasoningContentParts" | "requiresReasoningContentForToolCalls" | "requiresReasoningContentForAllAssistantTurns" | "allowsSyntheticReasoningContentForToolCalls" | "syntheticReasoningContentFallback" | "replayReasoningContent" | "qwenPreserveThinking" | "qwenTemplateReasoningEffort" | "requiresThinkingAsText" | "requiresMistralToolIds" | "requiresToolResultName" | "requiresAssistantAfterToolResult" | "requiresAssistantContentForToolCalls" | "stripDeepseekSpecialTokens" | "stripThinkingHistory" | "streamMarkupHealingPattern" | "reasoningDeltasMayBeCumulative" | "emptyLengthFinishIsContextError" | "usesOpenAIToolCallIdLimit" | "promptCacheSessionHeader" | "sessionHeader" | "supportsPromptCacheBreakpoints" | "promptCacheBreakpointTtl" | "openRouterRouting" | "isOpenRouterHost" | "supportsStrictMode" | "supportsLongPromptCacheRetention" | "alwaysSendMaxTokens" | "clampOutputToModelMax" | "wireModelIdMode" | "vercelGatewayRouting" | "extraBody" | "toolStrictMode" | "toolSchemaFlavor" | "streamFirstEventTimeoutMs" | "streamIdleTimeoutMs" | "streamRevision" | "cacheControlFormat" | "thinkingKeep" | "strictResponsesPairing" | "supportsImageDetailOriginal" | "supportsConfigurationUpdate" | "supportsSteering" | "stripImageInput" | "
|
|
898
|
+
export type ResolvedOpenAICompat = ResolvedOpenAISharedCompat & Required<Omit<OpenAICompat, "supportsDeveloperRole" | "supportsReasoningEffort" | "trustExplicitThinkingOnly" | "reasoningEffortMap" | "supportsReasoningParams" | "supportsReasoningSummary" | "statefulResponses" | "supportsSamplingParams" | "supportsPenaltyAndStopParams" | "thinkingFormat" | "kimiApiFormat" | "reasoningDisableMode" | "omitReasoningEffort" | "includeEncryptedReasoning" | "filterReasoningHistory" | "disableReasoningOnForcedToolChoice" | "disableReasoningOnToolChoice" | "disableReasoningWithTools" | "supportsToolChoice" | "supportsForcedToolChoice" | "supportsNamedToolChoice" | "reasoningContentField" | "mistralReasoningContentParts" | "requiresReasoningContentForToolCalls" | "requiresReasoningContentForAllAssistantTurns" | "allowsSyntheticReasoningContentForToolCalls" | "syntheticReasoningContentFallback" | "replayReasoningContent" | "qwenPreserveThinking" | "qwenTemplateReasoningEffort" | "requiresThinkingAsText" | "requiresMistralToolIds" | "requiresToolResultName" | "requiresAssistantAfterToolResult" | "requiresAssistantContentForToolCalls" | "stripDeepseekSpecialTokens" | "stripThinkingHistory" | "streamMarkupHealingPattern" | "reasoningDeltasMayBeCumulative" | "emptyLengthFinishIsContextError" | "usesOpenAIToolCallIdLimit" | "promptCacheSessionHeader" | "sessionHeader" | "supportsPromptCacheBreakpoints" | "promptCacheBreakpointTtl" | "openRouterRouting" | "isOpenRouterHost" | "supportsStrictMode" | "supportsLongPromptCacheRetention" | "alwaysSendMaxTokens" | "clampOutputToModelMax" | "wireModelIdMode" | "vercelGatewayRouting" | "extraBody" | "toolStrictMode" | "toolSchemaFlavor" | "streamFirstEventTimeoutMs" | "streamIdleTimeoutMs" | "streamRevision" | "cacheControlFormat" | "thinkingKeep" | "strictResponsesPairing" | "supportsImageDetailOriginal" | "supportsConfigurationUpdate" | "supportsSteering" | "stripImageInput" | "whenThinking">> & {
|
|
904
899
|
vercelGatewayRouting?: OpenAICompat["vercelGatewayRouting"];
|
|
905
900
|
extraBody?: OpenAICompat["extraBody"];
|
|
906
901
|
cacheControlFormat?: OpenAICompat["cacheControlFormat"];
|
|
@@ -992,7 +987,7 @@ export interface ResolvedOpenAIResponsesCompat extends ResolvedOpenAISharedCompa
|
|
|
992
987
|
*/
|
|
993
988
|
export type ResolvedOpenRouterCompat = ResolvedOpenAICompat & ResolvedOpenAIResponsesCompat;
|
|
994
989
|
/** Fully-resolved anthropic-messages compat view (same contract as `ResolvedOpenAICompat`). */
|
|
995
|
-
export type ResolvedAnthropicCompat = Required<Omit<AnthropicCompat, "streamIdleTimeoutMs" | "
|
|
990
|
+
export type ResolvedAnthropicCompat = Required<Omit<AnthropicCompat, "streamIdleTimeoutMs" | "bedrockMessagesApi" | "effortBeta" | "extendedCacheTtlBeta" | "disabledThinking" | "betweenToolsEffort" | "stripThinkingHistory" | "fastMode" | "maxImageDimension" | "maxImagePayloadBytes">> & {
|
|
996
991
|
/** Effort-beta override; undefined keeps the transport's legacy heuristic. */
|
|
997
992
|
effortBeta?: AnthropicCompat["effortBeta"];
|
|
998
993
|
/** Extended-cache-ttl beta opt-out; undefined sends it where a 1h breakpoint needs it. */
|
|
@@ -1016,8 +1011,6 @@ export type ResolvedAnthropicCompat = Required<Omit<AnthropicCompat, "streamIdle
|
|
|
1016
1011
|
* request builder.
|
|
1017
1012
|
*/
|
|
1018
1013
|
maxImagePayloadBytes?: number;
|
|
1019
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
1020
|
-
thinkingLoopGuard?: AnthropicCompat["thinkingLoopGuard"];
|
|
1021
1014
|
/**
|
|
1022
1015
|
* Bedrock's Anthropic Messages API (see {@link AnthropicCompat.bedrockMessagesApi}).
|
|
1023
1016
|
* `true` when detected or configured; otherwise unset, so rows baked before
|
|
@@ -1116,16 +1109,13 @@ export interface GoogleCompat {
|
|
|
1116
1109
|
* {@link AnthropicCompat.maxImagePayloadBytes}).
|
|
1117
1110
|
*/
|
|
1118
1111
|
maxImagePayloadBytes?: number;
|
|
1119
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
1120
|
-
thinkingLoopGuard?: "gemini" | "deepseek" | "xai";
|
|
1121
1112
|
/** See {@link BedrockCompat.supportsSamplingParams}. */
|
|
1122
1113
|
supportsSamplingParams?: boolean;
|
|
1123
1114
|
}
|
|
1124
1115
|
/** Fully-resolved google-API compat view, materialized once by `buildModel`. */
|
|
1125
|
-
export type ResolvedGoogleCompat = Required<Omit<GoogleCompat, "streamFirstEventTimeoutMs" | "streamIdleTimeoutMs" | "
|
|
1116
|
+
export type ResolvedGoogleCompat = Required<Omit<GoogleCompat, "streamFirstEventTimeoutMs" | "streamIdleTimeoutMs" | "antigravityUsageLabel" | "supportsSamplingParams" | "maxImageDimension" | "maxImagePayloadBytes">> & {
|
|
1126
1117
|
streamFirstEventTimeoutMs?: number;
|
|
1127
1118
|
streamIdleTimeoutMs?: number;
|
|
1128
|
-
thinkingLoopGuard?: GoogleCompat["thinkingLoopGuard"];
|
|
1129
1119
|
antigravityUsageLabel?: string;
|
|
1130
1120
|
supportsSamplingParams?: boolean;
|
|
1131
1121
|
maxImageDimension?: number;
|
|
@@ -1209,12 +1199,12 @@ export interface ModelCost extends TokenCost {
|
|
|
1209
1199
|
/**
|
|
1210
1200
|
* Exact local content tokenizer family for a model.
|
|
1211
1201
|
*
|
|
1212
|
-
* Absent means no first-party local tokenizer is known and consumers
|
|
1213
|
-
*
|
|
1202
|
+
* Absent means no first-party local tokenizer is known and consumers count
|
|
1203
|
+
* in o200k_base. The values name tokenizer
|
|
1214
1204
|
* generations rather than providers: DeepSeek V3 through V4 share
|
|
1215
1205
|
* `"deepseek-v3"`; Kimi K2 through K3 share `"kimi-k2"`.
|
|
1216
1206
|
*/
|
|
1217
|
-
export type ModelTokenizer = "claude-v3" | "claude-v47" | "claude-v5" | "claude-v5-sonnet" | "qwen3" | "deepseek-v3" | "kimi-k2" | "glm5" | "o200k";
|
|
1207
|
+
export type ModelTokenizer = "claude-v3" | "claude-v47" | "claude-v5" | "claude-v5-sonnet" | "qwen3" | "deepseek-v3" | "kimi-k2" | "glm5" | "cl100k" | "o200k";
|
|
1218
1208
|
/** One account's discovered entitlements on a model; see {@link Model.accountAccess}. */
|
|
1219
1209
|
export interface ModelAccountAccess {
|
|
1220
1210
|
/**
|
|
@@ -1404,8 +1394,12 @@ export interface Model<TApi extends Api = Api> {
|
|
|
1404
1394
|
factoryDroidApiProviders?: string[];
|
|
1405
1395
|
/** Factory Droid: `configured_order` when live routing chose the rotation; absent means registry order. */
|
|
1406
1396
|
factoryDroidRoutingSource?: "configured_order";
|
|
1397
|
+
/** Factory Droid: server-side refusal fallbacks the account can run; absent when none are named. */
|
|
1398
|
+
factoryDroidRefusalFallbacks?: string[];
|
|
1407
1399
|
/** Factory Droid Standard Credits base rate (relative per-token weight, not dollars). */
|
|
1408
1400
|
factoryDroidCredits?: number;
|
|
1401
|
+
/** Factory Droid dated `credit-rates` cards, ascending; `getFactoryDroidCreditRate` picks the one due now. */
|
|
1402
|
+
factoryDroidCreditCards?: readonly DatedCostCard[];
|
|
1409
1403
|
/** Canonical organization resolved during Factory discovery. */
|
|
1410
1404
|
factoryDroidOrgId?: string;
|
|
1411
1405
|
cost: ModelCost;
|
|
@@ -1478,8 +1472,9 @@ export interface Model<TApi extends Api = Api> {
|
|
|
1478
1472
|
useResponsesLite?: boolean;
|
|
1479
1473
|
/**
|
|
1480
1474
|
* Service-tier ids the provider advertises for this model (Codex discovery
|
|
1481
|
-
* `service_tiers[].id`,
|
|
1482
|
-
*
|
|
1475
|
+
* `service_tiers[].id`, or an OpenAI-compatible `/v1/models` row's
|
|
1476
|
+
* `service_tiers`, e.g. `priority`, `ultrafast`). Absent when the provider
|
|
1477
|
+
* publishes no per-model tier list.
|
|
1483
1478
|
*/
|
|
1484
1479
|
serviceTiers?: readonly string[];
|
|
1485
1480
|
/** Preferred model to switch to when context promotion is triggered (model id or provider/id). */
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ModelIdentity } from "./compat/types";
|
|
2
2
|
import type { Effort } from "./effort";
|
|
3
|
+
import type { DatedCostCard } from "./pricing";
|
|
3
4
|
|
|
4
5
|
// Re-exported from @linxiraos/pi-utils so the whole workspace shares one
|
|
5
6
|
// `fetch`-compatible signature (tls-fetch's wrappers produce/accept it).
|
|
@@ -598,8 +599,6 @@ export interface OpenAICompat {
|
|
|
598
599
|
clampOutputToModelMax?: boolean;
|
|
599
600
|
/** Strip image inputs before encoding (text-only serving of a multimodal id). */
|
|
600
601
|
stripImageInput?: boolean;
|
|
601
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
602
|
-
thinkingLoopGuard?: "gemini" | "deepseek" | "xai";
|
|
603
602
|
}
|
|
604
603
|
|
|
605
604
|
/**
|
|
@@ -798,8 +797,6 @@ export interface AnthropicCompat {
|
|
|
798
797
|
* contract override it. Default: 10485760.
|
|
799
798
|
*/
|
|
800
799
|
maxImagePayloadBytes?: number;
|
|
801
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
802
|
-
thinkingLoopGuard?: "gemini" | "deepseek" | "xai";
|
|
803
800
|
/**
|
|
804
801
|
* Drop the enabled `thinking` config and replayed thinking blocks when the
|
|
805
802
|
* conversation is not thinking-led (a proxy contract for non-interleaved
|
|
@@ -1015,8 +1012,6 @@ export interface ResolvedOpenAISharedCompat {
|
|
|
1015
1012
|
toolSchemaFlavor?: OpenAICompat["toolSchemaFlavor"];
|
|
1016
1013
|
/** Strip image inputs before encoding (text-only serving of a multimodal id). */
|
|
1017
1014
|
stripImageInput: boolean;
|
|
1018
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
1019
|
-
thinkingLoopGuard?: OpenAICompat["thinkingLoopGuard"];
|
|
1020
1015
|
/** Flatten/reject leftover root `anyOf`/`oneOf` unions in strict tool schemas (xAI's function-calling validator 400s on them). */
|
|
1021
1016
|
rejectRootObjectUnion: boolean;
|
|
1022
1017
|
/** Retry without strict tools when the host rejects a strict grammar as too large (OpenRouter-Anthropic compiled-grammar overflow). */
|
|
@@ -1099,7 +1094,6 @@ export type ResolvedOpenAICompat = ResolvedOpenAISharedCompat &
|
|
|
1099
1094
|
| "supportsConfigurationUpdate"
|
|
1100
1095
|
| "supportsSteering"
|
|
1101
1096
|
| "stripImageInput"
|
|
1102
|
-
| "thinkingLoopGuard"
|
|
1103
1097
|
| "whenThinking"
|
|
1104
1098
|
>
|
|
1105
1099
|
> & {
|
|
@@ -1201,7 +1195,6 @@ export type ResolvedAnthropicCompat = Required<
|
|
|
1201
1195
|
Omit<
|
|
1202
1196
|
AnthropicCompat,
|
|
1203
1197
|
| "streamIdleTimeoutMs"
|
|
1204
|
-
| "thinkingLoopGuard"
|
|
1205
1198
|
| "bedrockMessagesApi"
|
|
1206
1199
|
| "effortBeta"
|
|
1207
1200
|
| "extendedCacheTtlBeta"
|
|
@@ -1236,8 +1229,6 @@ export type ResolvedAnthropicCompat = Required<
|
|
|
1236
1229
|
* request builder.
|
|
1237
1230
|
*/
|
|
1238
1231
|
maxImagePayloadBytes?: number;
|
|
1239
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
1240
|
-
thinkingLoopGuard?: AnthropicCompat["thinkingLoopGuard"];
|
|
1241
1232
|
/**
|
|
1242
1233
|
* Bedrock's Anthropic Messages API (see {@link AnthropicCompat.bedrockMessagesApi}).
|
|
1243
1234
|
* `true` when detected or configured; otherwise unset, so rows baked before
|
|
@@ -1339,8 +1330,6 @@ export interface GoogleCompat {
|
|
|
1339
1330
|
* {@link AnthropicCompat.maxImagePayloadBytes}).
|
|
1340
1331
|
*/
|
|
1341
1332
|
maxImagePayloadBytes?: number;
|
|
1342
|
-
/** Thinking-loop watchdog guard family applied to streamed reasoning. */
|
|
1343
|
-
thinkingLoopGuard?: "gemini" | "deepseek" | "xai";
|
|
1344
1333
|
/** See {@link BedrockCompat.supportsSamplingParams}. */
|
|
1345
1334
|
supportsSamplingParams?: boolean;
|
|
1346
1335
|
}
|
|
@@ -1351,7 +1340,6 @@ export type ResolvedGoogleCompat = Required<
|
|
|
1351
1340
|
GoogleCompat,
|
|
1352
1341
|
| "streamFirstEventTimeoutMs"
|
|
1353
1342
|
| "streamIdleTimeoutMs"
|
|
1354
|
-
| "thinkingLoopGuard"
|
|
1355
1343
|
| "antigravityUsageLabel"
|
|
1356
1344
|
| "supportsSamplingParams"
|
|
1357
1345
|
| "maxImageDimension"
|
|
@@ -1360,7 +1348,6 @@ export type ResolvedGoogleCompat = Required<
|
|
|
1360
1348
|
> & {
|
|
1361
1349
|
streamFirstEventTimeoutMs?: number;
|
|
1362
1350
|
streamIdleTimeoutMs?: number;
|
|
1363
|
-
thinkingLoopGuard?: GoogleCompat["thinkingLoopGuard"];
|
|
1364
1351
|
antigravityUsageLabel?: string;
|
|
1365
1352
|
supportsSamplingParams?: boolean;
|
|
1366
1353
|
maxImageDimension?: number;
|
|
@@ -1491,8 +1478,8 @@ export interface ModelCost extends TokenCost {
|
|
|
1491
1478
|
/**
|
|
1492
1479
|
* Exact local content tokenizer family for a model.
|
|
1493
1480
|
*
|
|
1494
|
-
* Absent means no first-party local tokenizer is known and consumers
|
|
1495
|
-
*
|
|
1481
|
+
* Absent means no first-party local tokenizer is known and consumers count
|
|
1482
|
+
* in o200k_base. The values name tokenizer
|
|
1496
1483
|
* generations rather than providers: DeepSeek V3 through V4 share
|
|
1497
1484
|
* `"deepseek-v3"`; Kimi K2 through K3 share `"kimi-k2"`.
|
|
1498
1485
|
*/
|
|
@@ -1505,6 +1492,7 @@ export type ModelTokenizer =
|
|
|
1505
1492
|
| "deepseek-v3"
|
|
1506
1493
|
| "kimi-k2"
|
|
1507
1494
|
| "glm5"
|
|
1495
|
+
| "cl100k"
|
|
1508
1496
|
| "o200k";
|
|
1509
1497
|
|
|
1510
1498
|
/** One account's discovered entitlements on a model; see {@link Model.accountAccess}. */
|
|
@@ -1700,8 +1688,12 @@ export interface Model<TApi extends Api = Api> {
|
|
|
1700
1688
|
factoryDroidApiProviders?: string[];
|
|
1701
1689
|
/** Factory Droid: `configured_order` when live routing chose the rotation; absent means registry order. */
|
|
1702
1690
|
factoryDroidRoutingSource?: "configured_order";
|
|
1691
|
+
/** Factory Droid: server-side refusal fallbacks the account can run; absent when none are named. */
|
|
1692
|
+
factoryDroidRefusalFallbacks?: string[];
|
|
1703
1693
|
/** Factory Droid Standard Credits base rate (relative per-token weight, not dollars). */
|
|
1704
1694
|
factoryDroidCredits?: number;
|
|
1695
|
+
/** Factory Droid dated `credit-rates` cards, ascending; `getFactoryDroidCreditRate` picks the one due now. */
|
|
1696
|
+
factoryDroidCreditCards?: readonly DatedCostCard[];
|
|
1705
1697
|
/** Canonical organization resolved during Factory discovery. */
|
|
1706
1698
|
factoryDroidOrgId?: string;
|
|
1707
1699
|
cost: ModelCost;
|
|
@@ -1774,8 +1766,9 @@ export interface Model<TApi extends Api = Api> {
|
|
|
1774
1766
|
useResponsesLite?: boolean;
|
|
1775
1767
|
/**
|
|
1776
1768
|
* Service-tier ids the provider advertises for this model (Codex discovery
|
|
1777
|
-
* `service_tiers[].id`,
|
|
1778
|
-
*
|
|
1769
|
+
* `service_tiers[].id`, or an OpenAI-compatible `/v1/models` row's
|
|
1770
|
+
* `service_tiers`, e.g. `priority`, `ultrafast`). Absent when the provider
|
|
1771
|
+
* publishes no per-model tier list.
|
|
1779
1772
|
*/
|
|
1780
1773
|
serviceTiers?: readonly string[];
|
|
1781
1774
|
/** Preferred model to switch to when context promotion is triggered (model id or provider/id). */
|