@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.
Files changed (143) hide show
  1. package/CHANGELOG.md +999 -0
  2. package/README.md +43 -0
  3. package/dist/types/build.d.ts +14 -0
  4. package/dist/types/compat/anthropic.d.ts +18 -0
  5. package/dist/types/compat/apply.d.ts +7 -0
  6. package/dist/types/compat/bedrock.d.ts +3 -0
  7. package/dist/types/compat/devin.d.ts +9 -0
  8. package/dist/types/compat/openai.d.ts +26 -0
  9. package/dist/types/discovery/antigravity.d.ts +70 -0
  10. package/dist/types/discovery/codex.d.ts +36 -0
  11. package/dist/types/discovery/cursor-gen/agent_pb.d.ts +16769 -0
  12. package/dist/types/discovery/cursor.d.ts +23 -0
  13. package/dist/types/discovery/devin-gen/buf/validate/validate_pb.d.ts +1715 -0
  14. package/dist/types/discovery/devin-gen/exa/analytics_pb/analytics_pb.d.ts +693 -0
  15. package/dist/types/discovery/devin-gen/exa/api_server_pb/api_server_pb.d.ts +9158 -0
  16. package/dist/types/discovery/devin-gen/exa/auth_pb/auth_pb.d.ts +52 -0
  17. package/dist/types/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.d.ts +276 -0
  18. package/dist/types/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.d.ts +78 -0
  19. package/dist/types/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.d.ts +999 -0
  20. package/dist/types/discovery/devin-gen/exa/chat_pb/chat_pb.d.ts +1704 -0
  21. package/dist/types/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.d.ts +656 -0
  22. package/dist/types/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.d.ts +15014 -0
  23. package/dist/types/discovery/devin-gen/exa/context_module_pb/context_module_pb.d.ts +607 -0
  24. package/dist/types/discovery/devin-gen/exa/cortex_pb/cortex_pb.d.ts +11830 -0
  25. package/dist/types/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.d.ts +248 -0
  26. package/dist/types/discovery/devin-gen/exa/index_pb/index_pb.d.ts +1747 -0
  27. package/dist/types/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.d.ts +509 -0
  28. package/dist/types/discovery/devin-gen/exa/language_server_pb/language_server_pb.d.ts +9048 -0
  29. package/dist/types/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.d.ts +1760 -0
  30. package/dist/types/discovery/devin-gen/exa/prompt_pb/prompt_pb.d.ts +286 -0
  31. package/dist/types/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.d.ts +405 -0
  32. package/dist/types/discovery/devin-gen/exa/trust_pb/trust_pb.d.ts +582 -0
  33. package/dist/types/discovery/devin.d.ts +24 -0
  34. package/dist/types/discovery/gemini.d.ts +25 -0
  35. package/dist/types/discovery/gitlab-duo-workflow.d.ts +30 -0
  36. package/dist/types/discovery/index.d.ts +5 -0
  37. package/dist/types/discovery/openai-compatible.d.ts +74 -0
  38. package/dist/types/effort.d.ts +10 -0
  39. package/dist/types/fireworks-model-id.d.ts +23 -0
  40. package/dist/types/hosts.d.ts +164 -0
  41. package/dist/types/identity/bundled.d.ts +3 -0
  42. package/dist/types/identity/classify.d.ts +69 -0
  43. package/dist/types/identity/dialect.d.ts +3 -0
  44. package/dist/types/identity/family.d.ts +181 -0
  45. package/dist/types/identity/id.d.ts +12 -0
  46. package/dist/types/identity/index.d.ts +8 -0
  47. package/dist/types/identity/markers.d.ts +4 -0
  48. package/dist/types/identity/priority.d.ts +1 -0
  49. package/dist/types/identity/reference.d.ts +29 -0
  50. package/dist/types/index.d.ts +17 -0
  51. package/dist/types/model-cache.d.ts +23 -0
  52. package/dist/types/model-manager.d.ts +77 -0
  53. package/dist/types/model-thinking.d.ts +66 -0
  54. package/dist/types/models.d.ts +12 -0
  55. package/dist/types/provider-models/bundled-references.d.ts +13 -0
  56. package/dist/types/provider-models/cache-provider-id.d.ts +9 -0
  57. package/dist/types/provider-models/descriptor-types.d.ts +76 -0
  58. package/dist/types/provider-models/descriptors.d.ts +504 -0
  59. package/dist/types/provider-models/google.d.ts +27 -0
  60. package/dist/types/provider-models/index.d.ts +7 -0
  61. package/dist/types/provider-models/ollama.d.ts +22 -0
  62. package/dist/types/provider-models/openai-compat.d.ts +599 -0
  63. package/dist/types/provider-models/special.d.ts +53 -0
  64. package/dist/types/types.d.ts +811 -0
  65. package/dist/types/utils.d.ts +20 -0
  66. package/dist/types/variant-collapse.d.ts +133 -0
  67. package/dist/types/wire/alibaba-token-plan.d.ts +22 -0
  68. package/dist/types/wire/codex.d.ts +42 -0
  69. package/dist/types/wire/coreweave.d.ts +12 -0
  70. package/dist/types/wire/gemini-headers.d.ts +37 -0
  71. package/dist/types/wire/github-copilot.d.ts +39 -0
  72. package/package.json +101 -0
  73. package/src/build.ts +94 -0
  74. package/src/compat/anthropic.ts +179 -0
  75. package/src/compat/apply.ts +15 -0
  76. package/src/compat/bedrock.ts +153 -0
  77. package/src/compat/devin.ts +12 -0
  78. package/src/compat/openai.ts +796 -0
  79. package/src/discovery/antigravity.ts +253 -0
  80. package/src/discovery/codex.ts +346 -0
  81. package/src/discovery/cursor-gen/agent_pb.ts +19513 -0
  82. package/src/discovery/cursor.ts +396 -0
  83. package/src/discovery/devin-gen/buf/validate/validate_pb.ts +1862 -0
  84. package/src/discovery/devin-gen/exa/analytics_pb/analytics_pb.ts +871 -0
  85. package/src/discovery/devin-gen/exa/api_server_pb/api_server_pb.ts +11083 -0
  86. package/src/discovery/devin-gen/exa/auth_pb/auth_pb.ts +71 -0
  87. package/src/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.ts +348 -0
  88. package/src/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.ts +103 -0
  89. package/src/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.ts +1198 -0
  90. package/src/discovery/devin-gen/exa/chat_pb/chat_pb.ts +2063 -0
  91. package/src/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.ts +810 -0
  92. package/src/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.ts +18354 -0
  93. package/src/discovery/devin-gen/exa/context_module_pb/context_module_pb.ts +732 -0
  94. package/src/discovery/devin-gen/exa/cortex_pb/cortex_pb.ts +14277 -0
  95. package/src/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.ts +312 -0
  96. package/src/discovery/devin-gen/exa/index_pb/index_pb.ts +2106 -0
  97. package/src/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.ts +623 -0
  98. package/src/discovery/devin-gen/exa/language_server_pb/language_server_pb.ts +10918 -0
  99. package/src/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.ts +2125 -0
  100. package/src/discovery/devin-gen/exa/prompt_pb/prompt_pb.ts +361 -0
  101. package/src/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.ts +450 -0
  102. package/src/discovery/devin-gen/exa/trust_pb/trust_pb.ts +712 -0
  103. package/src/discovery/devin.ts +151 -0
  104. package/src/discovery/gemini.ts +260 -0
  105. package/src/discovery/gitlab-duo-workflow.ts +859 -0
  106. package/src/discovery/index.ts +5 -0
  107. package/src/discovery/openai-compatible.ts +249 -0
  108. package/src/effort.ts +18 -0
  109. package/src/fireworks-model-id.ts +50 -0
  110. package/src/hosts.ts +155 -0
  111. package/src/identity/bundled.ts +28 -0
  112. package/src/identity/classify.ts +219 -0
  113. package/src/identity/dialect.ts +42 -0
  114. package/src/identity/family.ts +366 -0
  115. package/src/identity/id.ts +81 -0
  116. package/src/identity/index.ts +8 -0
  117. package/src/identity/markers.ts +49 -0
  118. package/src/identity/priority.ts +59 -0
  119. package/src/identity/reference.ts +167 -0
  120. package/src/index.ts +17 -0
  121. package/src/model-cache.ts +285 -0
  122. package/src/model-manager.ts +672 -0
  123. package/src/model-thinking.ts +821 -0
  124. package/src/models.json +106099 -0
  125. package/src/models.json.d.ts +9 -0
  126. package/src/models.ts +93 -0
  127. package/src/provider-models/bundled-references.ts +75 -0
  128. package/src/provider-models/cache-provider-id.ts +68 -0
  129. package/src/provider-models/descriptor-types.ts +85 -0
  130. package/src/provider-models/descriptors.ts +584 -0
  131. package/src/provider-models/google.ts +107 -0
  132. package/src/provider-models/index.ts +7 -0
  133. package/src/provider-models/ollama.ts +204 -0
  134. package/src/provider-models/openai-compat.ts +5991 -0
  135. package/src/provider-models/special.ts +213 -0
  136. package/src/types.ts +952 -0
  137. package/src/utils.ts +69 -0
  138. package/src/variant-collapse.ts +1225 -0
  139. package/src/wire/alibaba-token-plan.ts +54 -0
  140. package/src/wire/codex.ts +60 -0
  141. package/src/wire/coreweave.ts +51 -0
  142. package/src/wire/gemini-headers.ts +74 -0
  143. package/src/wire/github-copilot.ts +115 -0
