@cherrystudio/provider-registry 0.0.0-stage → 0.1.1

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -2
  3. package/data/models.json +22694 -0
  4. package/data/provider-models.json +41090 -0
  5. package/data/providers.json +2722 -0
  6. package/dist/bundled-catalog.cjs +12 -0
  7. package/dist/bundled-catalog.d.cts +5 -0
  8. package/dist/bundled-catalog.d.mts +5 -0
  9. package/dist/bundled-catalog.mjs +11 -0
  10. package/dist/bundled-models--P3b6A6o.mjs +25220 -0
  11. package/dist/bundled-models-uS9C7ldF.cjs +25224 -0
  12. package/dist/bundled-models.cjs +3 -0
  13. package/dist/bundled-models.d.cts +5 -0
  14. package/dist/bundled-models.d.mts +5 -0
  15. package/dist/bundled-models.mjs +2 -0
  16. package/dist/bundled-provider-models-CT2Ha5w2.cjs +37586 -0
  17. package/dist/bundled-provider-models-y-RYjBUH.mjs +37582 -0
  18. package/dist/bundled-provider-models.cjs +3 -0
  19. package/dist/bundled-provider-models.d.cts +5 -0
  20. package/dist/bundled-provider-models.d.mts +5 -0
  21. package/dist/bundled-provider-models.mjs +2 -0
  22. package/dist/bundled-providers-BcszhEy2.mjs +2172 -0
  23. package/dist/bundled-providers-Bv_iM9AO.cjs +2176 -0
  24. package/dist/bundled-providers.cjs +3 -0
  25. package/dist/bundled-providers.d.cts +5 -0
  26. package/dist/bundled-providers.d.mts +5 -0
  27. package/dist/bundled-providers.mjs +2 -0
  28. package/dist/catalog-DElG_l-8.mjs +369 -0
  29. package/dist/catalog-DurdOhD0.cjs +442 -0
  30. package/dist/catalog-XJyrtwI9.d.cts +53 -0
  31. package/dist/catalog-XJyrtwI9.d.mts +53 -0
  32. package/dist/index.cjs +2620 -0
  33. package/dist/index.d.cts +3932 -0
  34. package/dist/index.d.mts +3932 -0
  35. package/dist/index.mjs +2549 -0
  36. package/dist/model-NFEbqWMs.mjs +665 -0
  37. package/dist/model-kwW2vWDI.cjs +855 -0
  38. package/dist/provider-D14qMZsE.mjs +431 -0
  39. package/dist/provider-DkSIaann.cjs +527 -0
  40. package/dist/provider-models-BjKC53mr.cjs +85 -0
  41. package/dist/provider-models-BkxD9T17.mjs +67 -0
  42. package/dist/provider-models-DuZBXGmP.d.cts +28692 -0
  43. package/dist/provider-models-DuZBXGmP.d.mts +28692 -0
  44. package/dist/registry-BjETdicx.d.mts +35 -0
  45. package/dist/registry-Di5ULW6Z.d.cts +35 -0
  46. package/dist/registry-loader.cjs +170 -0
  47. package/dist/registry-loader.d.cts +64 -0
  48. package/dist/registry-loader.d.mts +64 -0
  49. package/dist/registry-loader.mjs +156 -0
  50. package/package.json +146 -3
