@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/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). */
|
package/src/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
|
package/src/utils.ts
CHANGED
|
@@ -40,6 +40,24 @@ export function toBoolean(value: unknown): boolean | undefined {
|
|
|
40
40
|
return typeof value === "boolean" ? value : undefined;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Service-tier ids from a discovery row's `service_tiers` array, deduplicated
|
|
45
|
+
* in advertisement order. Entries may be codex-rs `{ id, name, description }`
|
|
46
|
+
* objects or bare id strings (OpenAI-compatible relays). Returns `undefined`
|
|
47
|
+
* when the value is not an array; an empty array is kept, since it is a
|
|
48
|
+
* statement that the model offers no optional tier.
|
|
49
|
+
*/
|
|
50
|
+
export function parseServiceTierIds(value: unknown): string[] | undefined {
|
|
51
|
+
if (!Array.isArray(value)) return undefined;
|
|
52
|
+
const ids: string[] = [];
|
|
53
|
+
for (const tier of value) {
|
|
54
|
+
const raw = tier !== null && typeof tier === "object" && "id" in tier ? tier.id : tier;
|
|
55
|
+
const id = typeof raw === "string" ? raw.trim() : "";
|
|
56
|
+
if (id && !ids.includes(id)) ids.push(id);
|
|
57
|
+
}
|
|
58
|
+
return ids;
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
export function isAnthropicOAuthToken(key: string): boolean {
|
|
44
62
|
return key.includes("sk-ant-oat");
|
|
45
63
|
}
|
package/src/wire/codex.d.ts
CHANGED
|
@@ -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/src/wire/codex.ts
CHANGED
|
@@ -68,7 +68,7 @@ export const OPENAI_HEADER_VALUES = {
|
|
|
68
68
|
BETA_RESPONSES: "responses=experimental",
|
|
69
69
|
BETA_RESPONSES_WEBSOCKETS_V2: "responses_websockets=2026-02-06",
|
|
70
70
|
REMOTE_COMPACTION_V2: "remote_compaction_v2",
|
|
71
|
-
ORIGINATOR_CODEX: "
|
|
71
|
+
ORIGINATOR_CODEX: "omp",
|
|
72
72
|
} as const;
|
|
73
73
|
|
|
74
74
|
export const URL_PATHS = {
|
|
@@ -124,7 +124,8 @@ export function factoryDroidModelCacheProviderId(options: { apiKey?: string } &
|
|
|
124
124
|
}
|
|
125
125
|
const region = options.region === "eu" ? "eu" : "global";
|
|
126
126
|
const scope = `${credentialScope}\u0000${options.orgId ?? ""}\u0000${region}\u0000${options.inferenceRegion ?? region}`;
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
|
|
127
|
+
// v5: rows cached before discovery recorded the account's refusal fallbacks
|
|
128
|
+
// would let the request path send every fallback the rules name, so they
|
|
129
|
+
// must be refetched.
|
|
130
|
+
return `factory-droid:models-v5:${Bun.hash(scope).toString(36)}`;
|
|
130
131
|
}
|
package/src/models.json.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Api } from "./types";
|
|
2
|
-
|
|
3
|
-
/** Typed declaration for the generated models.json — only the `api` field matters for type inference. */
|
|
4
|
-
declare const models: {
|
|
5
|
-
[provider: string]: {
|
|
6
|
-
[modelId: string]: { readonly api: Api; [key: string]: unknown };
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export default models;
|