@linxiraos/pi-catalog 1.0.0
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 +999 -0
- package/README.md +43 -0
- package/dist/types/build.d.ts +14 -0
- package/dist/types/compat/anthropic.d.ts +18 -0
- package/dist/types/compat/apply.d.ts +7 -0
- package/dist/types/compat/bedrock.d.ts +3 -0
- package/dist/types/compat/devin.d.ts +9 -0
- package/dist/types/compat/openai.d.ts +26 -0
- package/dist/types/discovery/antigravity.d.ts +70 -0
- package/dist/types/discovery/codex.d.ts +36 -0
- package/dist/types/discovery/cursor-gen/agent_pb.d.ts +16769 -0
- package/dist/types/discovery/cursor.d.ts +23 -0
- package/dist/types/discovery/devin-gen/buf/validate/validate_pb.d.ts +1715 -0
- package/dist/types/discovery/devin-gen/exa/analytics_pb/analytics_pb.d.ts +693 -0
- package/dist/types/discovery/devin-gen/exa/api_server_pb/api_server_pb.d.ts +9158 -0
- package/dist/types/discovery/devin-gen/exa/auth_pb/auth_pb.d.ts +52 -0
- package/dist/types/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.d.ts +276 -0
- package/dist/types/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.d.ts +78 -0
- package/dist/types/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.d.ts +999 -0
- package/dist/types/discovery/devin-gen/exa/chat_pb/chat_pb.d.ts +1704 -0
- package/dist/types/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.d.ts +656 -0
- package/dist/types/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.d.ts +15014 -0
- package/dist/types/discovery/devin-gen/exa/context_module_pb/context_module_pb.d.ts +607 -0
- package/dist/types/discovery/devin-gen/exa/cortex_pb/cortex_pb.d.ts +11830 -0
- package/dist/types/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.d.ts +248 -0
- package/dist/types/discovery/devin-gen/exa/index_pb/index_pb.d.ts +1747 -0
- package/dist/types/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.d.ts +509 -0
- package/dist/types/discovery/devin-gen/exa/language_server_pb/language_server_pb.d.ts +9048 -0
- package/dist/types/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.d.ts +1760 -0
- package/dist/types/discovery/devin-gen/exa/prompt_pb/prompt_pb.d.ts +286 -0
- package/dist/types/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.d.ts +405 -0
- package/dist/types/discovery/devin-gen/exa/trust_pb/trust_pb.d.ts +582 -0
- package/dist/types/discovery/devin.d.ts +24 -0
- package/dist/types/discovery/gemini.d.ts +25 -0
- package/dist/types/discovery/gitlab-duo-workflow.d.ts +30 -0
- package/dist/types/discovery/index.d.ts +5 -0
- package/dist/types/discovery/openai-compatible.d.ts +74 -0
- package/dist/types/effort.d.ts +10 -0
- package/dist/types/fireworks-model-id.d.ts +23 -0
- package/dist/types/hosts.d.ts +164 -0
- package/dist/types/identity/bundled.d.ts +3 -0
- package/dist/types/identity/classify.d.ts +69 -0
- package/dist/types/identity/dialect.d.ts +3 -0
- package/dist/types/identity/family.d.ts +181 -0
- package/dist/types/identity/id.d.ts +12 -0
- package/dist/types/identity/index.d.ts +8 -0
- package/dist/types/identity/markers.d.ts +4 -0
- package/dist/types/identity/priority.d.ts +1 -0
- package/dist/types/identity/reference.d.ts +29 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/model-cache.d.ts +23 -0
- package/dist/types/model-manager.d.ts +77 -0
- package/dist/types/model-thinking.d.ts +66 -0
- package/dist/types/models.d.ts +12 -0
- package/dist/types/provider-models/bundled-references.d.ts +13 -0
- package/dist/types/provider-models/cache-provider-id.d.ts +9 -0
- package/dist/types/provider-models/descriptor-types.d.ts +76 -0
- package/dist/types/provider-models/descriptors.d.ts +504 -0
- package/dist/types/provider-models/google.d.ts +27 -0
- package/dist/types/provider-models/index.d.ts +7 -0
- package/dist/types/provider-models/ollama.d.ts +22 -0
- package/dist/types/provider-models/openai-compat.d.ts +599 -0
- package/dist/types/provider-models/special.d.ts +53 -0
- package/dist/types/types.d.ts +811 -0
- package/dist/types/utils.d.ts +20 -0
- package/dist/types/variant-collapse.d.ts +133 -0
- package/dist/types/wire/alibaba-token-plan.d.ts +22 -0
- package/dist/types/wire/codex.d.ts +42 -0
- package/dist/types/wire/coreweave.d.ts +12 -0
- package/dist/types/wire/gemini-headers.d.ts +37 -0
- package/dist/types/wire/github-copilot.d.ts +39 -0
- package/package.json +101 -0
- package/src/build.ts +94 -0
- package/src/compat/anthropic.ts +179 -0
- package/src/compat/apply.ts +15 -0
- package/src/compat/bedrock.ts +153 -0
- package/src/compat/devin.ts +12 -0
- package/src/compat/openai.ts +796 -0
- package/src/discovery/antigravity.ts +253 -0
- package/src/discovery/codex.ts +346 -0
- package/src/discovery/cursor-gen/agent_pb.ts +19513 -0
- package/src/discovery/cursor.ts +396 -0
- package/src/discovery/devin-gen/buf/validate/validate_pb.ts +1862 -0
- package/src/discovery/devin-gen/exa/analytics_pb/analytics_pb.ts +871 -0
- package/src/discovery/devin-gen/exa/api_server_pb/api_server_pb.ts +11083 -0
- package/src/discovery/devin-gen/exa/auth_pb/auth_pb.ts +71 -0
- package/src/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.ts +348 -0
- package/src/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.ts +103 -0
- package/src/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.ts +1198 -0
- package/src/discovery/devin-gen/exa/chat_pb/chat_pb.ts +2063 -0
- package/src/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.ts +810 -0
- package/src/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.ts +18354 -0
- package/src/discovery/devin-gen/exa/context_module_pb/context_module_pb.ts +732 -0
- package/src/discovery/devin-gen/exa/cortex_pb/cortex_pb.ts +14277 -0
- package/src/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.ts +312 -0
- package/src/discovery/devin-gen/exa/index_pb/index_pb.ts +2106 -0
- package/src/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.ts +623 -0
- package/src/discovery/devin-gen/exa/language_server_pb/language_server_pb.ts +10918 -0
- package/src/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.ts +2125 -0
- package/src/discovery/devin-gen/exa/prompt_pb/prompt_pb.ts +361 -0
- package/src/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.ts +450 -0
- package/src/discovery/devin-gen/exa/trust_pb/trust_pb.ts +712 -0
- package/src/discovery/devin.ts +151 -0
- package/src/discovery/gemini.ts +260 -0
- package/src/discovery/gitlab-duo-workflow.ts +859 -0
- package/src/discovery/index.ts +5 -0
- package/src/discovery/openai-compatible.ts +249 -0
- package/src/effort.ts +18 -0
- package/src/fireworks-model-id.ts +50 -0
- package/src/hosts.ts +155 -0
- package/src/identity/bundled.ts +28 -0
- package/src/identity/classify.ts +219 -0
- package/src/identity/dialect.ts +42 -0
- package/src/identity/family.ts +366 -0
- package/src/identity/id.ts +81 -0
- package/src/identity/index.ts +8 -0
- package/src/identity/markers.ts +49 -0
- package/src/identity/priority.ts +59 -0
- package/src/identity/reference.ts +167 -0
- package/src/index.ts +17 -0
- package/src/model-cache.ts +285 -0
- package/src/model-manager.ts +672 -0
- package/src/model-thinking.ts +821 -0
- package/src/models.json +106099 -0
- package/src/models.json.d.ts +9 -0
- package/src/models.ts +93 -0
- package/src/provider-models/bundled-references.ts +75 -0
- package/src/provider-models/cache-provider-id.ts +68 -0
- package/src/provider-models/descriptor-types.ts +85 -0
- package/src/provider-models/descriptors.ts +584 -0
- package/src/provider-models/google.ts +107 -0
- package/src/provider-models/index.ts +7 -0
- package/src/provider-models/ollama.ts +204 -0
- package/src/provider-models/openai-compat.ts +5991 -0
- package/src/provider-models/special.ts +213 -0
- package/src/types.ts +952 -0
- package/src/utils.ts +69 -0
- package/src/variant-collapse.ts +1225 -0
- package/src/wire/alibaba-token-plan.ts +54 -0
- package/src/wire/codex.ts +60 -0
- package/src/wire/coreweave.ts +51 -0
- package/src/wire/gemini-headers.ts +74 -0
- package/src/wire/github-copilot.ts +115 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Api, FetchImpl, ModelSpec, Provider } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal OpenAI-style model entry shape consumed by discovery.
|
|
4
|
+
*
|
|
5
|
+
* Providers may return additional fields; this type only captures
|
|
6
|
+
* fields that are useful for generic normalization.
|
|
7
|
+
*/
|
|
8
|
+
export interface OpenAICompatibleModelRecord {
|
|
9
|
+
id?: unknown;
|
|
10
|
+
name?: unknown;
|
|
11
|
+
object?: unknown;
|
|
12
|
+
owned_by?: unknown;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Tolerant envelope for OpenAI-compatible `/models` responses.
|
|
17
|
+
*
|
|
18
|
+
* Common providers return `{ data: [...] }`, but variants such as
|
|
19
|
+
* `{ models: [...] }`, `{ result: [...] }`, or direct arrays are also
|
|
20
|
+
* accepted during extraction.
|
|
21
|
+
*/
|
|
22
|
+
export interface OpenAICompatibleModelsEnvelope {
|
|
23
|
+
data?: unknown;
|
|
24
|
+
models?: unknown;
|
|
25
|
+
result?: unknown;
|
|
26
|
+
items?: unknown;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Context passed to custom OpenAI-compatible model mappers.
|
|
31
|
+
*/
|
|
32
|
+
export interface OpenAICompatibleModelMapperContext<TApi extends Api> {
|
|
33
|
+
api: TApi;
|
|
34
|
+
provider: Provider;
|
|
35
|
+
baseUrl: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Options for fetching and normalizing OpenAI-compatible `/models` catalogs.
|
|
39
|
+
*/
|
|
40
|
+
export interface FetchOpenAICompatibleModelsOptions<TApi extends Api> {
|
|
41
|
+
/** API type assigned to normalized models. */
|
|
42
|
+
api: TApi;
|
|
43
|
+
/** Provider id assigned to normalized models. */
|
|
44
|
+
provider: Provider;
|
|
45
|
+
/** Provider base URL used for both fetch and normalized model records. */
|
|
46
|
+
baseUrl: string;
|
|
47
|
+
/** Optional bearer token for Authorization header. */
|
|
48
|
+
apiKey?: string;
|
|
49
|
+
/** Additional request headers. */
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
/** Optional AbortSignal for request cancellation; caller owns its lifecycle. */
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
/** Optional cancellable request timeout used when `signal` is omitted. */
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
/** Optional fetch implementation override for testing/custom runtimes. */
|
|
56
|
+
fetch?: FetchImpl;
|
|
57
|
+
/**
|
|
58
|
+
* Optional post-normalization filter.
|
|
59
|
+
* Return false to skip a model.
|
|
60
|
+
*/
|
|
61
|
+
filterModel?: (entry: OpenAICompatibleModelRecord, model: ModelSpec<TApi>) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Optional mapper override for provider-specific quirks.
|
|
64
|
+
* Return null to skip a model.
|
|
65
|
+
*/
|
|
66
|
+
mapModel?: (entry: OpenAICompatibleModelRecord, defaults: ModelSpec<TApi>, context: OpenAICompatibleModelMapperContext<TApi>) => ModelSpec<TApi> | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Fetches and normalizes an OpenAI-compatible `/models` catalog.
|
|
70
|
+
*
|
|
71
|
+
* Returns `null` on transport/protocol failures.
|
|
72
|
+
* Returns `[]` only when the endpoint responds successfully with no usable models.
|
|
73
|
+
*/
|
|
74
|
+
export declare function fetchOpenAICompatibleModels<TApi extends Api>(options: FetchOpenAICompatibleModelsOptions<TApi>): Promise<ModelSpec<TApi>[] | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** User-facing thinking levels, ordered least to most intensive. */
|
|
2
|
+
export declare const enum Effort {
|
|
3
|
+
Minimal = "minimal",
|
|
4
|
+
Low = "low",
|
|
5
|
+
Medium = "medium",
|
|
6
|
+
High = "high",
|
|
7
|
+
XHigh = "xhigh",
|
|
8
|
+
Max = "max"
|
|
9
|
+
}
|
|
10
|
+
export declare const THINKING_EFFORTS: readonly Effort[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function toFireworksPublicModelId(modelId: string): string;
|
|
2
|
+
export declare function toFireworksWireModelId(modelId: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Fire Pass exposes its Kimi K2.6 Turbo subscription through a dedicated router
|
|
5
|
+
* endpoint at `accounts/fireworks/routers/<id>` rather than the `models/` namespace.
|
|
6
|
+
* We keep a friendly public id (e.g. `kimi-k2.6-turbo`) in the catalog and translate
|
|
7
|
+
* to the wire form (`accounts/fireworks/routers/kimi-k2p6-turbo`) at request time.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toFirepassPublicModelId(modelId: string): string;
|
|
10
|
+
export declare function toFirepassWireModelId(modelId: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Public-id suffix marking a Fireworks "Fast" serving-path variant. Fast is a
|
|
13
|
+
* higher-throughput route (100+ tok/s) exposed under a dedicated router id
|
|
14
|
+
* (`accounts/fireworks/routers/<id>-fast`), not a separate model — same weights,
|
|
15
|
+
* higher price, no Priority tier. We keep a friendly `<id>-fast` public id and
|
|
16
|
+
* translate it to the router wire form at request time (compat
|
|
17
|
+
* `wireModelIdMode: "firepass"`). See https://docs.fireworks.ai/serverless/serving-paths.
|
|
18
|
+
*/
|
|
19
|
+
export declare const FIREWORKS_FAST_SUFFIX = "-fast";
|
|
20
|
+
/** True for a Fireworks public model id that selects the Fast serving path. */
|
|
21
|
+
export declare function isFireworksFastModelId(modelId: string): boolean;
|
|
22
|
+
/** Strip the Fast suffix to recover the base (Standard-tier) model id. */
|
|
23
|
+
export declare function toFireworksBaseModelId(modelId: string): string;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Known model-endpoint host classification — the single vocabulary for the
|
|
3
|
+
* `provider === id || baseUrl.includes(marker)` idiom that gates wire-level
|
|
4
|
+
* behavior (compat detection, routing, header shaping, watchdog floors).
|
|
5
|
+
*
|
|
6
|
+
* Markers are case-insensitive substrings matched against the base URL, NOT
|
|
7
|
+
* parsed hostnames: proxies regularly embed the upstream host in a path
|
|
8
|
+
* segment, and the historical call sites all used substring semantics.
|
|
9
|
+
* Callers that need strict hostname matching — where a substring false
|
|
10
|
+
* positive is dangerous, e.g. the Anthropic official-endpoint OAuth gate —
|
|
11
|
+
* parse the URL and compare the hostname themselves.
|
|
12
|
+
*/
|
|
13
|
+
export declare const KNOWN_HOSTS: {
|
|
14
|
+
readonly openai: {
|
|
15
|
+
readonly providers: readonly ["openai"];
|
|
16
|
+
readonly urlMarkers: readonly ["api.openai.com"];
|
|
17
|
+
};
|
|
18
|
+
readonly azureOpenAI: {
|
|
19
|
+
readonly providers: readonly ["azure"];
|
|
20
|
+
readonly urlMarkers: readonly [".openai.azure.com", "azure.com/openai", "models.inference.ai.azure.com"];
|
|
21
|
+
};
|
|
22
|
+
readonly openrouter: {
|
|
23
|
+
readonly providers: readonly ["openrouter"];
|
|
24
|
+
readonly urlMarkers: readonly ["openrouter.ai"];
|
|
25
|
+
};
|
|
26
|
+
readonly vercelAIGateway: {
|
|
27
|
+
readonly providers: readonly ["vercel-ai-gateway"];
|
|
28
|
+
readonly urlMarkers: readonly ["ai-gateway.vercel.sh"];
|
|
29
|
+
};
|
|
30
|
+
readonly githubCopilot: {
|
|
31
|
+
readonly providers: readonly ["github-copilot"];
|
|
32
|
+
readonly urlMarkers: readonly ["githubcopilot.com", "copilot-api."];
|
|
33
|
+
};
|
|
34
|
+
readonly anthropic: {
|
|
35
|
+
readonly providers: readonly ["anthropic"];
|
|
36
|
+
readonly urlMarkers: readonly ["api.anthropic.com"];
|
|
37
|
+
};
|
|
38
|
+
/** DeepSeek's first-party API only — gates direct-API quirks (max_tokens field, thinking extraBody). */
|
|
39
|
+
readonly deepseekDirect: {
|
|
40
|
+
readonly providers: readonly ["deepseek"];
|
|
41
|
+
readonly urlMarkers: readonly ["api.deepseek.com"];
|
|
42
|
+
};
|
|
43
|
+
/** Any DeepSeek-operated host (first-party API, web-chat fronts). Wider than `deepseekDirect` on purpose. */
|
|
44
|
+
readonly deepseekFamily: {
|
|
45
|
+
readonly providers: readonly ["deepseek"];
|
|
46
|
+
readonly urlMarkers: readonly ["deepseek.com"];
|
|
47
|
+
};
|
|
48
|
+
readonly cerebras: {
|
|
49
|
+
readonly providers: readonly ["cerebras"];
|
|
50
|
+
readonly urlMarkers: readonly ["cerebras.ai"];
|
|
51
|
+
};
|
|
52
|
+
readonly zai: {
|
|
53
|
+
readonly providers: readonly ["zai"];
|
|
54
|
+
readonly urlMarkers: readonly ["api.z.ai"];
|
|
55
|
+
};
|
|
56
|
+
readonly zhipu: {
|
|
57
|
+
readonly providers: readonly ["zhipu-coding-plan"];
|
|
58
|
+
readonly urlMarkers: readonly ["open.bigmodel.cn"];
|
|
59
|
+
};
|
|
60
|
+
readonly kilo: {
|
|
61
|
+
readonly providers: readonly ["kilo"];
|
|
62
|
+
readonly urlMarkers: readonly ["api.kilo.ai"];
|
|
63
|
+
};
|
|
64
|
+
readonly alibabaDashscope: {
|
|
65
|
+
readonly providers: readonly ["alibaba-coding-plan", "alibaba-token-plan"];
|
|
66
|
+
readonly urlMarkers: readonly ["dashscope", "token-plan."];
|
|
67
|
+
};
|
|
68
|
+
readonly umans: {
|
|
69
|
+
readonly providers: readonly ["umans"];
|
|
70
|
+
readonly urlMarkers: readonly ["api.code.umans.ai"];
|
|
71
|
+
};
|
|
72
|
+
readonly xiaomi: {
|
|
73
|
+
readonly providers: readonly ["xiaomi"];
|
|
74
|
+
readonly providerPrefixes: readonly ["xiaomi-token-plan-"];
|
|
75
|
+
readonly urlMarkers: readonly ["xiaomimimo.com"];
|
|
76
|
+
};
|
|
77
|
+
readonly xai: {
|
|
78
|
+
readonly providers: readonly ["xai"];
|
|
79
|
+
readonly urlMarkers: readonly ["api.x.ai"];
|
|
80
|
+
};
|
|
81
|
+
readonly mistral: {
|
|
82
|
+
readonly providers: readonly ["mistral"];
|
|
83
|
+
readonly urlMarkers: readonly ["mistral.ai"];
|
|
84
|
+
};
|
|
85
|
+
readonly together: {
|
|
86
|
+
readonly providers: readonly ["together"];
|
|
87
|
+
readonly urlMarkers: readonly ["api.together.xyz"];
|
|
88
|
+
};
|
|
89
|
+
readonly baseten: {
|
|
90
|
+
readonly providers: readonly ["baseten"];
|
|
91
|
+
readonly urlMarkers: readonly ["baseten.co"];
|
|
92
|
+
};
|
|
93
|
+
/** URL-only on purpose: the `fireworks`/`firepass` providers route per-model and not every model is Fireworks-shaped. */
|
|
94
|
+
readonly fireworks: {
|
|
95
|
+
readonly urlMarkers: readonly ["fireworks.ai"];
|
|
96
|
+
};
|
|
97
|
+
readonly groq: {
|
|
98
|
+
readonly providers: readonly ["groq"];
|
|
99
|
+
readonly urlMarkers: readonly ["api.groq.com"];
|
|
100
|
+
};
|
|
101
|
+
readonly minimax: {
|
|
102
|
+
readonly providers: readonly ["minimax", "minimax-code", "minimax-code-cn"];
|
|
103
|
+
readonly urlMarkers: readonly ["api.minimax.io", "api.minimaxi.com"];
|
|
104
|
+
};
|
|
105
|
+
readonly qwenPortal: {
|
|
106
|
+
readonly providers: readonly ["qwen-portal"];
|
|
107
|
+
readonly urlMarkers: readonly ["portal.qwen.ai"];
|
|
108
|
+
};
|
|
109
|
+
/** NVIDIA NIM (`integrate.api.nvidia.com`). Qwen NIM endpoints take `chat_template_kwargs.enable_thinking`, never top-level `enable_thinking`. */
|
|
110
|
+
readonly nvidia: {
|
|
111
|
+
readonly providers: readonly ["nvidia"];
|
|
112
|
+
readonly urlMarkers: readonly ["integrate.api.nvidia.com"];
|
|
113
|
+
};
|
|
114
|
+
readonly moonshotNative: {
|
|
115
|
+
readonly providers: readonly ["moonshot", "kimi-code"];
|
|
116
|
+
readonly urlMarkers: readonly ["api.moonshot.ai", "api.kimi.com"];
|
|
117
|
+
};
|
|
118
|
+
/** Google AI Studio's OpenAI-compatible shim (`/v1beta/openai`) — a subset of chat-completions; rejects `store` with a 400. Native Gemini uses `google-generative-ai` api instead. */
|
|
119
|
+
readonly googleAistudio: {
|
|
120
|
+
readonly providers: readonly [];
|
|
121
|
+
readonly urlMarkers: readonly ["generativelanguage.googleapis.com"];
|
|
122
|
+
};
|
|
123
|
+
readonly opencode: {
|
|
124
|
+
readonly providers: readonly ["opencode-go", "opencode-zen"];
|
|
125
|
+
readonly urlMarkers: readonly ["opencode.ai"];
|
|
126
|
+
};
|
|
127
|
+
/** ZenMux's Anthropic-compatible proxy (`zenmux.ai/api/anthropic`) forwards to signature-enforcing Anthropic. */
|
|
128
|
+
readonly zenmux: {
|
|
129
|
+
readonly providers: readonly ["zenmux"];
|
|
130
|
+
readonly urlMarkers: readonly ["zenmux.ai"];
|
|
131
|
+
};
|
|
132
|
+
readonly chutes: {
|
|
133
|
+
readonly urlMarkers: readonly ["chutes.ai"];
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export type KnownHost = keyof typeof KNOWN_HOSTS;
|
|
137
|
+
/** URL-only host check (for call sites that have no provider id, e.g. raw env config). */
|
|
138
|
+
export declare function hostMatchesUrl(baseUrl: string | undefined, host: KnownHost): boolean;
|
|
139
|
+
/** Provider-or-URL host check — the canonical `provider === id || baseUrl.includes(marker)` idiom. */
|
|
140
|
+
export declare function modelMatchesHost(model: {
|
|
141
|
+
provider: string;
|
|
142
|
+
baseUrl: string;
|
|
143
|
+
}, host: KnownHost): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Hostname for a Vertex AI GenerateContent / rawPredict / OpenAI-compat
|
|
146
|
+
* request for the given location.
|
|
147
|
+
*
|
|
148
|
+
* - `global` → global endpoint (`aiplatform.googleapis.com`)
|
|
149
|
+
* - `eu` / `us` multi-regions → REP endpoints (`aiplatform.{eu|us}.rep.googleapis.com`)
|
|
150
|
+
* - every other location → regional (`{location}-aiplatform.googleapis.com`)
|
|
151
|
+
*
|
|
152
|
+
* Multi-region codes do NOT follow the regional `{location}-aiplatform` pattern;
|
|
153
|
+
* interpolating them that way yields hosts like `eu-aiplatform.googleapis.com`
|
|
154
|
+
* that 404.
|
|
155
|
+
*/
|
|
156
|
+
export declare function resolveVertexEndpointHost(location: string): string;
|
|
157
|
+
/** Vertex AI express-mode OpenAI-compatible endpoint (`…/endpoints/openapi`). */
|
|
158
|
+
export declare function isVertexExpressOpenAIUrl(baseUrl: string): boolean;
|
|
159
|
+
/** Vertex AI Anthropic raw-predict endpoints (`:streamRawPredict` / `:rawPredict`). */
|
|
160
|
+
export declare function isVertexRawPredictUrl(baseUrl: string): boolean;
|
|
161
|
+
/** Azure OpenAI deployment-scoped path (`…/deployments/<name>/…`). */
|
|
162
|
+
export declare function isAzureDeploymentsUrl(baseUrl: string): boolean;
|
|
163
|
+
/** Alibaba DashScope consumer `compatible-mode` endpoint (rejects multimodal arrays for some text-only SKUs). */
|
|
164
|
+
export declare function isDashscopeCompatibleModeUrl(baseUrl: string): boolean;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-id classification: parse a model id into its family (gemini / anthropic /
|
|
3
|
+
* openai), kind/variant, and version. This is the shared layer both catalog
|
|
4
|
+
* policy rules (`model-thinking.ts`) and downstream consumers build on —
|
|
5
|
+
* classification lives here, the rules that consume it stay with their domain.
|
|
6
|
+
*/
|
|
7
|
+
export type SemVer = {
|
|
8
|
+
major: number;
|
|
9
|
+
minor: number;
|
|
10
|
+
patch: number;
|
|
11
|
+
};
|
|
12
|
+
export type GeminiKind = "pro" | "flash";
|
|
13
|
+
export type AnthropicKind = "opus" | "sonnet" | "fable" | "mythos";
|
|
14
|
+
export type OpenAIVariant = "base" | "codex" | "codex-max" | "codex-mini" | "codex-spark" | "mini" | "max" | "nano";
|
|
15
|
+
export type GlmVariant = "base" | "air" | "turbo" | "flash" | "flashx" | "preview";
|
|
16
|
+
export interface GeminiModel {
|
|
17
|
+
family: "gemini";
|
|
18
|
+
kind: GeminiKind;
|
|
19
|
+
version: SemVer;
|
|
20
|
+
}
|
|
21
|
+
export interface AnthropicModel {
|
|
22
|
+
family: "anthropic";
|
|
23
|
+
kind: AnthropicKind;
|
|
24
|
+
version: SemVer;
|
|
25
|
+
}
|
|
26
|
+
export interface OpenAIModel {
|
|
27
|
+
family: "openai";
|
|
28
|
+
variant: OpenAIVariant;
|
|
29
|
+
version: SemVer;
|
|
30
|
+
}
|
|
31
|
+
export interface GlmModel {
|
|
32
|
+
family: "glm";
|
|
33
|
+
/** Suffix variant (`-air`, `-turbo`, `-flash`, `-flashx`, `-preview`); `base` when none. */
|
|
34
|
+
variant: GlmVariant;
|
|
35
|
+
/** Vision SKU — the `v` that attaches directly to the version (`glm-4v`, `glm-4.5v`). */
|
|
36
|
+
vision: boolean;
|
|
37
|
+
version: SemVer;
|
|
38
|
+
}
|
|
39
|
+
export interface UnknownModel {
|
|
40
|
+
family: "unknown";
|
|
41
|
+
id: string;
|
|
42
|
+
}
|
|
43
|
+
export type ParsedModel = GeminiModel | AnthropicModel | OpenAIModel | UnknownModel;
|
|
44
|
+
export declare function bareModelId(modelId: string): string;
|
|
45
|
+
export declare function parseKnownModel(modelId: string): ParsedModel;
|
|
46
|
+
export declare const parseGeminiModel: (modelId: string) => GeminiModel | null;
|
|
47
|
+
export declare const parseAnthropicModel: (modelId: string) => AnthropicModel | null;
|
|
48
|
+
export declare const parseOpenAIModel: (modelId: string) => OpenAIModel | null;
|
|
49
|
+
/**
|
|
50
|
+
* Parse a GLM (Zhipu / Z.AI) model id into family + variant + vision + version.
|
|
51
|
+
* Shape: `glm-<version>[v][-<variant>]` — e.g. `glm-4.5`, `glm-4.5-air`,
|
|
52
|
+
* `glm-5-turbo`, `glm-4.5v`, `glm-5-preview`. The `v` (vision) attaches to the
|
|
53
|
+
* version; other variants are `-` suffixes. Standalone like `parseAnthropicModel`
|
|
54
|
+
* is used in family.ts — GLM needs no global thinking policy, so it stays out of
|
|
55
|
+
* `parseKnownModel`.
|
|
56
|
+
*/
|
|
57
|
+
export declare const parseGlmModel: (modelId: string) => GlmModel | null;
|
|
58
|
+
export declare function isFableOrMythos(kind: AnthropicKind): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Returns true if the parsed Anthropic model is part of the adaptive-thinking
|
|
61
|
+
* Claude generation at or above a specific capability threshold.
|
|
62
|
+
* - Opus has a configurable minimum version floor (e.g. "4.6", "4.7", "4.8").
|
|
63
|
+
* - Sonnet, Fable, and Mythos all require version 5 or higher.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isAnthropicAdaptiveGenAtLeast(parsed: AnthropicModel, opusMin: "4.6" | "4.7" | "4.8"): boolean;
|
|
66
|
+
export declare function parseSemVer(version: string): SemVer | null;
|
|
67
|
+
export declare function semverGte(left: SemVer | string, right: SemVer | string): boolean;
|
|
68
|
+
export declare function semverEqual(left: SemVer | string, right: SemVer | string): boolean;
|
|
69
|
+
export declare function compareSemVer(left: SemVer | string | null, right: SemVer | string | null): number;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-family id predicates: the shared vocabulary for "is this id a member
|
|
3
|
+
* of family X" checks that gate wire-level behavior across hosts (a Kimi or
|
|
4
|
+
* DeepSeek model keeps its quirks no matter which OpenAI-compatible proxy
|
|
5
|
+
* serves it). Looser per-feature heuristics (e.g. stream-markup healing)
|
|
6
|
+
* deliberately keep their own patterns — only provably-shared matchers live
|
|
7
|
+
* here.
|
|
8
|
+
*/
|
|
9
|
+
/** Kimi family ids in any namespace form (`moonshotai/kimi-*`, `kimi-k2.6`, `vendor/kimi.x`). */
|
|
10
|
+
export declare const isKimiModelId: (modelId: string) => boolean;
|
|
11
|
+
/** Kimi K2.6 specifically, including router ids that spell the version `k2p6`. */
|
|
12
|
+
export declare const isKimiK26ModelId: (modelId: string) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Kimi K3 in any namespace form (`kimi-k3`, `kimi-k3.1`, `kimi-k3-turbo`,
|
|
15
|
+
* `moonshotai/kimi-k3`). K3 always reasons and drives thinking via OpenAI-style
|
|
16
|
+
* `reasoning_effort: "max"`, not the K2.x binary `thinking: { type }` block —
|
|
17
|
+
* see the moonshot discovery mapper and `buildOpenAICompat`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isKimiK3ModelId: (modelId: string) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Claude ids in any namespace form: bare (`claude-*`), path-namespaced
|
|
22
|
+
* (`anthropic/claude.x`), or dot-prefixed (`us.anthropic.claude-…`,
|
|
23
|
+
* `global.anthropic.claude-…`, `au.anthropic.claude-…` — Bedrock cross-region
|
|
24
|
+
* inference profiles). Necessary because {@link parseAnthropicModel} only
|
|
25
|
+
* classifies kinds enumerated in its regex, so any dotted profile whose kind
|
|
26
|
+
* (e.g. `haiku`) is not enumerated would otherwise slip past this fallback.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isClaudeModelId: (modelId: string) => boolean;
|
|
29
|
+
/** `anthropic/`-namespaced ids (aggregator catalogs like OpenRouter). */
|
|
30
|
+
export declare const isAnthropicNamespacedModelId: (modelId: string) => boolean;
|
|
31
|
+
/** Qwen family ids (substring match — Qwen SKUs have no stable prefix shape). */
|
|
32
|
+
export declare const isQwenModelId: (modelId: string) => boolean;
|
|
33
|
+
/** Gemma open-weights family (`gemma-3-27b-it`, `google/gemma-4-E2B-it`, `gemma2-9b`). */
|
|
34
|
+
export declare const isGemmaModelId: (modelId: string) => boolean;
|
|
35
|
+
/** DeepSeek family by id or display name (proxies often rename the id but keep the name). */
|
|
36
|
+
export declare const isDeepseekModelIdOrName: (modelId: string) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* DeepSeek V4 Flash SKU in any host/namespace form (`deepseek-v4-flash`, dated
|
|
39
|
+
* `deepseek-v4-flash-0731`, `deepseek-ai/DeepSeek-V4-Flash`). Flash is the only
|
|
40
|
+
* V4 model whose `reasoning_effort` accepts the `low` tier; V4 Pro tops out at
|
|
41
|
+
* `high`/`max`. See https://api-docs.deepseek.com/api/create-chat-completion.
|
|
42
|
+
*/
|
|
43
|
+
export declare const isDeepseekV4FlashModelId: (modelId: string) => boolean;
|
|
44
|
+
/** Xiaomi MiMo family by id or display name. */
|
|
45
|
+
export declare const isMimoModelIdOrName: (modelId: string) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Grok SKUs that expose the wire `reasoning.effort` dial. Other Grok reasoners
|
|
48
|
+
* (e.g. `grok-build`, `grok-4.20-0309-reasoning`) think natively but reject the
|
|
49
|
+
* param, so callers must omit reasoning effort for them.
|
|
50
|
+
*/
|
|
51
|
+
export declare const isGrokReasoningEffortCapable: (modelId: string) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* MiniMax M2-generation family (M2, M2.1, M2.5, M2.7, including `-highspeed`/
|
|
54
|
+
* `-lightning`/`-her`/`-turbo` variants, dotless aliases like `minimax-m21`,
|
|
55
|
+
* and short `minimax/m2-…` ids on aggregator hosts). Underlying model accepts
|
|
56
|
+
* only `low|medium|high` for `reasoning_effort` and 400s on `minimal`,
|
|
57
|
+
* `xhigh`, or `none` — so hosts whose default effort map otherwise lowers
|
|
58
|
+
* `minimal` to `none` (Fireworks) or expects the full 5-tier scale must
|
|
59
|
+
* clamp instead. Excludes M1, M3, MiniMax-Text-01, music, hailuo, voice ids.
|
|
60
|
+
*/
|
|
61
|
+
export declare const isMinimaxM2FamilyModelId: (modelId: string) => boolean;
|
|
62
|
+
/** MiniMax M3 family ids in bundled/default and aggregator namespace forms. */
|
|
63
|
+
export declare const isMinimaxM3FamilyModelId: (modelId: string) => boolean;
|
|
64
|
+
/**
|
|
65
|
+
* OpenAI gpt-oss family (`gpt-oss-20b`, `gpt-oss-120b`, `gpt-oss:120b`,
|
|
66
|
+
* `vendor/gpt-oss-…`). The Harmony reasoning format only accepts
|
|
67
|
+
* `low|medium|high` for `reasoning_effort` and rejects `minimal`, `xhigh`,
|
|
68
|
+
* and `none`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const isOpenAIGptOssModelId: (modelId: string) => boolean;
|
|
71
|
+
/** OpenAI model ids (gpt-*, chatgpt-*, o1/o3/o4 SKUs, codex-*, or openai/*). */
|
|
72
|
+
export declare const isOpenAIModelId: (modelId: string) => boolean;
|
|
73
|
+
/**
|
|
74
|
+
* OpenAI Codex models that honor `reasoning.context: "all_turns"` (full
|
|
75
|
+
* cross-turn reasoning replay). The `reasoning.context` field itself exists for
|
|
76
|
+
* the whole gpt-5/o-series family, but the `all_turns` value is only accepted
|
|
77
|
+
* from gpt-5.4 onward; earlier ids (`gpt-5.1-codex`, `gpt-5.3-codex`, and
|
|
78
|
+
* `gpt-5.3-codex-spark`) reject it with
|
|
79
|
+
* `Unsupported value: 'all_turns' is not supported with this model`. Version
|
|
80
|
+
* floor (not an allowlist) so 5.6/6.x inherit support automatically. Callers
|
|
81
|
+
* fall back to omitting `context`, letting the server default to `current_turn`.
|
|
82
|
+
*/
|
|
83
|
+
export declare const supportsAllTurnsReasoningContext: (modelId: string) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* OpenAI Codex models that accept `reasoning.summary`. Shares the gpt-5.4 wire
|
|
86
|
+
* floor with {@link supportsAllTurnsReasoningContext}: earlier Codex ids
|
|
87
|
+
* (`gpt-5.1-codex`, `gpt-5.3-codex`, `gpt-5.3-codex-spark`) reject the field
|
|
88
|
+
* with `Unsupported parameter: 'reasoning.summary' is not supported with this
|
|
89
|
+
* model`. Callers omit `summary` for unsupported ids, letting the server skip
|
|
90
|
+
* the human-readable summary stream.
|
|
91
|
+
*/
|
|
92
|
+
export declare const supportsCodexReasoningSummary: (modelId: string) => boolean;
|
|
93
|
+
/**
|
|
94
|
+
* OpenAI proprietary models whose serving path rejects explicit sampling
|
|
95
|
+
* parameters (`temperature`, `top_p`, `top_k`, …) with
|
|
96
|
+
* `400 Unsupported parameter: 'temperature' is not supported with this model`.
|
|
97
|
+
* Covers the o-series and the entire gpt-5+ generation — base, `mini`, `nano`,
|
|
98
|
+
* `codex*`, the `luna`/`sol`/`terra` SKUs, and the `-chat-latest` variants,
|
|
99
|
+
* since even the non-reasoning gpt-5 chat models reject sampling params (see
|
|
100
|
+
* litellm#13781). Holds regardless of which OpenAI-serving host proxies the
|
|
101
|
+
* model (official, Azure, GitHub Copilot). Version floor (not an allowlist) so
|
|
102
|
+
* 6.x inherits automatically. Issue #5606.
|
|
103
|
+
*/
|
|
104
|
+
export declare const isOpenAISamplingRestrictedModelId: (modelId: string) => boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Reasoning-capable GLM coding SKUs: glm-4.5 and up on the base / `-air` /
|
|
107
|
+
* `-turbo` lines. Excludes the vision (`…v`) shape, the non-reasoning
|
|
108
|
+
* `-flash`/`-flashx`/`-preview` variants, and pre-4.5 ids. Matching the family
|
|
109
|
+
* keeps newly-bumped integers (`glm-5.3`, `glm-6`, …) covered without a per-id
|
|
110
|
+
* allowlist.
|
|
111
|
+
*/
|
|
112
|
+
export declare const isReasoningGlmModelId: (modelId: string) => boolean;
|
|
113
|
+
/** GLM-5.2+ coding SKUs accept `reasoning_effort` in addition to binary thinking. */
|
|
114
|
+
export declare const isGlm52ReasoningEffortModelId: (modelId: string) => boolean;
|
|
115
|
+
/** GLM vision SKUs — the `v` that attaches to the version (`glm-4v`, `glm-4.5v`). */
|
|
116
|
+
export declare const isGlmVisionModelId: (modelId: string) => boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Coarse vendor-lineage token for "are two models the same family?" checks
|
|
119
|
+
* (e.g. picking a cross-family reviewer). All Claude point releases share a token,
|
|
120
|
+
* Claude and GPT differ; namespace prefixes and aggregator mirrors fold onto the
|
|
121
|
+
* lineage via {@link parseKnownModel}'s `bareModelId` normalization. Opaque and
|
|
122
|
+
* comparison-only — not a stable key to persist, since the vocabulary tracks new
|
|
123
|
+
* releases. Returns `""` for ids it cannot classify; callers fall back to the provider.
|
|
124
|
+
*
|
|
125
|
+
* Vendor-only by design: a model's kind/variant (opus vs sonnet, codex vs base) is
|
|
126
|
+
* collapsed onto the single vendor token; use {@link parseKnownModel} for finer breakdowns.
|
|
127
|
+
*/
|
|
128
|
+
export declare const modelFamilyToken: (modelId: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* True for Claude generations that support extended thinking: Sonnet/Opus 3.7+,
|
|
131
|
+
* every 4.x/5+ Opus/Sonnet, and the Fable/Mythos generation. Pre-thinking
|
|
132
|
+
* models (Claude 3.5 and older) are excluded so no thinking effort dial is
|
|
133
|
+
* fabricated for a model that rejects thinking parameters. Classifier-based, so
|
|
134
|
+
* dotted and dashed version forms both match; ids the classifier does not parse
|
|
135
|
+
* (e.g. Haiku, bare dated ids) return false.
|
|
136
|
+
*/
|
|
137
|
+
export declare const anthropicModelSupportsThinking: (modelId: string) => boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Adaptive thinking `display` is supported starting with Claude Opus 4.7+,
|
|
140
|
+
* Sonnet 5+, and the Claude Fable/Mythos 5 generation. Older adaptive-thinking
|
|
141
|
+
* models (Opus 4.6, Sonnet 4.6) reject the field. Classifier-based, so dotted
|
|
142
|
+
* and dashed version forms both match while bare dated ids
|
|
143
|
+
* (`claude-opus-4-20250514` = Opus 4.0) stay excluded.
|
|
144
|
+
*/
|
|
145
|
+
export declare const supportsAdaptiveThinkingDisplay: (modelId: string) => boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Returns true for Anthropic models with Opus 4.7+, Sonnet 5+, and Fable/Mythos 5+
|
|
148
|
+
* API restrictions:
|
|
149
|
+
* - Sampling parameters (temperature/top_p/top_k) return 400 error
|
|
150
|
+
* - Thinking content is omitted by default (needs display: "summarized")
|
|
151
|
+
*/
|
|
152
|
+
export declare const hasOpus47ApiRestrictions: (modelId: string) => boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Mid-conversation `role: "system"` messages (system instructions appended at
|
|
155
|
+
* non-first positions in the `messages` array) are supported starting with
|
|
156
|
+
* Claude Opus 4.8+, Sonnet 5+, and the Claude Fable/Mythos 5 generation.
|
|
157
|
+
* Earlier Claude models reject the role.
|
|
158
|
+
* @see https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages
|
|
159
|
+
*/
|
|
160
|
+
export declare const supportsMidConversationSystemMessages: (modelId: string) => boolean;
|
|
161
|
+
export declare const isAnthropicFableOrMythosModel: (modelId: string) => boolean;
|
|
162
|
+
/** Thinking-variant token location inside a model id. */
|
|
163
|
+
export interface ThinkingVariantToken {
|
|
164
|
+
index: number;
|
|
165
|
+
length: number;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Locates the first thinking-variant token (`-thinking`, `-reasoner`,
|
|
169
|
+
* `-reasoning`; trailing or infix) in a model id. The token ends at the id
|
|
170
|
+
* end or any non-alphanumeric boundary, and negated forms (`non-thinking`,
|
|
171
|
+
* `no-thinking`) never match — those name the NON-thinking SKU.
|
|
172
|
+
*/
|
|
173
|
+
export declare function findThinkingVariantToken(modelId: string): ThinkingVariantToken | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Removes the located thinking-variant token: `kimi-k2-thinking` → `kimi-k2`,
|
|
176
|
+
* `mimo-v2-flash-thinking-original` → `mimo-v2-flash-original`,
|
|
177
|
+
* `grok-4.1-fast-reasoning` → `grok-4.1-fast`. Returns `undefined` when no
|
|
178
|
+
* token exists or nothing would remain. Callers MUST verify the result names
|
|
179
|
+
* a live model.
|
|
180
|
+
*/
|
|
181
|
+
export declare const stripThinkingVariantToken: (modelId: string) => string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function getModelLikeIdSegments(modelId: string): string[];
|
|
2
|
+
export declare function getLongestModelLikeIdSegment(modelId: string): string | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Strip reseller / wrapper tags that are injected as bracketed affixes around an
|
|
5
|
+
* upstream model id, e.g.
|
|
6
|
+
* "[Kiro] claude-opus-4-8" -> "claude-opus-4-8"
|
|
7
|
+
* "[gcli转] gemini-3.1-pro-preview [假流]" -> "gemini-3.1-pro-preview"
|
|
8
|
+
*
|
|
9
|
+
* Candidates are returned most-stripped first: both ends, then leading-only, then trailing-only.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getBracketStrippedModelIdCandidates(modelId: string): string[];
|
|
12
|
+
export declare function stripBracketedModelIdAffixes(modelId: string): string | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Marker pattern used by canonical-id resolution (`search` excluded). */
|
|
2
|
+
export declare const CANONICAL_TRAILING_MARKER_PATTERN: RegExp;
|
|
3
|
+
/** Marker pattern used by proxy-reference lookup (`search` included). */
|
|
4
|
+
export declare const REFERENCE_TRAILING_MARKER_PATTERN: RegExp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildModelProviderPriorityRank(configuredProviderOrder?: readonly string[]): Map<string, number>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxy/reseller reference lookup: given a custom model id served through a
|
|
3
|
+
* proxy (`[Kiro] claude-opus-4-8`, `gpt-5.4:cloud`, `vendor/claude-sonnet-4-6-thinking`),
|
|
4
|
+
* find the bundled upstream model so missing pricing/capability metadata can be
|
|
5
|
+
* inherited while keeping the custom transport.
|
|
6
|
+
*
|
|
7
|
+
* Kept separate from canonical-id resolution (`./equivalence`): this lookup
|
|
8
|
+
* may strip `search`-style markers and prefers cache-pricing-complete
|
|
9
|
+
* references, both of which would be wrong for canonical coalescing.
|
|
10
|
+
*/
|
|
11
|
+
import type { Api, Model, ThinkingConfig } from "../types.js";
|
|
12
|
+
export interface ModelReferenceIndex {
|
|
13
|
+
exact: Map<string, Model<Api>>;
|
|
14
|
+
suffixAlias: Map<string, Model<Api>>;
|
|
15
|
+
}
|
|
16
|
+
export declare function isZeroCostXaiOAuthReference(candidate: Model<Api>): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Build a reference index from a model catalog (typically the bundled models).
|
|
19
|
+
* Pure: callers are responsible for memoizing the result.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildModelReferenceIndex(models: Iterable<Model<Api>>): ModelReferenceIndex;
|
|
22
|
+
/**
|
|
23
|
+
* Inherit bundled reference thinking only for same-provider matches. Wire routing
|
|
24
|
+
* (`effortRouting`) is provider-specific; cross-provider inheritance can rewrite
|
|
25
|
+
* gateway ids (e.g. Portkey `@modal/GLM-5-2-FP8` → devin `glm-5-2`).
|
|
26
|
+
*/
|
|
27
|
+
export declare function inheritReferenceThinking(modelThinking: ThinkingConfig | undefined, reference: Pick<Model<Api>, "provider" | "thinking"> | undefined, provider: string): ThinkingConfig | undefined;
|
|
28
|
+
/** Resolve a (possibly proxied/affixed) model id to its bundled upstream reference. */
|
|
29
|
+
export declare function resolveModelReference(modelId: string, index: ModelReferenceIndex): Model<Api> | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./compat/openai.js";
|
|
2
|
+
export * from "./discovery/index.js";
|
|
3
|
+
export * from "./effort.js";
|
|
4
|
+
export * from "./fireworks-model-id.js";
|
|
5
|
+
export * from "./identity/index.js";
|
|
6
|
+
export * from "./model-cache.js";
|
|
7
|
+
export * from "./model-manager.js";
|
|
8
|
+
export * from "./model-thinking.js";
|
|
9
|
+
export * from "./models.js";
|
|
10
|
+
export * from "./provider-models/index.js";
|
|
11
|
+
export * from "./types.js";
|
|
12
|
+
export * from "./utils.js";
|
|
13
|
+
export * from "./variant-collapse.js";
|
|
14
|
+
export * from "./wire/codex.js";
|
|
15
|
+
export * from "./wire/coreweave.js";
|
|
16
|
+
export * from "./wire/gemini-headers.js";
|
|
17
|
+
export * from "./wire/github-copilot.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Api, Model, ModelSpec } from "./types.js";
|
|
2
|
+
interface CacheEntry<TApi extends Api = Api> {
|
|
3
|
+
models: ModelSpec<TApi>[];
|
|
4
|
+
fresh: boolean;
|
|
5
|
+
authoritative: boolean;
|
|
6
|
+
updatedAt: number;
|
|
7
|
+
/** Model ids whose live headers were intentionally omitted from disk. */
|
|
8
|
+
headerOmittedModelIds: readonly string[];
|
|
9
|
+
/** Header-bearing model ids that cannot be rebuilt from the static source. */
|
|
10
|
+
unrestorableHeaderModelIds: readonly string[];
|
|
11
|
+
/** Whether unrestorable markers predate request-model header matching. */
|
|
12
|
+
legacyHeaderRestoreMarkers: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Hash of the static catalog slice that was merged into `models` when this
|
|
15
|
+
* row was written. `resolveProviderModels` compares against the current
|
|
16
|
+
* static fingerprint and bypasses the static+cache re-merge when they
|
|
17
|
+
* match — the cache already incorporates the same static state.
|
|
18
|
+
*/
|
|
19
|
+
staticFingerprint: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function readModelCache<TApi extends Api>(providerId: string, ttlMs: number, now: () => number, dbPath?: string): CacheEntry<TApi> | null;
|
|
22
|
+
export declare function writeModelCache<TApi extends Api>(providerId: string, updatedAt: number, models: Model<TApi>[], authoritative: boolean, staticFingerprint: string, dbPath?: string, staticHeaderSources?: readonly Model<TApi>[], restorableHeaderFallback?: Record<string, string>): void;
|
|
23
|
+
export {};
|