@linxiraos/pi-catalog 1.4.6 → 1.4.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 +6 -2
- package/README.md +3 -3
- package/dist/types/build.d.ts +12 -4
- 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 +6 -2
- package/dist/types/discovery/codex.d.ts +4 -5
- package/dist/types/discovery/cursor-proto.d.ts +8 -0
- package/dist/types/discovery/openai-compatible.d.ts +6 -0
- package/dist/types/model-cache.d.ts +8 -0
- package/dist/types/model-catalog-format.d.ts +37 -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 +22 -3
- 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/dist/types/wire/codex.d.ts +1 -1
- package/package.json +6 -10
- package/src/build.d.ts +12 -4
- package/src/build.ts +50 -3
- package/src/compat/auth-ids.ts +5 -0
- package/src/compat/axes.ts +27 -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 +14 -12
- 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/auth/typesafe.kdl +2 -1
- package/src/compat/rules/classes/anthropic.kdl +5 -0
- package/src/compat/rules/classes/deepseek.kdl +3 -2
- package/src/compat/rules/classes/gemini.kdl +1 -1
- package/src/compat/rules/classes/openai.kdl +2 -2
- 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 +243 -13
- package/src/compat/rules/providers/google-vertex.kdl +3 -0
- package/src/compat/rules/providers/kimi-code.kdl +6 -0
- package/src/compat/rules/providers/mistral.kdl +8 -0
- 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 +22 -6
- 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 +6 -2
- package/src/compat/types.ts +6 -2
- package/src/discovery/codex.d.ts +4 -5
- package/src/discovery/codex.ts +7 -15
- 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.d.ts +8 -0
- package/src/model-cache.ts +83 -61
- package/src/model-catalog-format.d.ts +37 -0
- package/src/model-catalog-format.ts +296 -0
- 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 +22 -3
- package/src/models.json +1 -1
- package/src/models.ts +48 -11
- package/src/pricing.d.ts +66 -6
- package/src/pricing.ts +59 -94
- package/src/provider-models/cache-provider-id.ts +23 -6
- 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 +203 -94
- package/src/provider-models/special.ts +5 -6
- 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/codex.d.ts +1 -1
- package/src/wire/codex.ts +1 -1
- package/src/wire/factory-droid.ts +4 -3
- package/src/models.json.d.ts +0 -9
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ModelIdentity } from "./compat/types.js";
|
|
2
2
|
import type { Effort } from "./effort.js";
|
|
3
|
+
import type { DatedCostCard } from "./pricing.js";
|
|
3
4
|
export type { FetchImpl } from "@linxiraos/pi-utils";
|
|
4
5
|
export type { KnownProvider } from "./provider-models/descriptors.js";
|
|
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/dist/types/utils.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export declare function toPositiveNumber(value: unknown, fallback: number | null
|
|
|
11
11
|
/** Positive finite number, or `null` when the value is missing/non-positive. */
|
|
12
12
|
export declare function toPositiveNumberOrNull(value: unknown): number | null;
|
|
13
13
|
export declare function toBoolean(value: unknown): boolean | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Service-tier ids from a discovery row's `service_tiers` array, deduplicated
|
|
16
|
+
* in advertisement order. Entries may be codex-rs `{ id, name, description }`
|
|
17
|
+
* objects or bare id strings (OpenAI-compatible relays). Returns `undefined`
|
|
18
|
+
* when the value is not an array; an empty array is kept, since it is a
|
|
19
|
+
* statement that the model offers no optional tier.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseServiceTierIds(value: unknown): string[] | undefined;
|
|
14
22
|
export declare function isAnthropicOAuthToken(key: string): boolean;
|
|
15
23
|
/**
|
|
16
24
|
* Normalize a model display name: drop the gateway author prefix and
|
|
@@ -49,7 +49,7 @@ export declare const OPENAI_HEADER_VALUES: {
|
|
|
49
49
|
readonly BETA_RESPONSES: "responses=experimental";
|
|
50
50
|
readonly BETA_RESPONSES_WEBSOCKETS_V2: "responses_websockets=2026-02-06";
|
|
51
51
|
readonly REMOTE_COMPACTION_V2: "remote_compaction_v2";
|
|
52
|
-
readonly ORIGINATOR_CODEX: "
|
|
52
|
+
readonly ORIGINATOR_CODEX: "omp";
|
|
53
53
|
};
|
|
54
54
|
export declare const URL_PATHS: {
|
|
55
55
|
readonly RESPONSES: "/responses";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxiraos/pi-catalog",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Model catalog for omp: bundled model database, provider discovery descriptors, model identity, classification, and equivalence",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -36,10 +36,6 @@
|
|
|
36
36
|
"types": "./dist/types/index.d.ts",
|
|
37
37
|
"import": "./src/index.ts"
|
|
38
38
|
},
|
|
39
|
-
"./models.json": {
|
|
40
|
-
"types": "./dist/types/models.json.d.d.ts",
|
|
41
|
-
"import": "./src/models.json"
|
|
42
|
-
},
|
|
43
39
|
"./provider-models": {
|
|
44
40
|
"types": "./dist/types/provider-models/index.d.ts",
|
|
45
41
|
"import": "./src/provider-models/index.ts"
|
|
@@ -90,15 +86,15 @@
|
|
|
90
86
|
"gen:proto": "bun scripts/generate-protocols.ts"
|
|
91
87
|
},
|
|
92
88
|
"dependencies": {
|
|
93
|
-
"@linxiraos/pi-omptype": "1.4.
|
|
94
|
-
"@linxiraos/pi-utils": "1.4.
|
|
89
|
+
"@linxiraos/pi-omptype": "1.4.9",
|
|
90
|
+
"@linxiraos/pi-utils": "1.4.9"
|
|
95
91
|
},
|
|
96
92
|
"devDependencies": {
|
|
97
93
|
"@bgotink/kdl": "0.4.0",
|
|
98
|
-
"@linxiraos/pi-ai": "1.4.
|
|
99
|
-
"@types/bun": "1.4.
|
|
94
|
+
"@linxiraos/pi-ai": "1.4.9",
|
|
95
|
+
"@types/bun": "1.4.4"
|
|
100
96
|
},
|
|
101
97
|
"engines": {
|
|
102
|
-
"bun": ">=1.
|
|
98
|
+
"bun": ">=1.4.4"
|
|
103
99
|
}
|
|
104
100
|
}
|
package/src/build.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Request handlers read fields — they never detect, parse ids, or allocate
|
|
7
7
|
* compat per request.
|
|
8
8
|
*/
|
|
9
|
-
import { type Api, type Model, type ModelSpec } from "./types";
|
|
9
|
+
import { type Api, type Model, type ModelCost, type ModelSpec } from "./types";
|
|
10
10
|
/**
|
|
11
11
|
* Applies reviewed catalog-data value corrections (`cost-patch`,
|
|
12
12
|
* `cache-read-at-input-rate`, `cache-write-rate`, `limits-patch`,
|
|
@@ -24,8 +24,16 @@ export declare function applyCatalogCorrections(model: Pick<ModelSpec<Api>, "cos
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function buildDiscoveredModel(spec: ModelSpec<Api>, providerType: string): Model<Api>;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* The first instant after `now` at which {@link buildModel} could select a
|
|
28
|
+
* different dated price card for a spec carrying `cost`: the next
|
|
29
|
+
* `effectiveFrom` of the spec's own rate schedule or of any dated card in the
|
|
30
|
+
* compiled rules. A build of an unchanged spec made at or after `now` is
|
|
31
|
+
* identical to a fresh one until then. `Infinity` when no change is pending.
|
|
32
|
+
*/
|
|
33
|
+
export declare function nextBuildPriceChange(cost: ModelCost, now: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Build one model from an authored spec. Bundled models are prebuilt by the
|
|
36
|
+
* generator and decoded by `models.ts`, so this only runs for discovered,
|
|
37
|
+
* custom, and override specs.
|
|
30
38
|
*/
|
|
31
39
|
export declare function buildModel<TApi extends Api>(spec: ModelSpec<TApi>): Model<TApi>;
|
package/src/build.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* compat per request.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import RULES from "./compat/rules.json" with { type: "json" };
|
|
10
11
|
import { resolveDiscoveryApi, resolveModelPolicy } from "./compat/resolve";
|
|
11
12
|
import type { ModelIdentity } from "./compat/types";
|
|
12
13
|
import { resolveModelTokenizer } from "./model-tokenizer";
|
|
@@ -463,10 +464,56 @@ export function buildDiscoveredModel(spec: ModelSpec<Api>, providerType: string)
|
|
|
463
464
|
return buildModel({ ...spec, api, providerType });
|
|
464
465
|
}
|
|
465
466
|
|
|
467
|
+
/** Every dated card instant in the compiled rules, ascending; collected on first use. */
|
|
468
|
+
let ruleCardInstants: number[] | undefined;
|
|
469
|
+
|
|
470
|
+
function collectRuleCardInstants(value: unknown, out: number[]): void {
|
|
471
|
+
if (Array.isArray(value)) {
|
|
472
|
+
for (const item of value) collectRuleCardInstants(item, out);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
if (typeof value !== "object" || value === null) return;
|
|
476
|
+
for (const key in value) {
|
|
477
|
+
const child: unknown = Reflect.get(value, key);
|
|
478
|
+
if (key === "effectiveFrom" && typeof child === "string") {
|
|
479
|
+
const instant = Date.parse(child);
|
|
480
|
+
if (Number.isFinite(instant)) out.push(instant);
|
|
481
|
+
} else {
|
|
482
|
+
collectRuleCardInstants(child, out);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* The first instant after `now` at which {@link buildModel} could select a
|
|
489
|
+
* different dated price card for a spec carrying `cost`: the next
|
|
490
|
+
* `effectiveFrom` of the spec's own rate schedule or of any dated card in the
|
|
491
|
+
* compiled rules. A build of an unchanged spec made at or after `now` is
|
|
492
|
+
* identical to a fresh one until then. `Infinity` when no change is pending.
|
|
493
|
+
*/
|
|
494
|
+
export function nextBuildPriceChange(cost: ModelCost, now: number): number {
|
|
495
|
+
if (ruleCardInstants === undefined) {
|
|
496
|
+
const instants: number[] = [];
|
|
497
|
+
collectRuleCardInstants(RULES, instants);
|
|
498
|
+
ruleCardInstants = instants.sort((a, b) => a - b);
|
|
499
|
+
}
|
|
500
|
+
let next = Number.POSITIVE_INFINITY;
|
|
501
|
+
for (const instant of ruleCardInstants) {
|
|
502
|
+
if (instant > now) {
|
|
503
|
+
next = instant;
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
for (const rate of cost.timeBased?.effectiveRates ?? []) {
|
|
508
|
+
if (rate.effectiveFrom > now && rate.effectiveFrom < next) next = rate.effectiveFrom;
|
|
509
|
+
}
|
|
510
|
+
return next;
|
|
511
|
+
}
|
|
512
|
+
|
|
466
513
|
/**
|
|
467
|
-
* Build one model from an authored spec. Bundled models
|
|
468
|
-
*
|
|
469
|
-
*
|
|
514
|
+
* Build one model from an authored spec. Bundled models are prebuilt by the
|
|
515
|
+
* generator and decoded by `models.ts`, so this only runs for discovered,
|
|
516
|
+
* custom, and override specs.
|
|
470
517
|
*/
|
|
471
518
|
export function buildModel<TApi extends Api>(spec: ModelSpec<TApi>): Model<TApi> {
|
|
472
519
|
const policy = resolveModelPolicy(spec);
|
package/src/compat/auth-ids.ts
CHANGED
|
@@ -53,6 +53,7 @@ export type AuthProviderId =
|
|
|
53
53
|
| "minimax-code"
|
|
54
54
|
| "minimax-code-cn"
|
|
55
55
|
| "mistral"
|
|
56
|
+
| "modular"
|
|
56
57
|
| "moonshot"
|
|
57
58
|
| "muse-code"
|
|
58
59
|
| "nanogpt"
|
|
@@ -72,6 +73,7 @@ export type AuthProviderId =
|
|
|
72
73
|
| "qwen-portal"
|
|
73
74
|
| "sakana"
|
|
74
75
|
| "sambanova"
|
|
76
|
+
| "scaleway"
|
|
75
77
|
| "siliconflow"
|
|
76
78
|
| "siliconflow-cn"
|
|
77
79
|
| "singularityapi-dev"
|
|
@@ -143,6 +145,8 @@ export type LoginProviderId =
|
|
|
143
145
|
| "meta"
|
|
144
146
|
| "minimax-code"
|
|
145
147
|
| "minimax-code-cn"
|
|
148
|
+
| "mistral"
|
|
149
|
+
| "modular"
|
|
146
150
|
| "moonshot"
|
|
147
151
|
| "muse-code"
|
|
148
152
|
| "nanogpt"
|
|
@@ -161,6 +165,7 @@ export type LoginProviderId =
|
|
|
161
165
|
| "qwen-portal"
|
|
162
166
|
| "sakana"
|
|
163
167
|
| "sambanova"
|
|
168
|
+
| "scaleway"
|
|
164
169
|
| "siliconflow"
|
|
165
170
|
| "siliconflow-cn"
|
|
166
171
|
| "singularityapi-dev"
|
package/src/compat/axes.ts
CHANGED
|
@@ -109,6 +109,7 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
109
109
|
"preserved",
|
|
110
110
|
"interleaved",
|
|
111
111
|
]),
|
|
112
|
+
"completions-allow-missing-thinking": wire("completionsAllowMissingThinking", ["request"]),
|
|
112
113
|
"anthropic-thinking": wire("anthropicThinking", ["request"], "scalar", [
|
|
113
114
|
"adaptive",
|
|
114
115
|
"adaptive-summarized",
|
|
@@ -119,7 +120,7 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
119
120
|
"openai-platform-header": wire("openaiPlatformHeader", ["request"]),
|
|
120
121
|
"responses-cache-retention": wire("responsesCacheRetention", ["request"]),
|
|
121
122
|
"responses-verbosity": wire("responsesVerbosity", ["request"], "scalar", ["low"]),
|
|
122
|
-
"responses-service-tier": wire("responsesServiceTier", ["request"], "scalar", ["priority"]),
|
|
123
|
+
"responses-service-tier": wire("responsesServiceTier", ["request"], "scalar", ["priority", "ultrafast"]),
|
|
123
124
|
"responses-parallel-tool-calls": wire("responsesParallelToolCalls", ["request"]),
|
|
124
125
|
"responses-safety-identifier": wire("responsesSafetyIdentifier", ["request"]),
|
|
125
126
|
"responses-tool-choice-auto": wire("responsesToolChoiceAuto", ["request"]),
|
|
@@ -317,11 +318,6 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
317
318
|
"strip-image-input": wire("stripImageInput", [...OAI, "anthropic", "google"]),
|
|
318
319
|
"supports-forced-tool-choice": wire("supportsForcedToolChoice", [...OAI, "anthropic", "bedrock"]),
|
|
319
320
|
"supports-sampling-params": wire("supportsSamplingParams", [...OAI, "anthropic", "bedrock", "devin", "google"]),
|
|
320
|
-
"thinking-loop-guard": wire("thinkingLoopGuard", [...OAI, "anthropic", "google"], "scalar", [
|
|
321
|
-
"gemini",
|
|
322
|
-
"deepseek",
|
|
323
|
-
"xai",
|
|
324
|
-
]),
|
|
325
321
|
|
|
326
322
|
// ── thinking control surface ──
|
|
327
323
|
"thinking-default-level": { key: "defaultLevel", set: "thinking", shape: "scalar", values: EFFORTS },
|
|
@@ -456,6 +452,19 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
456
452
|
shape: "scalar",
|
|
457
453
|
values: ["output", "signature"],
|
|
458
454
|
},
|
|
455
|
+
/**
|
|
456
|
+
* Stream loop guard for the model line, on every host and API (read
|
|
457
|
+
* through `loopGuardLevel` in pi-ai `utils/thinking-loop`). `semantic`
|
|
458
|
+
* adds near-duplicate and stalled-wording paragraph detection to the
|
|
459
|
+
* exact repeated-cycle check; `off` disables the guard. Unassigned: exact
|
|
460
|
+
* repeated cycles only.
|
|
461
|
+
*/
|
|
462
|
+
"thinking-loop-guard": {
|
|
463
|
+
key: "thinkingLoopGuard",
|
|
464
|
+
set: "catalog",
|
|
465
|
+
shape: "scalar",
|
|
466
|
+
values: ["off", "semantic"],
|
|
467
|
+
},
|
|
459
468
|
"delegation-bias": { key: "delegationBias", set: "catalog", shape: "scalar", values: DELEGATION_BIASES },
|
|
460
469
|
"discovery-api": { key: "discoveryApi", set: "catalog", shape: "scalar" },
|
|
461
470
|
"edit-prompt-variant": { key: "editPromptVariant", set: "catalog", shape: "scalar", values: ["full", "compact"] },
|
|
@@ -469,6 +478,12 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
469
478
|
values: ["gemini", "anthropic", "codex", "xai", "openrouter", "openai"],
|
|
470
479
|
},
|
|
471
480
|
"web-search-model": { key: "webSearchModel", set: "catalog", shape: "scalar" },
|
|
481
|
+
/**
|
|
482
|
+
* Revision suffix the host appends to the model's id (Vertex `@default`): a
|
|
483
|
+
* `provider/id` selector written without it names this model exactly.
|
|
484
|
+
* Unassigned: the id has no implied revision and must be written in full.
|
|
485
|
+
*/
|
|
486
|
+
"selector-revision-suffix": { key: "selectorRevisionSuffix", set: "catalog", shape: "scalar" },
|
|
472
487
|
"hosted-image": { key: "hostedImage", set: "catalog", shape: "scalar", values: [true, false] },
|
|
473
488
|
/** How the model line bills an input image; shape and formulas in `./image-tokenization`. */
|
|
474
489
|
"image-tokenization": { key: "imageTokenization", set: "catalog", shape: "object" },
|
|
@@ -496,8 +511,9 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
496
511
|
"image-max-edge": { key: "imageMaxEdge", set: "catalog", shape: "scalar" },
|
|
497
512
|
"inline-image-byte-budget": { key: "inlineImageByteBudget", set: "catalog", shape: "scalar" },
|
|
498
513
|
/**
|
|
499
|
-
* Largest request body the host accepts. Where set, the inline-image byte clamp keeps
|
|
500
|
-
* and newest tool result's images past
|
|
514
|
+
* Largest request body the host accepts. Where set, the inline-image byte clamp keeps images within what the
|
|
515
|
+
* request's other bytes leave of it, and keeps the newest user message's and newest tool result's images past
|
|
516
|
+
* `inline-image-byte-budget` while they fit that room.
|
|
501
517
|
*/
|
|
502
518
|
"request-body-byte-limit": { key: "requestBodyByteLimit", set: "catalog", shape: "scalar" },
|
|
503
519
|
/**
|
|
@@ -657,7 +673,9 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
657
673
|
"region-limits-eu": { key: "regionLimitsEu", set: "catalog", shape: "object" },
|
|
658
674
|
/**
|
|
659
675
|
* Subscription credit rates: `input` is the per-token credit weight shown
|
|
660
|
-
* as the model's multiplier; `output` and `cache-read` multiply it.
|
|
676
|
+
* as the model's multiplier; `output` and `cache-read` multiply it. An
|
|
677
|
+
* `effective-rates` block of dated cards overwrites them from each card's
|
|
678
|
+
* `effective-from`, as on `cost-patch`.
|
|
661
679
|
*/
|
|
662
680
|
"credit-rates": { key: "creditRates", set: "catalog", shape: "object" },
|
|
663
681
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CatalogPolicyInputs } from "../types";
|
|
2
|
+
import { type ResolveRoute } from "./resolve";
|
|
3
|
+
/**
|
|
4
|
+
* The `catalog` axis bag authored in the KDL cascade rules for a model (on one
|
|
5
|
+
* upstream when `route` names it), memoized per distinct model. Frozen: the bag
|
|
6
|
+
* is shared across callers, so it must stay read-only — extract the value you
|
|
7
|
+
* need rather than handing it on.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveCatalogPolicy(model: CatalogPolicyInputs, route?: ResolveRoute): Readonly<Record<string, unknown>>;
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { withoutUnverifiedThinking } from "../model-thinking";
|
|
2
2
|
import type { CatalogPolicyInputs } from "../types";
|
|
3
|
-
import { resolveCatalogAxes } from "./resolve";
|
|
3
|
+
import { type ResolveRoute, resolveCatalogAxes } from "./resolve";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Rule-owned catalog-axis policy by model. Resolve once per process rather
|
|
7
7
|
* than walking the static policy cascade on every accessor call. The key
|
|
8
8
|
* mirrors the cascade target inputs — `providerType ?? provider`, api, the
|
|
9
9
|
* logical id plus `requestModelId` (the wire id `policyModelId` resolves
|
|
10
|
-
* unknown logical ids under), and the
|
|
11
|
-
* class/family/revision facts are a pure function of
|
|
12
|
-
* one entry per distinct model.
|
|
10
|
+
* unknown logical ids under), the reasoning flag, and the route's upstream;
|
|
11
|
+
* identity-derived class/family/revision facts are a pure function of
|
|
12
|
+
* provider + id. Bounded: one entry per distinct model and upstream.
|
|
13
13
|
*/
|
|
14
14
|
const catalogPolicyCache = new Map<string, Readonly<Record<string, unknown>>>();
|
|
15
15
|
const CATALOG_POLICY_CACHE_MAX = 8192;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The `catalog` axis bag authored in the KDL cascade rules for a model
|
|
19
|
-
* memoized per distinct model. Frozen: the bag
|
|
20
|
-
* must stay read-only — extract the value you
|
|
18
|
+
* The `catalog` axis bag authored in the KDL cascade rules for a model (on one
|
|
19
|
+
* upstream when `route` names it), memoized per distinct model. Frozen: the bag
|
|
20
|
+
* is shared across callers, so it must stay read-only — extract the value you
|
|
21
|
+
* need rather than handing it on.
|
|
21
22
|
*/
|
|
22
|
-
export function resolveCatalogPolicy(
|
|
23
|
-
|
|
23
|
+
export function resolveCatalogPolicy(
|
|
24
|
+
model: CatalogPolicyInputs,
|
|
25
|
+
route?: ResolveRoute,
|
|
26
|
+
): Readonly<Record<string, unknown>> {
|
|
27
|
+
const key = `${model.provider}\u0000${model.providerType ?? ""}\u0000${model.api}\u0000${model.id}\u0000${model.requestModelId ?? ""}\u0000${model.reasoning ? 1 : 0}\u0000${route?.upstream ?? ""}`;
|
|
24
28
|
const cached = catalogPolicyCache.get(key);
|
|
25
29
|
if (cached !== undefined) return cached;
|
|
26
|
-
const policy = Object.freeze({ ...resolveCatalogAxes(withoutUnverifiedThinking(model)) });
|
|
30
|
+
const policy = Object.freeze({ ...resolveCatalogAxes(withoutUnverifiedThinking(model), route) });
|
|
27
31
|
if (catalogPolicyCache.size >= CATALOG_POLICY_CACHE_MAX) catalogPolicyCache.clear();
|
|
28
32
|
catalogPolicyCache.set(key, policy);
|
|
29
33
|
return policy;
|
package/src/compat/collapse.ts
CHANGED
|
@@ -240,7 +240,7 @@ function compiledTemplate(compiled: CompiledVariantFamily): VariantFamilyTemplat
|
|
|
240
240
|
const alternatives = [family.id, ...family.members, ...(family.extraAliases ?? [])].map(id =>
|
|
241
241
|
id
|
|
242
242
|
.split(REVISION_PLACEHOLDER)
|
|
243
|
-
.map(part =>
|
|
243
|
+
.map(part => RegExp.escape(part))
|
|
244
244
|
.join(REVISION_CAPTURE),
|
|
245
245
|
);
|
|
246
246
|
const template: VariantFamilyTemplate = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DatedCostCard } from "../pricing";
|
|
1
2
|
import type { Api, ModelSpec } from "../types";
|
|
2
3
|
import { type FactoryDroidRegion, type FactoryDroidWire } from "../wire/factory-droid";
|
|
3
4
|
/** Native token limits for one inference region. */
|
|
@@ -5,11 +6,16 @@ export interface FactoryDroidLimits {
|
|
|
5
6
|
contextWindow: number | null;
|
|
6
7
|
maxTokens: number | null;
|
|
7
8
|
}
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Standard Credits rates: `input` is the per-token weight; `output` and
|
|
11
|
+
* `cacheRead` multiply it. `effectiveRates` are dated cards (ascending) that
|
|
12
|
+
* overwrite those legs from their date, as on `cost-patch`.
|
|
13
|
+
*/
|
|
9
14
|
export interface FactoryDroidCreditRates {
|
|
10
15
|
input: number;
|
|
11
16
|
output?: number;
|
|
12
17
|
cacheRead?: number;
|
|
18
|
+
effectiveRates?: readonly DatedCostCard[];
|
|
13
19
|
}
|
|
14
20
|
/** Account gates on one registry model (the `entitlement` axis). */
|
|
15
21
|
export interface FactoryDroidEntitlement {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* to bind a model to the account serving it.
|
|
7
7
|
*/
|
|
8
8
|
import { isRecord, once } from "@linxiraos/pi-utils";
|
|
9
|
+
import { type DatedCostCard, parseDatedCostCards } from "../pricing";
|
|
9
10
|
import type { Api, ModelSpec } from "../types";
|
|
10
11
|
import { FACTORY_DROID_WIRES, type FactoryDroidRegion, type FactoryDroidWire } from "../wire/factory-droid";
|
|
11
12
|
import { apiRouteFor } from "./behavior";
|
|
@@ -20,11 +21,16 @@ export interface FactoryDroidLimits {
|
|
|
20
21
|
maxTokens: number | null;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Standard Credits rates: `input` is the per-token weight; `output` and
|
|
26
|
+
* `cacheRead` multiply it. `effectiveRates` are dated cards (ascending) that
|
|
27
|
+
* overwrite those legs from their date, as on `cost-patch`.
|
|
28
|
+
*/
|
|
24
29
|
export interface FactoryDroidCreditRates {
|
|
25
30
|
input: number;
|
|
26
31
|
output?: number;
|
|
27
32
|
cacheRead?: number;
|
|
33
|
+
effectiveRates?: readonly DatedCostCard[];
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
/** Account gates on one registry model (the `entitlement` axis). */
|
|
@@ -95,6 +101,7 @@ function readPolicy(spec: ModelSpec<"factory-droid-agent">): FactoryDroidModelPo
|
|
|
95
101
|
const euMaxTokens = numberField(euLimits, "maxTokens");
|
|
96
102
|
const creditOutput = numberField(credits, "output");
|
|
97
103
|
const creditCacheRead = numberField(credits, "cacheRead");
|
|
104
|
+
const creditCards = parseDatedCostCards(credits, "credit-rates");
|
|
98
105
|
const featureFlag = stringField(entitlement, "featureFlag");
|
|
99
106
|
const deprecationFlag = stringField(entitlement, "deprecationFlag");
|
|
100
107
|
const baseVariant = stringField(entitlement, "baseVariant");
|
|
@@ -116,6 +123,7 @@ function readPolicy(spec: ModelSpec<"factory-droid-agent">): FactoryDroidModelPo
|
|
|
116
123
|
input: creditInput,
|
|
117
124
|
...(creditOutput !== undefined && { output: creditOutput }),
|
|
118
125
|
...(creditCacheRead !== undefined && { cacheRead: creditCacheRead }),
|
|
126
|
+
...(creditCards.length > 0 && { effectiveRates: creditCards }),
|
|
119
127
|
},
|
|
120
128
|
}),
|
|
121
129
|
...(priceProvider !== undefined && {
|
|
@@ -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" | "apple" | "azure" | "baseten" | "bedrock-mantle" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "commandcode" | "coralbricks" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "factory-droid" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google" | "google-antigravity" | "google-gemini-cli" | "google-vertex" | "groq" | "helmcode" | "huggingface" | "inception" | "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" | "sambanova" | "siliconflow" | "siliconflow-cn" | "singularityapi-dev" | "singularityapi-tech" | "snowflake" | "stepfun" | "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" | "apple" | "azure" | "baseten" | "bedrock-mantle" | "cerebras" | "charm-hyper" | "cline-pass" | "cloudflare-ai-gateway" | "cloudflare-workers-ai" | "commandcode" | "coralbricks" | "coreweave" | "cursor" | "deepinfra" | "deepseek" | "devin" | "factory-droid" | "firepass" | "fireworks" | "github-copilot" | "gitlab-duo" | "gitlab-duo-agent" | "gmi-cloud" | "google" | "google-antigravity" | "google-gemini-cli" | "google-vertex" | "groq" | "helmcode" | "huggingface" | "inception" | "kilo" | "kimi-code" | "litellm" | "lm-studio" | "local" | "meta" | "minimax" | "minimax-code" | "minimax-code-cn" | "mistral" | "modular" | "moonshot" | "muse-code" | "nanogpt" | "novita" | "nvidia" | "ollama" | "ollama-cloud" | "openai" | "openai-codex" | "opencode-go" | "opencode-zen" | "openrouter" | "qianfan" | "qwen-portal" | "sakana" | "sambanova" | "scaleway" | "siliconflow" | "siliconflow-cn" | "singularityapi-dev" | "singularityapi-tech" | "snowflake" | "stepfun" | "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";
|
|
@@ -50,6 +50,7 @@ export type KnownProvider =
|
|
|
50
50
|
| "minimax-code"
|
|
51
51
|
| "minimax-code-cn"
|
|
52
52
|
| "mistral"
|
|
53
|
+
| "modular"
|
|
53
54
|
| "moonshot"
|
|
54
55
|
| "muse-code"
|
|
55
56
|
| "nanogpt"
|
|
@@ -66,6 +67,7 @@ export type KnownProvider =
|
|
|
66
67
|
| "qwen-portal"
|
|
67
68
|
| "sakana"
|
|
68
69
|
| "sambanova"
|
|
70
|
+
| "scaleway"
|
|
69
71
|
| "siliconflow"
|
|
70
72
|
| "siliconflow-cn"
|
|
71
73
|
| "singularityapi-dev"
|
package/src/compat/resolve.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function resolveDiscoveryApi(spec: ModelSpec<Api>, providerType:
|
|
|
21
21
|
* {@link resolveModelPolicy} without resolving the compat and thinking
|
|
22
22
|
* policies, which dominate its cost on catalog-wide scans.
|
|
23
23
|
*/
|
|
24
|
-
export declare function resolveCatalogAxes(spec: CatalogPolicyInputs): Record<string, unknown>;
|
|
24
|
+
export declare function resolveCatalogAxes(spec: CatalogPolicyInputs, route?: ResolveRoute): Record<string, unknown>;
|
|
25
25
|
/**
|
|
26
26
|
* Resolves the full policy surface for one model spec: structured identity,
|
|
27
27
|
* complete compat record, thinking metadata, and catalog-data corrections.
|
package/src/compat/resolve.ts
CHANGED
|
@@ -604,7 +604,6 @@ function detectOpenAICompat(
|
|
|
604
604
|
zaiReasoningEffortDialect: false,
|
|
605
605
|
clampOutputToModelMax: d.isLocalOpenAICompatBackend,
|
|
606
606
|
stripImageInput: false,
|
|
607
|
-
thinkingLoopGuard: undefined,
|
|
608
607
|
rejectRootObjectUnion: false,
|
|
609
608
|
retryWithoutStrictOnGrammarError: false,
|
|
610
609
|
supportsPromptCacheKey: false,
|
|
@@ -762,7 +761,6 @@ function resolveOpenAIResponsesPolicy(
|
|
|
762
761
|
supportsSteering: false,
|
|
763
762
|
requiresReasoningOffJuiceInstruction: false,
|
|
764
763
|
stripImageInput: false,
|
|
765
|
-
thinkingLoopGuard: undefined,
|
|
766
764
|
reasoningEffortMap: {},
|
|
767
765
|
supportsReasoningParams: true,
|
|
768
766
|
supportsSamplingParams: true,
|
|
@@ -936,7 +934,6 @@ function resolveAnthropicPolicy(
|
|
|
936
934
|
// user-authored `compat` block to override them.
|
|
937
935
|
maxImageDimension: undefined,
|
|
938
936
|
maxImagePayloadBytes: undefined,
|
|
939
|
-
thinkingLoopGuard: undefined,
|
|
940
937
|
// Present as keys so models.yml `compat` can set them; unset unless a rule assigns them.
|
|
941
938
|
stripThinkingHistory: undefined,
|
|
942
939
|
fastMode: undefined,
|
|
@@ -1340,8 +1337,10 @@ export function resolveDiscoveryApi(spec: ModelSpec<Api>, providerType: string):
|
|
|
1340
1337
|
* {@link resolveModelPolicy} without resolving the compat and thinking
|
|
1341
1338
|
* policies, which dominate its cost on catalog-wide scans.
|
|
1342
1339
|
*/
|
|
1343
|
-
export function resolveCatalogAxes(spec: CatalogPolicyInputs): Record<string, unknown> {
|
|
1344
|
-
|
|
1340
|
+
export function resolveCatalogAxes(spec: CatalogPolicyInputs, route?: ResolveRoute): Record<string, unknown> {
|
|
1341
|
+
const target = buildResolveTarget(spec, resolveIdentity(spec));
|
|
1342
|
+
target.upstream = route?.upstream;
|
|
1343
|
+
return resolveCascade(target).catalog;
|
|
1345
1344
|
}
|
|
1346
1345
|
|
|
1347
1346
|
/**
|
package/src/compat/revision.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare function parseRevision(value: string): Revision | undefined;
|
|
|
22
22
|
export declare function parseRevisionPrefix(value: string): Revision | undefined;
|
|
23
23
|
/** Lexicographic triple comparison: negative, zero, or positive. */
|
|
24
24
|
export declare function compareRevision(a: Revision, b: Revision): number;
|
|
25
|
+
/** Whether a revision string parses and is at or above `floor`; `undefined` or unparsable is never. */
|
|
26
|
+
export declare function revisionAtLeast(revision: string | undefined, floor: string): boolean;
|
|
25
27
|
/** Renders a revision as its canonical `major.minor.patch` string. */
|
|
26
28
|
export declare function formatRevision(revision: Revision): string;
|
|
27
29
|
/** Comparison operator inside a `revision ">=2.5 <4"` cascade constraint. */
|