@@ -0,0 +1,527 @@
1
+ const require_model = require("./model-kwW2vWDI.cjs");
2
+ let zod = require("zod");
3
+ zod = require_model.__toESM(zod, 1);
4
+ //#region src/patterns/vendor-patterns.ts
5
+ /**
6
+ * Vendor identity regex patterns — the single source of truth for
7
+ * "which vendor does this raw model ID belong to".
8
+ *
9
+ * Shared across three call sites:
10
+ * - `@shared/utils/model` — vendor check functions (`isAnthropicModel`
11
+ * etc.) and capability inference (e.g. deciding which IDs to mark
12
+ * `REASONING` in the schema).
13
+ * - `@cherrystudio/ui` icon registry — vendor-level icon routing for
14
+ * models whose ID doesn't have a dedicated SKU icon.
15
+ * - Future callers doing vendor dispatch.
16
+ *
17
+ * Keeping these regex in the registry layer means both capability
18
+ * inference and icon lookup stay in lockstep when a new vendor /
19
+ * naming convention lands.
20
+ *
21
+ * Scope: **vendor identity only**. SKU-level patterns (`gpt-5.1-codex-mini`,
22
+ * `claude-sonnet-4-6`, etc.) stay in their specific consumer modules —
23
+ * those are dispatch details rather than shared vendor taxonomy.
24
+ *
25
+ * Normalization note: patterns assume the id has already been lowercased
26
+ * and had the leading namespace stripped (e.g. `deepseek/deepseek-r1` →
27
+ * `deepseek-r1`). Pair with `getLowerBaseModelName` (in `@shared`) or
28
+ * `normalizeModelId` (in this package).
29
+ */
30
+ /**
31
+ * Match raw model IDs to their vendor. Keys are vendor slugs; order is
32
+ * not significant because every pattern is anchored to the start of the
33
+ * (namespace-stripped) id, so they stay mutually exclusive — a model
34
+ * belongs to at most one vendor. Keep new patterns anchored (`^…`) so a
35
+ * cross-vendor id like `deepseek-grok` resolves by its leading token, not
36
+ * by insertion order.
37
+ */
38
+ const VENDOR_PATTERNS = {
39
+ /** Anthropic / Claude family. Also matches the AWS Bedrock `anthropic.claude-*` prefix. */
40
+ anthropic: /^(?:anthropic\.)?claude/i,
41
+ /** Google Gemini family. */
42
+ gemini: /^(?:gemini|palm|veo|imagen|learnlm|lyria)/i,
43
+ /** Google Gemma family (gemma-*, gemma2/3/4, and the Ollama-style `gemma:2b` tag). */
44
+ gemma: /^gemma(?:[-:\d]|$)/i,
45
+ /** xAI Grok family. */
46
+ grok: /^grok/i,
47
+ /**
48
+ * OpenAI (chat + reasoning + legacy + media + embeddings). GPT-n, ChatGPT, the bare o<digit> series,
49
+ * codex/davinci/babbage, DALL·E, moderation, and OpenAI's `text-embedding-3*` / `-ada` embeddings.
50
+ * `text-embedding` is scoped to the `-3`/`-ada` SKUs on purpose — bare `text-embedding-0xx` is Google's,
51
+ * and `VENDOR_PATTERNS` is a flat set with no per-creator disambiguation.
52
+ */
53
+ openai: /\bgpt\b|^o[134]|^chatgpt|^codex|^davinci|^babbage|^dall-e|^text-moderation|^text-embedding-(?:3|ada)/i,
54
+ /** Alibaba Qwen family (qwen, qwq, qvq). */
55
+ qwen: /^qwen|^qwq|^qvq|^tongyi/i,
56
+ /** ByteDance Doubao family. */
57
+ doubao: /^(?:doubao|skylark|seed|seedance|seedream|ep-)/i,
58
+ /** Tencent Hunyuan family — `hunyuan-*`, the `hy-*` SKUs, and the versioned `hyN` namespace (`hy3-preview`). */
59
+ hunyuan: /^(?:hunyuan|hy-|hy\d)/i,
60
+ /** Moonshot / Kimi family, including Kimi Code's bare K3 model IDs. */
61
+ kimi: /^(?:kimi|moonshot|k3(?:[-_.]|$))/i,
62
+ /** DeepSeek family. */
63
+ deepseek: /^deepseek/i,
64
+ /** Perplexity (sonar family). */
65
+ perplexity: /^sonar/i,
66
+ /** Baichuan family. */
67
+ baichuan: /^baichuan/i,
68
+ /** Xiaomi MiMo family. */
69
+ mimo: /^mimo-/i,
70
+ /** Ant Group Ling / Ring family. */
71
+ ling: /^(?:ling|ring)-/i,
72
+ /** MiniMax family — current `minimax-*` plus the legacy `abab-*` SKUs the creator still claims. */
73
+ minimax: /^(?:minimax|abab)/i,
74
+ /** StepFun family. */
75
+ step: /^step-/i,
76
+ /** Zhipu / GLM family. */
77
+ zhipu: /^(?:glm|chatglm|cogview|cogvideo|codegeex)/i,
78
+ /** Mistral family — incl. the `open-*` open-weight line (`open-mistral-7b`, `open-mixtral-8x22b`) and `labs-*`. */
79
+ mistral: /^(?:open-|labs-)?(?:mistral|pixtral|codestral|ministral|voxtral|devstral|mixtral|magistral)/i
80
+ };
81
+ /**
82
+ * Return the vendor slug for a normalized model ID, or `undefined` if
83
+ * no vendor pattern matches. Iteration order is stable (key insertion
84
+ * order) but not semantically important — patterns don't overlap.
85
+ */
86
+ function matchVendor(normalizedId) {
87
+ for (const [vendor, pattern] of Object.entries(VENDOR_PATTERNS)) if (pattern.test(normalizedId)) return vendor;
88
+ }
89
+ /**
90
+ * Lightweight vendor predicate factory. Exported primarily so consumers
91
+ * can spell the check as `isVendor('anthropic')(id)` when composing
92
+ * higher-level logic.
93
+ */
94
+ function isVendor(vendor) {
95
+ const pattern = VENDOR_PATTERNS[vendor];
96
+ return (id) => pattern.test(id);
97
+ }
98
+ //#endregion
99
+ //#region src/schemas/reasoningWire.ts
100
+ /** Closed set of leaves the main-process reasoning interpreter may write. */
101
+ const REASONING_WIRE_TARGETS = [
102
+ "reasoningEffort",
103
+ "reasoningSummary",
104
+ "reasoning_effort",
105
+ "reasoning.effort",
106
+ "reasoning.enabled",
107
+ "reasoning.exclude",
108
+ "reasoning.max_tokens",
109
+ "thinking.type",
110
+ "thinking.budget_tokens",
111
+ "thinking.budgetTokens",
112
+ "thinking.display",
113
+ "effort",
114
+ "sendReasoning",
115
+ "enable_thinking",
116
+ "thinking_budget",
117
+ "incremental_output",
118
+ "disable_reasoning",
119
+ "reasoning_budget",
120
+ "chat_template_kwargs.enable_thinking",
121
+ "chat_template_kwargs.thinking",
122
+ "chat_template_kwargs.thinking_mode",
123
+ "chat_template_kwargs.thinking_budget",
124
+ "extra_body.google.thinking_config.thinking_budget",
125
+ "extra_body.google.thinking_config.include_thoughts",
126
+ "extra_body.thinking.type",
127
+ "extra_body.thinking_budget",
128
+ "extra_body.reasoning_effort",
129
+ "thinkingConfig.includeThoughts",
130
+ "thinkingConfig.thinkingBudget",
131
+ "thinkingConfig.thinkingLevel",
132
+ "reasoningConfig.type",
133
+ "reasoningConfig.budgetTokens",
134
+ "reasoningConfig.maxReasoningEffort",
135
+ "think"
136
+ ];
137
+ const ReasoningWireTargetSchema = zod.enum(REASONING_WIRE_TARGETS);
138
+ const ReasoningEffortSchema = zod.enum(require_model.objectValues(require_model.REASONING_EFFORT));
139
+ const ReasoningWireValueSchema = zod.discriminatedUnion("source", [
140
+ zod.object({
141
+ source: zod.literal("literal"),
142
+ value: zod.union([
143
+ zod.string(),
144
+ zod.number(),
145
+ zod.boolean()
146
+ ])
147
+ }),
148
+ zod.object({ source: zod.literal("effort") }),
149
+ zod.object({ source: zod.literal("budget") }),
150
+ zod.object({ source: zod.literal("assistant-summary") })
151
+ ]);
152
+ const ReasoningWireOperationSchema = zod.object({
153
+ target: ReasoningWireTargetSchema,
154
+ value: ReasoningWireValueSchema
155
+ });
156
+ const NonBudgetReasoningWireValueSchema = zod.discriminatedUnion("source", [
157
+ zod.object({
158
+ source: zod.literal("literal"),
159
+ value: zod.union([
160
+ zod.string(),
161
+ zod.number(),
162
+ zod.boolean()
163
+ ])
164
+ }),
165
+ zod.object({ source: zod.literal("effort") }),
166
+ zod.object({ source: zod.literal("assistant-summary") })
167
+ ]);
168
+ const NonBudgetReasoningWireOperationSchema = zod.object({
169
+ target: ReasoningWireTargetSchema,
170
+ value: NonBudgetReasoningWireValueSchema
171
+ });
172
+ const ReasoningBudgetPolicySchema = zod.object({
173
+ min: zod.number().nonnegative().optional(),
174
+ autoValue: zod.number().optional(),
175
+ clampToMaxTokens: zod.boolean().optional(),
176
+ missing: zod.discriminatedUnion("type", [
177
+ zod.object({ type: zod.literal("omit-value") }),
178
+ zod.object({ type: zod.literal("omit-mode") }),
179
+ zod.object({
180
+ type: zod.literal("fallback"),
181
+ value: zod.number()
182
+ })
183
+ ])
184
+ });
185
+ const ReasoningEffortMapSchema = zod.partialRecord(ReasoningEffortSchema, ReasoningEffortSchema).optional();
186
+ const ReasoningWireModeSchema = zod.union([zod.object({
187
+ operations: zod.array(NonBudgetReasoningWireOperationSchema).min(1),
188
+ effortMap: ReasoningEffortMapSchema
189
+ }), zod.object({
190
+ operations: zod.array(ReasoningWireOperationSchema).min(1).refine((operations) => operations.some((operation) => operation.value.source === "budget"), { message: "reasoning budget mode must contain a budget operation" }),
191
+ effortMap: ReasoningEffortMapSchema,
192
+ budget: ReasoningBudgetPolicySchema
193
+ })]);
194
+ const ReasoningWireProfileSchema = zod.object({
195
+ /** Endpoint deliberately emits no reasoning parameters. */
196
+ disabled: zod.literal(true).optional(),
197
+ default: ReasoningWireModeSchema.optional(),
198
+ off: ReasoningWireModeSchema.optional(),
199
+ auto: ReasoningWireModeSchema.optional(),
200
+ effort: ReasoningWireModeSchema.optional()
201
+ }).refine((profile) => profile.disabled === true || profile.default || profile.off || profile.auto || profile.effort, { message: "reasoning wire profile must declare a mode or be disabled" });
202
+ const ReasoningFormatWireProfileSchema = zod.object({
203
+ wire: ReasoningWireProfileSchema,
204
+ budgetWire: ReasoningWireProfileSchema.optional(),
205
+ alwaysOnWire: ReasoningWireProfileSchema.optional(),
206
+ betweenToolsWire: ReasoningWireProfileSchema.optional()
207
+ });
208
+ //#endregion
209
+ //#region src/schemas/provider.ts
210
+ /**
211
+ * Provider configuration schema definitions
212
+ * Defines the structure for provider connections and API configurations
213
+ */
214
+ const endpointTypeValues = require_model.objectValues(require_model.ENDPOINT_TYPE);
215
+ const ProviderEditionSchema = zod.enum(["global", "cn"]);
216
+ /**
217
+ * Provider-owned transport used to request faster processing.
218
+ *
219
+ * Model availability remains a provider-model concern; this only describes
220
+ * how the provider carries an enabled Fast request. `openai-priority` means the
221
+ * `serviceTier` provider option on the OpenAI namespace — the tier *value* is
222
+ * vendor-specific and travels in `fastMode.serviceTier` (OpenAI's `priority`,
223
+ * Ark's `fast`), so a new vendor never has to expand this enum: enum expansion
224
+ * is a breaking wire change, an optional field is not.
225
+ */
226
+ const FastModeTransportSchema = zod.enum(["openai-priority", "claude-code"]);
227
+ const ServiceTierSelectionSchema = zod.enum([
228
+ "standard",
229
+ "auto",
230
+ "fast",
231
+ "flex"
232
+ ]);
233
+ const ServiceTierOptionsSchema = zod.array(ServiceTierSelectionSchema).min(1).refine((options) => new Set(options).size === options.length, { message: "service tier options must be unique" }).refine((options) => options.includes("standard"), { message: "service tier options must include standard" });
234
+ const ServiceTierDeliverySchema = zod.discriminatedUnion("type", [zod.object({
235
+ type: zod.literal("provider-option"),
236
+ key: zod.string().min(1)
237
+ }), zod.object({
238
+ type: zod.literal("request-body"),
239
+ key: zod.string().min(1)
240
+ })]);
241
+ const ServiceTierRequestControlSchema = zod.object({
242
+ default: ServiceTierSelectionSchema,
243
+ options: ServiceTierOptionsSchema,
244
+ wire: zod.object({
245
+ delivery: ServiceTierDeliverySchema,
246
+ values: zod.partialRecord(ServiceTierSelectionSchema, zod.string().min(1))
247
+ })
248
+ }).superRefine((control, context) => {
249
+ if (!control.options.includes(control.default)) context.addIssue({
250
+ code: "custom",
251
+ message: "service tier default must be one of its options",
252
+ path: ["default"]
253
+ });
254
+ for (const option of control.options) if (!control.wire.values[option]) context.addIssue({
255
+ code: "custom",
256
+ message: `service tier option '${option}' must have a wire value`,
257
+ path: [
258
+ "wire",
259
+ "values",
260
+ option
261
+ ]
262
+ });
263
+ });
264
+ /** A provider-native tool plus the scope of models on which the host serves it. */
265
+ const ServerToolConfigSchema = zod.object({
266
+ id: zod.enum(require_model.objectValues(require_model.SERVER_TOOL)),
267
+ modelScope: zod.enum(require_model.objectValues(require_model.SERVER_TOOL_MODEL_SCOPE)).default(require_model.SERVER_TOOL_MODEL_SCOPE.MODEL_DEPENDENT),
268
+ /** Endpoint protocols on which the host serves the tool. Absent ⇒ all configured endpoints. */
269
+ endpointTypes: require_model.looseArray(require_model.EndpointTypeSchema).optional(),
270
+ /**
271
+ * Vendor families the host actually serves the tool for, when narrower than
272
+ * the tool's model eligibility (e.g. Vertex url-context is Gemini-only: the
273
+ * vertex-anthropic SDK exposes no webFetch tool). Absent ⇒ no narrowing.
274
+ */
275
+ vendors: require_model.looseArray(zod.enum(Object.keys(VENDOR_PATTERNS))).optional()
276
+ });
277
+ const reasoningFormat = (type) => zod.object({
278
+ type: zod.literal(type),
279
+ /** Endpoint-wide wire behavior, interpreted only in Main. */
280
+ wire: ReasoningWireProfileSchema.optional()
281
+ });
282
+ /** Provider reasoning format — discriminated union by format type. */
283
+ const ProviderReasoningFormatSchema = zod.discriminatedUnion("type", [
284
+ reasoningFormat("openai-chat"),
285
+ reasoningFormat("openai-responses"),
286
+ reasoningFormat("anthropic"),
287
+ reasoningFormat("gemini"),
288
+ reasoningFormat("ollama"),
289
+ reasoningFormat("none")
290
+ ]);
291
+ const REASONING_FORMAT_TYPES = ProviderReasoningFormatSchema.options.map((option) => option.shape.type.value);
292
+ const ProviderWebsiteSchema = zod.object({ website: zod.object({
293
+ official: zod.url().optional(),
294
+ docs: zod.url().optional(),
295
+ apiKey: zod.url().optional(),
296
+ models: zod.url().optional()
297
+ }) });
298
+ /**
299
+ * How a host deviates from one endpoint's dialect. These are properties of the
300
+ * protocol, not of the vendor: a provider serving both chat-completions and
301
+ * Responses may answer differently for each.
302
+ */
303
+ const EndpointDialectSchema = zod.object({
304
+ /** Accepts chat-completions `stream_options` for usage data. Absent ⇒ true. */
305
+ streamOptions: zod.boolean().optional(),
306
+ /** Accepts messages with `role: "developer"`. Absent ⇒ false. */
307
+ developerRole: zod.boolean().optional(),
308
+ /** Accepts OpenAI Responses `reasoning.summary`. Absent ⇒ use the registry wire. */
309
+ reasoningSummary: zod.boolean().optional()
310
+ });
311
+ /** Per-endpoint-type configuration in registry */
312
+ const RegistryEndpointConfigSchema = zod.object({
313
+ /** Base URL for this endpoint type's API */
314
+ baseUrl: zod.url().optional(),
315
+ /** URLs for fetching available models via this endpoint type */
316
+ modelsApiUrls: zod.object({
317
+ /** Default models listing endpoint */
318
+ default: zod.url().optional(),
319
+ /** Embedding models listing endpoint (if separate from default) */
320
+ embedding: zod.url().optional(),
321
+ /** Image models listing endpoint (if separate from default) */
322
+ image: zod.url().optional(),
323
+ /** Reranker models listing endpoint (if separate from default) */
324
+ reranker: zod.url().optional()
325
+ }).optional(),
326
+ /** How this endpoint type expects reasoning parameters to be formatted */
327
+ reasoningFormat: ProviderReasoningFormatSchema.optional(),
328
+ /**
329
+ * AI SDK adapter family that handles this endpoint. Aligns with the IDs
330
+ * registered in `appProviderIds`. Resolvers should prefer this over
331
+ * heuristic id/baseUrl inference when present.
332
+ */
333
+ adapterFamily: zod.string().optional(),
334
+ /** Dialect deviations of this host's implementation of the endpoint. */
335
+ dialect: EndpointDialectSchema.optional(),
336
+ /** User-selectable request controls supported by this endpoint. */
337
+ requestControls: zod.object({ serviceTier: ServiceTierRequestControlSchema.optional() }).optional()
338
+ });
339
+ const ProviderConfigSchema = zod.object({
340
+ /** Unique provider identifier */
341
+ id: require_model.ProviderIdSchema,
342
+ presetProviderId: require_model.ProviderIdSchema.optional(),
343
+ /** Display name */
344
+ name: zod.string(),
345
+ /** App editions where this provider is available. Omitted means all editions. */
346
+ availableInEditions: require_model.looseArray(ProviderEditionSchema, { min: 1 }).optional(),
347
+ /** Provider description */
348
+ description: zod.string().optional(),
349
+ /** Per-endpoint-type configuration (partial record — not all endpoint types need to be present) */
350
+ endpointConfigs: zod.record(zod.string().refine((k) => endpointTypeValues.includes(k), { message: `Invalid endpoint type key, must be one of: ${require_model.objectValues(require_model.ENDPOINT_TYPE).join(", ")}` }), RegistryEndpointConfigSchema).optional(),
351
+ /** Default endpoint type for chat requests — null for providers not bound by this (e.g. AWS, Vertex) */
352
+ defaultChatEndpoint: require_model.EndpointTypeSchema.nullable().default(null),
353
+ /**
354
+ * Where this provider's model list comes from. `'registry'` means it cannot
355
+ * be enumerated over an API (login-based subscription providers); the shipped
356
+ * registry catalog is returned by the model-list chokepoint instead. Defaults
357
+ * to `'api'` (the provider exposes a `/models` endpoint).
358
+ */
359
+ modelListSource: zod.enum(["api", "registry"]).default("api"),
360
+ /** Append registry-only models omitted by the API list. Absent means API-only. */
361
+ supplementModelsFromRegistry: zod.boolean().optional(),
362
+ /** Provider-local resource IDs must never match global catalog model names. */
363
+ modelResolution: zod.discriminatedUnion("source", [zod.object({ source: zod.literal("catalog") }), zod.object({
364
+ source: zod.literal("provider"),
365
+ defaults: require_model.ModelConfigSchema.pick({
366
+ capabilities: true,
367
+ inputModalities: true,
368
+ outputModalities: true,
369
+ endpointTypes: true,
370
+ imageGeneration: true
371
+ }).required({
372
+ capabilities: true,
373
+ inputModalities: true,
374
+ outputModalities: true,
375
+ endpointTypes: true
376
+ }).extend({ supportsStreaming: zod.boolean() })
377
+ })]).optional(),
378
+ /**
379
+ * Which credential kinds the provider accepts — the auth UIs to surface and
380
+ * the runtime credential semantics. A *set*, because a provider can offer
381
+ * more than one (CherryIN takes both a user API key and an app-managed OAuth
382
+ * login). Members:
383
+ * - `'api-key'` — user-entered key (the api-key/host inputs).
384
+ * - `'oauth'` — app-managed OAuth session the app holds and refreshes.
385
+ * - `'external-cli'` — credential lives in an external CLI's store and only
386
+ * works through that CLI's runtime (e.g. `claude-code`); drives env
387
+ * stripping and chat-picker hiding.
388
+ *
389
+ * Absent ⇒ the default `['api-key']`. "Login-based" (suppress the api-key
390
+ * inputs) is the derived `!includes('api-key')`, not a value of its own.
391
+ */
392
+ authMethods: require_model.looseArray(zod.enum([
393
+ "api-key",
394
+ "oauth",
395
+ "external-cli"
396
+ ])).optional(),
397
+ /**
398
+ * The provider serves requests without any credential — a local server
399
+ * (ollama / lmstudio / gpustack / ovms) reachable over a baseUrl with no API
400
+ * key or login. Drives the "no API key required" guards: model sync, painting
401
+ * and OpenClaw gating skip the missing-key check. Distinct from login-based
402
+ * (`authMethods` without `'api-key'`), which also suppresses the host UI — a
403
+ * local provider still needs its baseUrl input. Defaults false.
404
+ */
405
+ authOptional: zod.boolean().default(false),
406
+ /** Provider-native (server-executed) built-in tools served by this host. */
407
+ serverTools: require_model.looseArray(ServerToolConfigSchema).default([]),
408
+ /** Whether usage responses carry the actual billed amount. */
409
+ reportsActualCost: zod.boolean().default(false),
410
+ /**
411
+ * Registry-owned currency for provider-reported costs whose wire payload
412
+ * carries an amount but no currency. Absent means the amount stays
413
+ * unpriced; consumers must not infer a default currency.
414
+ */
415
+ reportedCostCurrency: require_model.ZodCurrencySchema,
416
+ /** Provider-owned Fast request transport. Effective support is declared per provider-model pair. */
417
+ fastMode: zod.object({
418
+ transport: FastModeTransportSchema,
419
+ serviceTier: zod.string().optional()
420
+ }).optional(),
421
+ /** Additional metadata including website URLs */
422
+ metadata: require_model.MetadataSchema.and(ProviderWebsiteSchema)
423
+ }).refine((data) => {
424
+ if (data.endpointConfigs && data.defaultChatEndpoint) return data.defaultChatEndpoint in data.endpointConfigs;
425
+ return true;
426
+ }, { message: "defaultChatEndpoint must exist as a key in endpointConfigs" });
427
+ const ProviderListSchema = zod.object({
428
+ version: require_model.VersionSchema,
429
+ providers: require_model.looseArray(ProviderConfigSchema)
430
+ });
431
+ //#endregion
432
+ Object.defineProperty(exports, "FastModeTransportSchema", {
433
+ enumerable: true,
434
+ get: function() {
435
+ return FastModeTransportSchema;
436
+ }
437
+ });
438
+ Object.defineProperty(exports, "ProviderConfigSchema", {
439
+ enumerable: true,
440
+ get: function() {
441
+ return ProviderConfigSchema;
442
+ }
443
+ });
444
+ Object.defineProperty(exports, "ProviderEditionSchema", {
445
+ enumerable: true,
446
+ get: function() {
447
+ return ProviderEditionSchema;
448
+ }
449
+ });
450
+ Object.defineProperty(exports, "ProviderListSchema", {
451
+ enumerable: true,
452
+ get: function() {
453
+ return ProviderListSchema;
454
+ }
455
+ });
456
+ Object.defineProperty(exports, "REASONING_FORMAT_TYPES", {
457
+ enumerable: true,
458
+ get: function() {
459
+ return REASONING_FORMAT_TYPES;
460
+ }
461
+ });
462
+ Object.defineProperty(exports, "REASONING_WIRE_TARGETS", {
463
+ enumerable: true,
464
+ get: function() {
465
+ return REASONING_WIRE_TARGETS;
466
+ }
467
+ });
468
+ Object.defineProperty(exports, "ReasoningFormatWireProfileSchema", {
469
+ enumerable: true,
470
+ get: function() {
471
+ return ReasoningFormatWireProfileSchema;
472
+ }
473
+ });
474
+ Object.defineProperty(exports, "ReasoningWireProfileSchema", {
475
+ enumerable: true,
476
+ get: function() {
477
+ return ReasoningWireProfileSchema;
478
+ }
479
+ });
480
+ Object.defineProperty(exports, "ServerToolConfigSchema", {
481
+ enumerable: true,
482
+ get: function() {
483
+ return ServerToolConfigSchema;
484
+ }
485
+ });
486
+ Object.defineProperty(exports, "ServiceTierDeliverySchema", {
487
+ enumerable: true,
488
+ get: function() {
489
+ return ServiceTierDeliverySchema;
490
+ }
491
+ });
492
+ Object.defineProperty(exports, "ServiceTierOptionsSchema", {
493
+ enumerable: true,
494
+ get: function() {
495
+ return ServiceTierOptionsSchema;
496
+ }
497
+ });
498
+ Object.defineProperty(exports, "ServiceTierRequestControlSchema", {
499
+ enumerable: true,
500
+ get: function() {
501
+ return ServiceTierRequestControlSchema;
502
+ }
503
+ });
504
+ Object.defineProperty(exports, "ServiceTierSelectionSchema", {
505
+ enumerable: true,
506
+ get: function() {
507
+ return ServiceTierSelectionSchema;
508
+ }
509
+ });
510
+ Object.defineProperty(exports, "VENDOR_PATTERNS", {
511
+ enumerable: true,
512
+ get: function() {
513
+ return VENDOR_PATTERNS;
514
+ }
515
+ });
516
+ Object.defineProperty(exports, "isVendor", {
517
+ enumerable: true,
518
+ get: function() {
519
+ return isVendor;
520
+ }
521
+ });
522
+ Object.defineProperty(exports, "matchVendor", {
523
+ enumerable: true,
524
+ get: function() {
525
+ return matchVendor;
526
+ }
527
+ });
@@ -0,0 +1,85 @@
1
+ const require_model = require("./model-kwW2vWDI.cjs");
2
+ const require_provider = require("./provider-DkSIaann.cjs");
3
+ let zod = require("zod");
4
+ zod = require_model.__toESM(zod, 1);
5
+ //#region src/schemas/provider-models.ts
6
+ /**
7
+ * Provider-Model mapping schema definitions
8
+ * Defines how providers can override specific model configurations
9
+ *
10
+ * This file was renamed from override.ts for clearer semantics
11
+ */
12
+ const CapabilityOverrideSchema = zod.object({
13
+ add: require_model.looseArray(require_model.ModelCapabilityTypeSchema).optional(),
14
+ remove: require_model.looseArray(require_model.ModelCapabilityTypeSchema).optional(),
15
+ force: require_model.looseArray(require_model.ModelCapabilityTypeSchema).optional()
16
+ });
17
+ const ReasoningEndpointTypeSchema = zod.enum([
18
+ require_model.ENDPOINT_TYPE.OPENAI_RESPONSES,
19
+ require_model.ENDPOINT_TYPE.OPENAI_CHAT_COMPLETIONS,
20
+ require_model.ENDPOINT_TYPE.ANTHROPIC_MESSAGES,
21
+ require_model.ENDPOINT_TYPE.GOOGLE_GENERATE_CONTENT,
22
+ require_model.ENDPOINT_TYPE.OLLAMA_CHAT,
23
+ require_model.ENDPOINT_TYPE.OLLAMA_GENERATE,
24
+ require_model.ENDPOINT_TYPE.OPENAI_TEXT_COMPLETIONS
25
+ ]);
26
+ const ProviderModelReasoningContractSchema = zod.object({
27
+ /** Provider/endpoint-specific support. Declared controls replace intrinsic model controls. */
28
+ support: require_model.ReasoningSupportSchema.optional(),
29
+ /** Exact provider/endpoint wire behavior. */
30
+ wire: require_provider.ReasoningWireProfileSchema.optional()
31
+ }).refine((contract) => contract.support || contract.wire, { message: "provider-model reasoning contract must declare support or wire" });
32
+ const ProviderModelOverrideSchema = zod.object({
33
+ providerId: require_model.ProviderIdSchema,
34
+ modelId: require_model.ModelIdSchema,
35
+ apiModelId: zod.string().optional(),
36
+ modelVariants: zod.array(zod.string().min(1)).optional(),
37
+ capabilities: CapabilityOverrideSchema.optional(),
38
+ limits: zod.object({
39
+ contextWindow: zod.number().optional(),
40
+ maxOutputTokens: zod.number().optional(),
41
+ maxInputTokens: zod.number().optional()
42
+ }).optional(),
43
+ pricing: require_model.PartialModelPricingSchema.optional(),
44
+ /** Exact reasoning behavior keyed by the endpoint used for this provider-model pair. */
45
+ reasoningContracts: zod.partialRecord(ReasoningEndpointTypeSchema, ProviderModelReasoningContractSchema).optional(),
46
+ /** Whether this exact provider-model pair supports the provider's Fast transport. */
47
+ supportsFastMode: zod.boolean().optional(),
48
+ /** Model-specific option overrides for endpoint-owned request controls. */
49
+ requestControls: zod.object({ serviceTier: zod.object({ options: require_provider.ServiceTierOptionsSchema }).optional() }).optional(),
50
+ parameterSupport: require_model.ParameterSupportSchema.partial().optional(),
51
+ endpointTypes: require_model.looseArray(require_model.EndpointTypeSchema).optional(),
52
+ inputModalities: require_model.looseArray(require_model.ModalitySchema).optional(),
53
+ outputModalities: require_model.looseArray(require_model.ModalitySchema).optional(),
54
+ name: zod.string().optional(),
55
+ description: zod.string().optional(),
56
+ family: zod.string().optional(),
57
+ ownedBy: zod.string().optional(),
58
+ imageGeneration: require_model.ImageGenerationSupportSchema.optional(),
59
+ disabled: zod.boolean().optional(),
60
+ replaceWith: require_model.ModelIdSchema.optional(),
61
+ reason: zod.string().optional()
62
+ });
63
+ const ProviderModelListSchema = zod.object({
64
+ version: require_model.VersionSchema,
65
+ overrides: require_model.looseArray(ProviderModelOverrideSchema)
66
+ });
67
+ //#endregion
68
+ Object.defineProperty(exports, "ProviderModelListSchema", {
69
+ enumerable: true,
70
+ get: function() {
71
+ return ProviderModelListSchema;
72
+ }
73
+ });
74
+ Object.defineProperty(exports, "ProviderModelOverrideSchema", {
75
+ enumerable: true,
76
+ get: function() {
77
+ return ProviderModelOverrideSchema;
78
+ }
79
+ });
80
+ Object.defineProperty(exports, "ProviderModelReasoningContractSchema", {
81
+ enumerable: true,
82
+ get: function() {
83
+ return ProviderModelReasoningContractSchema;
84
+ }
85
+ });
@@ -0,0 +1,67 @@
1
+ import { b as ENDPOINT_TYPE, c as PartialModelPricingSchema, d as looseArray, f as EndpointTypeSchema, g as VersionSchema, h as ProviderIdSchema, i as ModelCapabilityTypeSchema, m as ModelIdSchema, n as ImageGenerationSupportSchema, r as ModalitySchema, s as ParameterSupportSchema, u as ReasoningSupportSchema } from "./model-NFEbqWMs.mjs";
2
+ import { c as ServiceTierOptionsSchema, p as ReasoningWireProfileSchema } from "./provider-D14qMZsE.mjs";
3
+ import * as z from "zod";
4
+ //#region src/schemas/provider-models.ts
5
+ /**
6
+ * Provider-Model mapping schema definitions
7
+ * Defines how providers can override specific model configurations
8
+ *
9
+ * This file was renamed from override.ts for clearer semantics
10
+ */
11
+ const CapabilityOverrideSchema = z.object({
12
+ add: looseArray(ModelCapabilityTypeSchema).optional(),
13
+ remove: looseArray(ModelCapabilityTypeSchema).optional(),
14
+ force: looseArray(ModelCapabilityTypeSchema).optional()
15
+ });
16
+ const ReasoningEndpointTypeSchema = z.enum([
17
+ ENDPOINT_TYPE.OPENAI_RESPONSES,
18
+ ENDPOINT_TYPE.OPENAI_CHAT_COMPLETIONS,
19
+ ENDPOINT_TYPE.ANTHROPIC_MESSAGES,
20
+ ENDPOINT_TYPE.GOOGLE_GENERATE_CONTENT,
21
+ ENDPOINT_TYPE.OLLAMA_CHAT,
22
+ ENDPOINT_TYPE.OLLAMA_GENERATE,
23
+ ENDPOINT_TYPE.OPENAI_TEXT_COMPLETIONS
24
+ ]);
25
+ const ProviderModelReasoningContractSchema = z.object({
26
+ /** Provider/endpoint-specific support. Declared controls replace intrinsic model controls. */
27
+ support: ReasoningSupportSchema.optional(),
28
+ /** Exact provider/endpoint wire behavior. */
29
+ wire: ReasoningWireProfileSchema.optional()
30
+ }).refine((contract) => contract.support || contract.wire, { message: "provider-model reasoning contract must declare support or wire" });
31
+ const ProviderModelOverrideSchema = z.object({
32
+ providerId: ProviderIdSchema,
33
+ modelId: ModelIdSchema,
34
+ apiModelId: z.string().optional(),
35
+ modelVariants: z.array(z.string().min(1)).optional(),
36
+ capabilities: CapabilityOverrideSchema.optional(),
37
+ limits: z.object({
38
+ contextWindow: z.number().optional(),
39
+ maxOutputTokens: z.number().optional(),
40
+ maxInputTokens: z.number().optional()
41
+ }).optional(),
42
+ pricing: PartialModelPricingSchema.optional(),
43
+ /** Exact reasoning behavior keyed by the endpoint used for this provider-model pair. */
44
+ reasoningContracts: z.partialRecord(ReasoningEndpointTypeSchema, ProviderModelReasoningContractSchema).optional(),
45
+ /** Whether this exact provider-model pair supports the provider's Fast transport. */
46
+ supportsFastMode: z.boolean().optional(),
47
+ /** Model-specific option overrides for endpoint-owned request controls. */
48
+ requestControls: z.object({ serviceTier: z.object({ options: ServiceTierOptionsSchema }).optional() }).optional(),
49
+ parameterSupport: ParameterSupportSchema.partial().optional(),
50
+ endpointTypes: looseArray(EndpointTypeSchema).optional(),
51
+ inputModalities: looseArray(ModalitySchema).optional(),
52
+ outputModalities: looseArray(ModalitySchema).optional(),
53
+ name: z.string().optional(),
54
+ description: z.string().optional(),
55
+ family: z.string().optional(),
56
+ ownedBy: z.string().optional(),
57
+ imageGeneration: ImageGenerationSupportSchema.optional(),
58
+ disabled: z.boolean().optional(),
59
+ replaceWith: ModelIdSchema.optional(),
60
+ reason: z.string().optional()
61
+ });
62
+ const ProviderModelListSchema = z.object({
63
+ version: VersionSchema,
64
+ overrides: looseArray(ProviderModelOverrideSchema)
65
+ });
66
+ //#endregion
67
+ export { ProviderModelOverrideSchema as n, ProviderModelReasoningContractSchema as r, ProviderModelListSchema as t };