@@ -0,0 +1,599 @@
1
+ import type { ModelManagerOptions } from "../model-manager.js";
2
+ import { getBundledModels } from "../models.js";
3
+ import type { Api, FetchImpl, ModelSpec, Provider } from "../types.js";
4
+ import { ALIBABA_TOKEN_PLAN_BASE_URL } from "../wire/alibaba-token-plan.js";
5
+ import type { ModelManagerConfig } from "./descriptor-types.js";
6
+ export interface ModelsDevModel {
7
+ id?: string;
8
+ name?: string;
9
+ tool_call?: boolean;
10
+ reasoning?: boolean;
11
+ limit?: {
12
+ context?: number;
13
+ output?: number;
14
+ };
15
+ cost?: {
16
+ input?: number;
17
+ output?: number;
18
+ cache_read?: number;
19
+ cache_write?: number;
20
+ };
21
+ modalities?: {
22
+ input?: string[];
23
+ };
24
+ status?: string;
25
+ provider?: {
26
+ npm?: string;
27
+ };
28
+ }
29
+ /**
30
+ * Fetches the models.dev catalog via catalog.stencil.so, which serves a
31
+ * field-pruned copy precompressed as a zstd blob (~93 KB vs ~3.3 MB raw).
32
+ * The frame magic is sniffed rather than trusting content-type so plain-JSON
33
+ * responses (test stubs, fallback mirrors) parse identically.
34
+ *
35
+ * Fetched fully once per process: concurrent callers share the in-flight
36
+ * request, repeat callers send a conditional GET that the server answers
37
+ * (and deliberately does not log) with `304`.
38
+ */
39
+ export declare function fetchWellKnownModels(fetchImpl?: FetchImpl, signal?: AbortSignal): Promise<unknown>;
40
+ /**
41
+ * Curated Anthropic models that are live or limited-availability on the
42
+ * first-party `/v1/models` endpoint but that models.dev has not catalogued yet.
43
+ * Seeded into model generation so the bundled catalog is never gated on
44
+ * models.dev's update cadence; deduped behind upstream catalog / models.dev
45
+ * entries once those appear. Token limits and pricing are pinned either directly or
46
+ * in `applyAnthropicCatalogPolicy`, and `thinking` is re-baked
47
+ * by the generator's policy pass (scripts/generated-policies.ts).
48
+ */
49
+ export declare const ANTHROPIC_CURATED_FALLBACK_MODELS: readonly ModelSpec<"anthropic-messages">[];
50
+ type SimpleProviderDiscoveryHeaders = Record<string, string> | (() => Record<string, string> | undefined);
51
+ type SimpleProviderConfig = {
52
+ apiKey?: string;
53
+ baseUrl?: string;
54
+ fetch?: FetchImpl;
55
+ headers?: SimpleProviderDiscoveryHeaders;
56
+ };
57
+ export declare function createSimpleOpenAICompletionsOptions(providerId: Parameters<typeof getBundledModels>[0], defaultBaseUrl: string, config?: SimpleProviderConfig): ModelManagerOptions<"openai-completions">;
58
+ export interface UmansModelManagerConfig {
59
+ apiKey?: string;
60
+ baseUrl?: string;
61
+ fetch?: FetchImpl;
62
+ }
63
+ export declare function umansModelManagerOptions(config?: UmansModelManagerConfig): ModelManagerOptions<"anthropic-messages">;
64
+ export interface OpenAIModelManagerConfig {
65
+ apiKey?: string;
66
+ baseUrl?: string;
67
+ fetch?: FetchImpl;
68
+ }
69
+ export declare function openaiModelManagerOptions(config?: OpenAIModelManagerConfig): ModelManagerOptions<"openai-responses">;
70
+ /**
71
+ * Re-derive the generated pro-reasoning aliases (`gpt-5.6-*-pro`) for the
72
+ * first-party `openai` gpt-5.6 rows. Each alias inherits the base row's
73
+ * metadata, requests the base wire id via `requestModelId`, and sets
74
+ * `reasoningMode: "pro"` so Responses-family request builders emit
75
+ * `reasoning: { mode: "pro" }`. Called by the models.json generator after all
76
+ * sources merge: stale copies of the owned aliases (previous snapshot,
77
+ * including retired `openai-codex` rows) are dropped and re-projected from the
78
+ * current base rows so alias metadata always tracks the base, while a real
79
+ * upstream model that occupies an alias id wins and suppresses the projection.
80
+ */
81
+ export declare function projectOpenAIProReasoningAliases(models: readonly ModelSpec<Api>[]): ModelSpec<Api>[];
82
+ /**
83
+ * Bundled seed for GMI Cloud. Generation has no `GMI_API_KEY`, so a regen
84
+ * without credentials would leave the provider slice empty and the declared
85
+ * `defaultModel` unresolvable on a fresh install before the async runtime
86
+ * discovery fires. Live `/v1/models` discovery is authoritative for the model
87
+ * ID set and overrides context/max-token limits, but `mapWithBundledReference`
88
+ * keeps the reference's cost/reasoning/thinking — so these fields carry GMI's
89
+ * direct-tariff values: V4-Flash at $0.14/$0.28 per 1M with Think High/Max
90
+ * modes per GMI's launch post
91
+ * (https://www.gmicloud.ai/en/blog/deepseek-v4-is-here-we-tested-it), not
92
+ * discounted gateway-route pricing. GMI publishes no cache-read tariff, so
93
+ * cacheRead stays 0 until a direct source confirms cached-token billing.
94
+ */
95
+ export declare const GMI_CLOUD_STATIC_MODELS: readonly ModelSpec<"openai-completions">[];
96
+ export interface GmiCloudModelManagerConfig {
97
+ apiKey?: string;
98
+ baseUrl?: string;
99
+ fetch?: FetchImpl;
100
+ }
101
+ export declare function gmiCloudModelManagerOptions(config?: GmiCloudModelManagerConfig): ModelManagerOptions<"openai-completions">;
102
+ export interface GroqModelManagerConfig {
103
+ apiKey?: string;
104
+ baseUrl?: string;
105
+ fetch?: FetchImpl;
106
+ }
107
+ export declare function groqModelManagerOptions(config?: GroqModelManagerConfig): ModelManagerOptions<"openai-completions">;
108
+ export interface CerebrasModelManagerConfig {
109
+ apiKey?: string;
110
+ baseUrl?: string;
111
+ fetch?: FetchImpl;
112
+ }
113
+ export declare function cerebrasModelManagerOptions(config?: CerebrasModelManagerConfig): ModelManagerOptions<"openai-completions">;
114
+ export interface HuggingfaceModelManagerConfig {
115
+ apiKey?: string;
116
+ baseUrl?: string;
117
+ fetch?: FetchImpl;
118
+ }
119
+ export declare function huggingfaceModelManagerOptions(config?: HuggingfaceModelManagerConfig): ModelManagerOptions<"openai-completions">;
120
+ export interface NvidiaModelManagerConfig {
121
+ apiKey?: string;
122
+ baseUrl?: string;
123
+ fetch?: FetchImpl;
124
+ }
125
+ export declare function nvidiaModelManagerOptions(config?: NvidiaModelManagerConfig): ModelManagerOptions<"openai-completions">;
126
+ /** Novita OpenAI-compatible discovery configuration. */
127
+ export interface NovitaModelManagerConfig {
128
+ apiKey?: string;
129
+ baseUrl?: string;
130
+ fetch?: FetchImpl;
131
+ }
132
+ /** Builds Novita's public model-discovery manager. */
133
+ export declare function novitaModelManagerOptions(config?: NovitaModelManagerConfig): ModelManagerOptions<"openai-completions">;
134
+ export interface XaiModelManagerConfig {
135
+ apiKey?: string;
136
+ baseUrl?: string;
137
+ fetch?: FetchImpl;
138
+ }
139
+ export declare function xaiModelManagerOptions(config?: XaiModelManagerConfig): ModelManagerOptions<"openai-completions">;
140
+ export interface XaiOAuthModelManagerConfig {
141
+ apiKey?: string;
142
+ baseUrl?: string;
143
+ fetch?: FetchImpl;
144
+ }
145
+ interface XAICuratedModel {
146
+ id: string;
147
+ contextWindow: number;
148
+ name?: string;
149
+ /** Whether the model reasons natively. Defaults to true for Grok-4.x family. */
150
+ reasoning?: boolean;
151
+ /**
152
+ * Whether xAI accepts the `reasoning.effort` wire param for this model.
153
+ * Default true. When false: the picker hides the effort dial (via
154
+ * getSupportedEfforts in model-thinking.ts) AND the wire omits the param —
155
+ * both derive from `isGrokReasoningEffortCapable` (identity/family.ts), the
156
+ * single allowlist shared by this curated layer and the compat builder.
157
+ */
158
+ supportsReasoningEffort?: boolean;
159
+ /**
160
+ * Input modalities this model accepts. Defaults to `["text"]` when absent.
161
+ * Vision-capable Grok models MUST list `"image"` here so the curated layer
162
+ * overrides `fetchOpenAICompatibleModels`' default of `["text"]` (which
163
+ * otherwise strips image capability on every online refresh).
164
+ */
165
+ input?: ("text" | "image")[];
166
+ }
167
+ export declare const XAI_OAUTH_CURATED_MODELS: readonly XAICuratedModel[];
168
+ /**
169
+ * Render `XAI_OAUTH_CURATED_MODELS` as full `ModelSpec<"openai-responses">` entries.
170
+ *
171
+ * Single source of truth for the curated to Model fan-in, consumed by both
172
+ * - {@link xaiOAuthModelManagerOptions} (runtime static seed handed to the model
173
+ * manager so the picker is populated on a fresh login), and
174
+ * - \`packages/catalog/scripts/generate-models.ts\` (bundles the same entries into
175
+ * `models.json`, so the synchronous `ModelRegistry.#loadModels()` boot path
176
+ * sees `xai-oauth` without waiting for a refresh — fixes the boot-time
177
+ * default-model reset when `modelRoles.default = "xai-oauth/<id>"`).
178
+ *
179
+ * `reasoning` defaults to `true` for the Grok-4.x family; the explicit
180
+ * `grok-4.20-0309-non-reasoning` entry opts out via `XAICuratedModel.reasoning`.
181
+ * `maxTokens` mirrors each model's `contextWindow` (the OAuth surface reports
182
+ * no per-request output limit); the openai-responses wire still clamps the
183
+ * actual request to OPENAI_MAX_OUTPUT_TOKENS. Mirrors
184
+ * `hermes-agent/hermes_cli/models.py:_XAI_STATIC_FALLBACK`.
185
+ */
186
+ export declare function buildXaiOAuthStaticSeed(baseUrl?: string): ModelSpec<"openai-responses">[];
187
+ export declare function xaiOAuthModelManagerOptions(config?: XaiOAuthModelManagerConfig): ModelManagerOptions<"openai-responses">;
188
+ export declare function isLikelyAimlApiChatModelId(id: string): boolean;
189
+ export interface AimlApiModelManagerConfig {
190
+ apiKey?: string;
191
+ baseUrl?: string;
192
+ fetch?: FetchImpl;
193
+ }
194
+ export declare function aimlApiModelManagerOptions(config?: AimlApiModelManagerConfig): ModelManagerOptions<"openai-completions">;
195
+ export interface DeepSeekModelManagerConfig {
196
+ apiKey?: string;
197
+ baseUrl?: string;
198
+ fetch?: FetchImpl;
199
+ }
200
+ export declare function deepseekModelManagerOptions(config?: DeepSeekModelManagerConfig): ModelManagerOptions<"openai-completions">;
201
+ export interface SiliconFlowModelManagerConfig {
202
+ apiKey?: string;
203
+ baseUrl?: string;
204
+ fetch?: FetchImpl;
205
+ }
206
+ export declare function isLikelySiliconFlowChatModelId(id: string): boolean;
207
+ export declare function siliconflowModelManagerOptions(config?: SiliconFlowModelManagerConfig): ModelManagerOptions<"openai-completions">;
208
+ export declare function siliconflowCnModelManagerOptions(config?: SiliconFlowModelManagerConfig): ModelManagerOptions<"openai-completions">;
209
+ export interface ZhipuCodingPlanModelManagerConfig {
210
+ apiKey?: string;
211
+ baseUrl?: string;
212
+ fetch?: FetchImpl;
213
+ }
214
+ export declare function zhipuCodingPlanModelManagerOptions(config?: ZhipuCodingPlanModelManagerConfig): ModelManagerOptions<"openai-completions">;
215
+ /**
216
+ * Fireworks-published cap for the Kimi K2 family. Fireworks' `/v1/models`
217
+ * envelope generically reports `max_completion_tokens: 65536` for every Kimi
218
+ * deployment, but Kimi K2 (instruct / thinking / turbo) on Fireworks is
219
+ * documented to ship long reasoning traces that should be bounded — capping
220
+ * at 32,768 prevents handing callers a budget the router cannot honor.
221
+ * See https://github.com/can1357/oh-my-pi/issues/1849.
222
+ */
223
+ export declare const FIREWORKS_KIMI_MAX_TOKENS = 32768;
224
+ /**
225
+ * Fireworks' output ceiling for Kimi K2.7-Code specifically. Its `/v1/models`
226
+ * generic `max_completion_tokens` is 65,536 and Fireworks serves it in full —
227
+ * verified with a single completion emitting 58,971 output tokens and
228
+ * `max_tokens: 200000` accepted without error. Unlike the older K2.5/K2.6
229
+ * family (see {@link FIREWORKS_KIMI_MAX_TOKENS}), K2.7-Code is not clamped to
230
+ * 32,768; that ceiling only truncated it.
231
+ */
232
+ export declare const FIREWORKS_KIMI_K27_CODE_MAX_TOKENS = 65536;
233
+ /**
234
+ * Returns true for the Kimi K2.5 / K2.6 family served by Fireworks-backed
235
+ * providers (`fireworks` direct, `firepass` router) that share the 32,768
236
+ * `maxTokens` ceiling. Matches both the public catalog id (`kimi-k2.5`,
237
+ * `kimi-k2.6`, `kimi-k2.6-turbo`) and the canonical Fireworks wire id
238
+ * (`accounts/fireworks/{models,routers}/kimi-k2…`).
239
+ *
240
+ * K2.7-Code (incl. `-fast` / `-highspeed`) is deliberately excluded: unlike the
241
+ * earlier K2 family it serves its full context on Fireworks — verified with a
242
+ * single completion emitting 58,971 output tokens and `max_tokens: 200000`
243
+ * accepted without error — so the 32,768 cap would only truncate it. It inherits
244
+ * Fireworks' reported `max_completion_tokens` (65,536) instead.
245
+ */
246
+ export declare function isFireworksKimiK2ModelId(modelId: string): boolean;
247
+ /**
248
+ * Clamp the Kimi K2 family's `maxTokens` to {@link FIREWORKS_KIMI_MAX_TOKENS}
249
+ * on Fireworks-backed providers, leaving every other model untouched.
250
+ */
251
+ export declare function clampFireworksKimiMaxTokens(modelId: string, candidate: number): number;
252
+ export declare function clampFireworksKimiMaxTokens(modelId: string, candidate: number | null): number | null;
253
+ /**
254
+ * Kimi K2.7 Code's documented recommended output budget. Some provider
255
+ * discovery rows report the context-sized `max_completion_tokens` instead.
256
+ */
257
+ export declare const KIMI_K27_CODE_RECOMMENDED_MAX_TOKENS = 32768;
258
+ export declare function isKimiK27CodeModelId(modelId: string): boolean;
259
+ export declare function clampKimiK27CodeMaxTokens(modelId: string, candidate: number): number;
260
+ export declare function clampKimiK27CodeMaxTokens(modelId: string, candidate: number | null): number | null;
261
+ /**
262
+ * Build the Fireworks Fast seed by projecting each base bundled spec into a
263
+ * `<id>-fast` variant. Pushed into the generated catalog (Fast routers never
264
+ * appear in the serverless control-plane list, so discovery cannot surface
265
+ * them) and deduped behind any identical previous-snapshot entry.
266
+ */
267
+ export declare function buildFireworksFastSeed(): ModelSpec<"openai-completions">[];
268
+ /**
269
+ * Fireworks DeepSeek V4 accepts effort via `reasoning_effort` but rejects the
270
+ * DeepSeek-native binary `thinking` toggle when both are present.
271
+ */
272
+ export declare function stripFireworksDeepSeekThinkingToggle(model: ModelSpec<"openai-completions">, publicModelId: string): ModelSpec<"openai-completions">;
273
+ export interface FireworksModelManagerConfig {
274
+ apiKey?: string;
275
+ baseUrl?: string;
276
+ fetch?: FetchImpl;
277
+ }
278
+ export declare function fireworksModelManagerOptions(config?: FireworksModelManagerConfig): ModelManagerOptions<"openai-completions">;
279
+ export interface FirepassModelManagerConfig {
280
+ apiKey?: string;
281
+ baseUrl?: string;
282
+ fetch?: FetchImpl;
283
+ }
284
+ /**
285
+ * Fire Pass is a Fireworks subscription product that exposes a single router
286
+ * model (Kimi K2.6 Turbo) under `accounts/fireworks/routers/kimi-k2p6-turbo`.
287
+ * The dedicated `fpk_…` keys do not authorize `/v1/models`, so this manager
288
+ * never performs dynamic discovery — the bundled catalog entry is canonical.
289
+ * See https://docs.fireworks.ai/firepass.
290
+ */
291
+ export declare function firepassModelManagerOptions(_config?: FirepassModelManagerConfig): ModelManagerOptions<"openai-completions">;
292
+ export interface WaferModelManagerConfig {
293
+ apiKey?: string;
294
+ baseUrl?: string;
295
+ fetch?: FetchImpl;
296
+ }
297
+ type WaferThinkingFormat = "zai" | "qwen";
298
+ export declare function resolveWaferServerlessThinkingFormat(modelId: string, upstreamProvider: unknown): WaferThinkingFormat | undefined;
299
+ export declare function waferServerlessModelManagerOptions(config?: WaferModelManagerConfig): ModelManagerOptions<"openai-completions">;
300
+ export interface MistralModelManagerConfig {
301
+ apiKey?: string;
302
+ baseUrl?: string;
303
+ fetch?: FetchImpl;
304
+ }
305
+ export declare function mistralModelManagerOptions(config?: MistralModelManagerConfig): ModelManagerOptions<"openai-completions">;
306
+ export interface OpenCodeModelManagerConfig {
307
+ apiKey?: string;
308
+ baseUrl?: string;
309
+ fetch?: FetchImpl;
310
+ }
311
+ export declare function opencodeZenModelManagerOptions(config?: OpenCodeModelManagerConfig): ModelManagerOptions<Api>;
312
+ export declare function opencodeGoModelManagerOptions(config?: OpenCodeModelManagerConfig): ModelManagerOptions<Api>;
313
+ export interface OllamaModelManagerConfig {
314
+ apiKey?: string;
315
+ baseUrl?: string;
316
+ fetch?: FetchImpl;
317
+ }
318
+ export declare function ollamaModelManagerOptions(config?: OllamaModelManagerConfig): ModelManagerOptions<"openai-responses">;
319
+ export interface OpenRouterModelManagerConfig {
320
+ apiKey?: string;
321
+ baseUrl?: string;
322
+ fetch?: FetchImpl;
323
+ }
324
+ export declare function openrouterModelManagerOptions(config?: OpenRouterModelManagerConfig): ModelManagerOptions<"openrouter">;
325
+ export interface ZenMuxModelManagerConfig {
326
+ apiKey?: string;
327
+ baseUrl?: string;
328
+ fetch?: FetchImpl;
329
+ }
330
+ export declare function zenmuxModelManagerOptions(config?: ZenMuxModelManagerConfig): ModelManagerOptions<Api>;
331
+ export interface KiloModelManagerConfig {
332
+ apiKey?: string;
333
+ baseUrl?: string;
334
+ fetch?: FetchImpl;
335
+ }
336
+ export declare function kiloModelManagerOptions(config?: KiloModelManagerConfig): ModelManagerOptions<"openai-completions">;
337
+ export interface AlibabaCodingPlanModelManagerConfig {
338
+ apiKey?: string;
339
+ baseUrl?: string;
340
+ fetch?: FetchImpl;
341
+ }
342
+ export declare function alibabaCodingPlanModelManagerOptions(config?: AlibabaCodingPlanModelManagerConfig): ModelManagerOptions<"openai-completions">;
343
+ export { ALIBABA_TOKEN_PLAN_BASE_URL };
344
+ export declare const ALIBABA_TOKEN_PLAN_STATIC_MODELS: readonly ModelSpec<"openai-completions">[];
345
+ /**
346
+ * Metadata for Alibaba Token Plan models that are dynamically discovered but not
347
+ * in the static catalog. Context window and max tokens are sourced from
348
+ * official model documentation and provider catalogs. Unknown future models
349
+ * remain available with null limits instead of assigning unsafe guessed limits.
350
+ */
351
+ export interface AlibabaTokenPlanModelLimits {
352
+ contextWindow: number;
353
+ maxTokens: number;
354
+ }
355
+ export declare const ALIBABA_TOKEN_PLAN_DISCOVERED_MODEL_LIMITS: Readonly<Record<string, AlibabaTokenPlanModelLimits>>;
356
+ export interface AlibabaTokenPlanModelManagerConfig {
357
+ apiKey?: string;
358
+ baseUrl?: string;
359
+ fetch?: FetchImpl;
360
+ }
361
+ export declare function alibabaTokenPlanModelManagerOptions(config?: AlibabaTokenPlanModelManagerConfig): ModelManagerOptions<"openai-completions">;
362
+ export interface VercelAiGatewayModelManagerConfig {
363
+ apiKey?: string;
364
+ baseUrl?: string;
365
+ fetch?: FetchImpl;
366
+ }
367
+ export declare function vercelAiGatewayModelManagerOptions(config?: VercelAiGatewayModelManagerConfig): ModelManagerOptions<"anthropic-messages">;
368
+ export interface KimiCodeModelManagerConfig {
369
+ apiKey?: string;
370
+ baseUrl?: string;
371
+ fetch?: FetchImpl;
372
+ }
373
+ /**
374
+ * Kimi Code output ceilings by model family. The `/coding/v1/models` discovery
375
+ * envelope carries no output-limit field, so the mapper supplies the documented
376
+ * per-family caps instead of a blanket constant. Values match models.dev's
377
+ * `kimi-for-coding` and `moonshotai` kimi-k3 entries. See #6711.
378
+ */
379
+ export declare const KIMI_CODE_K3_MAX_TOKENS = 131072;
380
+ export declare const KIMI_CODE_FOR_CODING_MAX_TOKENS = 32768;
381
+ /** Fallback output cap for Kimi Code families without a documented ceiling (legacy K2 discovery rows). */
382
+ export declare const KIMI_CODE_DEFAULT_MAX_TOKENS = 32000;
383
+ /**
384
+ * Resolve a Kimi Code model's output ceiling from its id: `k3` / `k3-256k` ->
385
+ * 131072, `kimi-for-coding[-highspeed]` -> 32768, everything else -> `fallback`.
386
+ */
387
+ export declare function kimiCodeMaxTokens(modelId: string, fallback?: number): number;
388
+ export declare function kimiCodeMaxTokens(modelId: string, fallback: number | null): number | null;
389
+ export declare function kimiCodeModelManagerOptions(config?: KimiCodeModelManagerConfig): ModelManagerOptions<"openai-completions">;
390
+ /** Native LM Studio metadata keyed by model id from `/api/v0/models`. */
391
+ export interface LmStudioNativeModelMetadata {
392
+ input: ("text" | "image")[];
393
+ contextWindow?: number;
394
+ }
395
+ /** Options for LM Studio's optional native metadata probe. */
396
+ export interface LmStudioNativeModelMetadataOptions {
397
+ headers?: Record<string, string>;
398
+ signal?: AbortSignal;
399
+ }
400
+ /** Fetches LM Studio native model metadata used to mark VLM models as image-capable. */
401
+ export declare function fetchLmStudioNativeModelMetadata(baseUrl: string, fetchImpl?: FetchImpl, options?: LmStudioNativeModelMetadataOptions): Promise<Map<string, LmStudioNativeModelMetadata> | null>;
402
+ export interface LmStudioModelManagerConfig {
403
+ apiKey?: string;
404
+ baseUrl?: string;
405
+ fetch?: FetchImpl;
406
+ }
407
+ export declare function lmStudioModelManagerOptions(config?: LmStudioModelManagerConfig): ModelManagerOptions<"openai-completions">;
408
+ export interface SyntheticModelManagerConfig {
409
+ apiKey?: string;
410
+ baseUrl?: string;
411
+ fetch?: FetchImpl;
412
+ }
413
+ export declare function syntheticModelManagerOptions(config?: SyntheticModelManagerConfig): ModelManagerOptions<"openai-completions">;
414
+ export interface VeniceModelManagerConfig {
415
+ apiKey?: string;
416
+ baseUrl?: string;
417
+ fetch?: FetchImpl;
418
+ }
419
+ export declare function veniceModelManagerOptions(config?: VeniceModelManagerConfig): ModelManagerOptions<"openai-completions">;
420
+ export interface BasetenModelManagerConfig {
421
+ apiKey?: string;
422
+ baseUrl?: string;
423
+ fetch?: FetchImpl;
424
+ }
425
+ export declare function basetenModelManagerOptions(config?: BasetenModelManagerConfig): ModelManagerOptions<"openai-completions">;
426
+ export interface TogetherModelManagerConfig {
427
+ apiKey?: string;
428
+ baseUrl?: string;
429
+ fetch?: FetchImpl;
430
+ }
431
+ export declare function togetherModelManagerOptions(config?: TogetherModelManagerConfig): ModelManagerOptions<"openai-completions">;
432
+ export interface CoreWeaveModelManagerConfig {
433
+ apiKey?: string;
434
+ baseUrl?: string;
435
+ fetch?: FetchImpl;
436
+ }
437
+ export declare function coreWeaveModelManagerOptions(config?: CoreWeaveModelManagerConfig): ModelManagerOptions<"openai-completions">;
438
+ export declare const META_MUSE_STATIC_MODELS: readonly ModelSpec<"openai-responses">[];
439
+ /**
440
+ * OpenAI frontier models served exclusively through Bedrock Mantle's Responses
441
+ * endpoint. Pricing is per million tokens from the Amazon Bedrock pricing page.
442
+ */
443
+ export declare const BEDROCK_MANTLE_STATIC_MODELS: readonly ModelSpec<"openai-responses">[];
444
+ export declare function bedrockMantleModelManagerOptions(config?: ModelManagerConfig): ModelManagerOptions<"openai-responses">;
445
+ export interface MetaModelManagerConfig {
446
+ apiKey?: string;
447
+ baseUrl?: string;
448
+ fetch?: FetchImpl;
449
+ }
450
+ export declare function metaModelManagerOptions(config?: MetaModelManagerConfig): ModelManagerOptions<"openai-responses">;
451
+ export interface MoonshotModelManagerConfig {
452
+ apiKey?: string;
453
+ baseUrl?: string;
454
+ fetch?: FetchImpl;
455
+ }
456
+ export declare function moonshotModelManagerOptions(config?: MoonshotModelManagerConfig): ModelManagerOptions<"openai-completions">;
457
+ export declare const SAKANA_FUGU_STATIC_MODELS: readonly ModelSpec<"openai-responses">[];
458
+ export interface SakanaModelManagerConfig {
459
+ apiKey?: string;
460
+ baseUrl?: string;
461
+ fetch?: FetchImpl;
462
+ }
463
+ export declare function sakanaModelManagerOptions(config?: SakanaModelManagerConfig): ModelManagerOptions<"openai-responses">;
464
+ /**
465
+ * Documented ai& catalog (docs.aiand.com/models/catalog, 2026-08) bundled so
466
+ * the provider is usable when generation and first boot have no live key.
467
+ * The org-scoped `/v1/models` response is authoritative once discovery runs.
468
+ */
469
+ export declare const AIAND_STATIC_MODELS: readonly ModelSpec<"openai-completions">[];
470
+ export interface AiandModelManagerConfig {
471
+ apiKey?: string;
472
+ baseUrl?: string;
473
+ fetch?: FetchImpl;
474
+ }
475
+ /**
476
+ * ai& (aiand.com) model manager: OpenAI-compatible chat completions with an
477
+ * org-scoped `/v1/models` catalog carrying context, capability, effort, and
478
+ * pricing metadata, so discovery is authoritative over the bundled seed.
479
+ */
480
+ export declare function aiandModelManagerOptions(config?: AiandModelManagerConfig): ModelManagerOptions<"openai-completions">;
481
+ export interface QwenPortalModelManagerConfig {
482
+ apiKey?: string;
483
+ baseUrl?: string;
484
+ fetch?: FetchImpl;
485
+ }
486
+ export declare function qwenPortalModelManagerOptions(config?: QwenPortalModelManagerConfig): ModelManagerOptions<"openai-completions">;
487
+ export interface QianfanModelManagerConfig {
488
+ apiKey?: string;
489
+ baseUrl?: string;
490
+ fetch?: FetchImpl;
491
+ }
492
+ export declare function qianfanModelManagerOptions(config?: QianfanModelManagerConfig): ModelManagerOptions<"openai-completions">;
493
+ export interface CloudflareAiGatewayModelManagerConfig {
494
+ apiKey?: string;
495
+ baseUrl?: string;
496
+ fetch?: FetchImpl;
497
+ }
498
+ export declare function cloudflareAiGatewayModelManagerOptions(config?: CloudflareAiGatewayModelManagerConfig): ModelManagerOptions<"anthropic-messages">;
499
+ /** Region codes for Xiaomi Token Plan clusters exposed as separate login providers. */
500
+ export type XiaomiTokenPlanRegion = "sgp" | "ams" | "cn";
501
+ /** Configures Xiaomi standard or regional Token Plan OpenAI-compatible model discovery. */
502
+ export interface XiaomiModelManagerConfig {
503
+ apiKey?: string;
504
+ baseUrl?: string;
505
+ fetch?: FetchImpl;
506
+ providerId?: Provider;
507
+ tokenPlanRegion?: XiaomiTokenPlanRegion;
508
+ }
509
+ /** Builds a Xiaomi model manager, preserving Token Plan region provider ids during discovery. */
510
+ export declare function xiaomiModelManagerOptions(config?: XiaomiModelManagerConfig): ModelManagerOptions<"openai-completions">;
511
+ export interface LiteLLMModelManagerConfig {
512
+ apiKey?: string;
513
+ baseUrl?: string;
514
+ fetch?: FetchImpl;
515
+ }
516
+ export interface FetchLiteLLMRichModelsOptions<TApi extends Api> {
517
+ api: TApi;
518
+ provider: Provider;
519
+ baseUrl: string;
520
+ apiKey?: string;
521
+ headers?: Record<string, string>;
522
+ fetch?: FetchImpl;
523
+ signal?: AbortSignal;
524
+ timeoutMs?: number;
525
+ referenceResolver?: (modelId: string) => ModelSpec<TApi> | undefined;
526
+ }
527
+ export declare const OPENAI_COMPAT_DISCOVERY_DEFAULT_CONTEXT_WINDOW = 128000;
528
+ export declare const OPENAI_COMPAT_DISCOVERY_DEFAULT_MAX_TOKENS = 32768;
529
+ export declare function normalizeLiteLLMManagementBaseUrl(baseUrl: string): string;
530
+ export declare function fetchLiteLLMRichModels<TApi extends Api>(options: FetchLiteLLMRichModelsOptions<TApi>): Promise<ModelSpec<TApi>[] | null>;
531
+ export declare function litellmModelManagerOptions(config?: LiteLLMModelManagerConfig): ModelManagerOptions<"openai-completions">;
532
+ export interface VllmModelManagerConfig {
533
+ apiKey?: string;
534
+ baseUrl?: string;
535
+ fetch?: FetchImpl;
536
+ }
537
+ export declare function vllmModelManagerOptions(config?: VllmModelManagerConfig): ModelManagerOptions<"openai-completions">;
538
+ export interface NanoGptModelManagerConfig {
539
+ apiKey?: string;
540
+ baseUrl?: string;
541
+ fetch?: FetchImpl;
542
+ }
543
+ export declare function nanoGptModelManagerOptions(config?: NanoGptModelManagerConfig): ModelManagerOptions<"openai-completions">;
544
+ export interface GithubCopilotModelManagerConfig {
545
+ apiKey?: string;
546
+ baseUrl?: string;
547
+ fetch?: FetchImpl;
548
+ }
549
+ /** Local id/name suffixes for synthesized Copilot long-context variants. */
550
+ export declare const COPILOT_LONG_CONTEXT_ID_SUFFIX = "-1m";
551
+ export declare function githubCopilotModelManagerOptions(config?: GithubCopilotModelManagerConfig): ModelManagerOptions<Api>;
552
+ export interface AnthropicModelManagerConfig {
553
+ apiKey?: string;
554
+ baseUrl?: string;
555
+ fetch?: FetchImpl;
556
+ }
557
+ export declare function anthropicModelManagerOptions(config?: AnthropicModelManagerConfig): ModelManagerOptions<"anthropic-messages">;
558
+ /** Describes how to map models.dev API data for a single provider. */
559
+ export interface ModelsDevProviderDescriptor {
560
+ /** Key in the models.dev API response JSON (e.g., "anthropic", "amazon-bedrock") */
561
+ modelsDevKey: string;
562
+ /** Provider ID in our system */
563
+ providerId: string;
564
+ /** Default API type for this provider's models */
565
+ api: Api;
566
+ /** Default base URL */
567
+ baseUrl: string;
568
+ /** Default context window fallback (default: UNKNNOWN_CONTEXT_WINDOW) */
569
+ defaultContextWindow?: number;
570
+ /** Default max tokens fallback (default: UNKNNOWN_MAX_TOKENS) */
571
+ defaultMaxTokens?: number;
572
+ /** Optional compat overrides applied to every model from this provider */
573
+ compat?: ModelSpec<Api>["compat"];
574
+ /** Optional static headers applied to every model */
575
+ headers?: Record<string, string>;
576
+ /**
577
+ * Optional filter: return false to skip a model.
578
+ * Called with (modelId, rawModel). Default: skip if tool_call !== true.
579
+ */
580
+ filterModel?: (modelId: string, model: ModelsDevModel) => boolean;
581
+ /**
582
+ * Optional transform: modify the mapped model before it's added.
583
+ * Can return null to skip the model, or an array to emit multiple models.
584
+ */
585
+ transformModel?: (model: ModelSpec<Api>, modelId: string, raw: ModelsDevModel) => ModelSpec<Api> | ModelSpec<Api>[] | null;
586
+ /**
587
+ * Optional: override the API type per-model.
588
+ * Called with (modelId, raw). Return the API type to use.
589
+ * If not provided, uses the `api` field.
590
+ */
591
+ resolveApi?: (modelId: string, raw: ModelsDevModel) => {
592
+ api: Api;
593
+ baseUrl: string;
594
+ } | null;
595
+ }
596
+ /** Generic mapper that converts models.dev data using provider descriptors. */
597
+ export declare function mapModelsDevToModels(data: Record<string, unknown>, descriptors: readonly ModelsDevProviderDescriptor[]): ModelSpec<Api>[];
598
+ /** All provider descriptors for models.dev data mapping in generate-models.ts. */
599
+ export declare const MODELS_DEV_PROVIDER_DESCRIPTORS: readonly ModelsDevProviderDescriptor[];
@@ -0,0 +1,53 @@
1
+ import type { DevinModelDiscoveryOptions } from "../discovery/devin.js";
2
+ import type { ModelManagerOptions } from "../model-manager.js";
3
+ import type { FetchImpl } from "../types.js";
4
+ /** One Codex OAuth account to fetch a catalog for. */
5
+ export interface OpenAICodexAccount {
6
+ /** OAuth access token used for `Authorization: Bearer ...`. */
7
+ accessToken: string;
8
+ /** ChatGPT account id sent as the `chatgpt-account-id` header. */
9
+ accountId?: string;
10
+ }
11
+ export interface OpenAICodexModelManagerConfig {
12
+ /**
13
+ * Resolves every configured Codex OAuth account at discovery time. Codex
14
+ * discovery is account-scoped — a model can be available to one account and
15
+ * absent from another — so each account's `/models` endpoint is fetched
16
+ * independently and the results unioned by id. Without this, discovery would
17
+ * surface only the account it happened to resolve and, being authoritative,
18
+ * prune every model the other accounts expose (#6265).
19
+ *
20
+ * Returns `null` to abort discovery entirely (e.g. an account's credential
21
+ * failed to refresh): a partial account set would be cached as the complete
22
+ * authoritative catalog and hide the missing account's models, so the caller
23
+ * keeps the previous/bundled catalog instead.
24
+ */
25
+ resolveAccounts?: () => Promise<readonly OpenAICodexAccount[] | null>;
26
+ clientVersion?: string;
27
+ fetch?: FetchImpl;
28
+ }
29
+ export declare function openaiCodexModelManagerOptions(config?: OpenAICodexModelManagerConfig): ModelManagerOptions<"openai-codex-responses">;
30
+ export interface CursorModelManagerConfig {
31
+ apiKey?: string;
32
+ baseUrl?: string;
33
+ clientVersion?: string;
34
+ }
35
+ export declare function cursorModelManagerOptions(config?: CursorModelManagerConfig): ModelManagerOptions<"cursor-agent">;
36
+ export interface GitLabDuoWorkflowModelManagerConfig {
37
+ apiKey?: string;
38
+ baseUrl?: string;
39
+ fetch?: FetchImpl;
40
+ namespaceId?: string;
41
+ projectId?: string;
42
+ cwd?: string;
43
+ }
44
+ export declare function gitLabDuoWorkflowModelManagerOptions(config?: GitLabDuoWorkflowModelManagerConfig): ModelManagerOptions<"gitlab-duo-agent">;
45
+ export interface DevinModelManagerConfig {
46
+ apiKey?: string;
47
+ baseUrl?: string;
48
+ fetch?: DevinModelDiscoveryOptions["fetch"];
49
+ }
50
+ export declare function devinModelManagerOptions(config?: DevinModelManagerConfig): ModelManagerOptions<"devin-agent">;
51
+ export interface ZaiModelManagerConfig {
52
+ }
53
+ export declare function zaiModelManagerOptions(_config?: ZaiModelManagerConfig): ModelManagerOptions<"anthropic-messages">;