@agentproto/model-catalog 0.2.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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/access/index.d.ts +30 -0
  4. package/dist/access/index.mjs +4 -0
  5. package/dist/access/index.mjs.map +1 -0
  6. package/dist/audio/index.d.ts +84 -0
  7. package/dist/audio/index.mjs +3 -0
  8. package/dist/audio/index.mjs.map +1 -0
  9. package/dist/audio-BzVF_wke.d.ts +92 -0
  10. package/dist/base-BNHcMifc.d.ts +109 -0
  11. package/dist/byok/index.d.ts +33 -0
  12. package/dist/byok/index.mjs +3 -0
  13. package/dist/byok/index.mjs.map +1 -0
  14. package/dist/catalog-aQHd559b.d.ts +594 -0
  15. package/dist/chunk-2LWYZOWB.mjs +643 -0
  16. package/dist/chunk-2LWYZOWB.mjs.map +1 -0
  17. package/dist/chunk-CINXNTU3.mjs +134 -0
  18. package/dist/chunk-CINXNTU3.mjs.map +1 -0
  19. package/dist/chunk-F7OEHYUI.mjs +187 -0
  20. package/dist/chunk-F7OEHYUI.mjs.map +1 -0
  21. package/dist/chunk-GH7PB5FB.mjs +183 -0
  22. package/dist/chunk-GH7PB5FB.mjs.map +1 -0
  23. package/dist/chunk-H6JUTF3U.mjs +33 -0
  24. package/dist/chunk-H6JUTF3U.mjs.map +1 -0
  25. package/dist/chunk-HEDDSOZF.mjs +47 -0
  26. package/dist/chunk-HEDDSOZF.mjs.map +1 -0
  27. package/dist/chunk-HRRG2RZO.mjs +116 -0
  28. package/dist/chunk-HRRG2RZO.mjs.map +1 -0
  29. package/dist/chunk-IJZ4XPO2.mjs +606 -0
  30. package/dist/chunk-IJZ4XPO2.mjs.map +1 -0
  31. package/dist/chunk-IORIAFK2.mjs +227 -0
  32. package/dist/chunk-IORIAFK2.mjs.map +1 -0
  33. package/dist/chunk-OHAMH3ZE.mjs +2629 -0
  34. package/dist/chunk-OHAMH3ZE.mjs.map +1 -0
  35. package/dist/chunk-QHELXPSL.mjs +85 -0
  36. package/dist/chunk-QHELXPSL.mjs.map +1 -0
  37. package/dist/chunk-SGJR6ZQH.mjs +1230 -0
  38. package/dist/chunk-SGJR6ZQH.mjs.map +1 -0
  39. package/dist/chunk-WRUWNKDB.mjs +521 -0
  40. package/dist/chunk-WRUWNKDB.mjs.map +1 -0
  41. package/dist/chunk-WTHHXXIK.mjs +366 -0
  42. package/dist/chunk-WTHHXXIK.mjs.map +1 -0
  43. package/dist/chunk-XFDXTFV3.mjs +28 -0
  44. package/dist/chunk-XFDXTFV3.mjs.map +1 -0
  45. package/dist/cost/index.d.ts +114 -0
  46. package/dist/cost/index.mjs +13 -0
  47. package/dist/cost/index.mjs.map +1 -0
  48. package/dist/curation/index.d.ts +98 -0
  49. package/dist/curation/index.mjs +13 -0
  50. package/dist/curation/index.mjs.map +1 -0
  51. package/dist/evaluate-DisH3H7u.d.ts +84 -0
  52. package/dist/image/index.d.ts +79 -0
  53. package/dist/image/index.mjs +3 -0
  54. package/dist/image/index.mjs.map +1 -0
  55. package/dist/index-BICjPG8H.d.ts +132 -0
  56. package/dist/index-D8nL3fPZ.d.ts +171 -0
  57. package/dist/index.d.ts +94 -0
  58. package/dist/index.mjs +33 -0
  59. package/dist/index.mjs.map +1 -0
  60. package/dist/llm/index.d.ts +48 -0
  61. package/dist/llm/index.mjs +4 -0
  62. package/dist/llm/index.mjs.map +1 -0
  63. package/dist/overlay/index.d.ts +67 -0
  64. package/dist/overlay/index.mjs +3 -0
  65. package/dist/overlay/index.mjs.map +1 -0
  66. package/dist/picker/index.d.ts +11 -0
  67. package/dist/picker/index.mjs +26 -0
  68. package/dist/picker/index.mjs.map +1 -0
  69. package/dist/pricing/index.d.ts +106 -0
  70. package/dist/pricing/index.mjs +3 -0
  71. package/dist/pricing/index.mjs.map +1 -0
  72. package/dist/providers/index.d.ts +78 -0
  73. package/dist/providers/index.mjs +237 -0
  74. package/dist/providers/index.mjs.map +1 -0
  75. package/dist/schema/index.d.ts +627 -0
  76. package/dist/schema/index.mjs +4 -0
  77. package/dist/schema/index.mjs.map +1 -0
  78. package/dist/schema/voice.d.ts +66 -0
  79. package/dist/schema/voice.mjs +3 -0
  80. package/dist/schema/voice.mjs.map +1 -0
  81. package/dist/video/index.d.ts +78 -0
  82. package/dist/video/index.mjs +3 -0
  83. package/dist/video/index.mjs.map +1 -0
  84. package/dist/voice/index.d.ts +1300 -0
  85. package/dist/voice/index.mjs +4 -0
  86. package/dist/voice/index.mjs.map +1 -0
  87. package/package.json +137 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jeremy André and agentproto contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @agentproto/model-catalog
2
+
3
+ A dependency-light (**zod-only**) unified model catalog for LLM, image, video,
4
+ audio and voice models — with a cost dispatcher, curation, pricing, and a
5
+ picker.
6
+
7
+ This is the OSS core. Downstream consumers layer their own policy on top:
8
+ `@agstudio/model-catalog` adds billing / access / BYOK; the `agentproto` CLI
9
+ adds a provider-key store and the `agentproto models` picker.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm add @agentproto/model-catalog
15
+ ```
16
+
17
+ ## Subpaths
18
+
19
+ | Import | What |
20
+ | --- | --- |
21
+ | `@agentproto/model-catalog` | everything re-exported |
22
+ | `…/schema` | zod schemas + shared types (incl. `BillingUnit`, `CostMultipliers`) |
23
+ | `…/llm` · `…/image` · `…/video` · `…/audio` · `…/voice` | per-modality catalogs |
24
+ | `…/cost` · `…/pricing` | cost dispatcher + pricing helpers |
25
+ | `…/curation` · `…/picker` | surfacing + selection helpers |
26
+ | `…/byok` · `…/access` | policy hooks (debit decision, access evaluation) |
27
+
28
+ ```ts
29
+ import { LLM_PRICING_CATALOG } from "@agentproto/model-catalog/llm"
30
+
31
+ const p = LLM_PRICING_CATALOG["claude-opus-4-8"]
32
+ // → { inputPer1M, outputPer1M, provider, … }
33
+ ```
34
+
35
+ ## License
36
+
37
+ MIT
@@ -0,0 +1,30 @@
1
+ export { A as AccessDecision, a as AccessEffect, b as AccessEvalInput, c as AccessRule, d as AccessTarget, e as AppScope, f as evaluateAccess } from '../evaluate-DisH3H7u.js';
2
+ import { R as ResolvedModel } from '../index-BICjPG8H.js';
3
+ import '../base-BNHcMifc.js';
4
+ import 'zod';
5
+ import '../catalog-aQHd559b.js';
6
+ import '../image/index.js';
7
+ import '../video/index.js';
8
+ import '../audio/index.js';
9
+ import '../audio-BzVF_wke.js';
10
+ import '../schema/voice.js';
11
+
12
+ /**
13
+ * Catalog-flag defaults — the layer that runs before any workspace
14
+ * override. Mirrors the access-control plan:
15
+ * - Default-allow: `lifecycle = stable && agentVisible = true`
16
+ * - Default-block: `lifecycle = preview` or `lifecycle = deprecated`
17
+ * - Default-block: any model with `agentVisible = false`
18
+ *
19
+ * Legacy catalog data (image/video) carries `agentVisible` but not
20
+ * `lifecycle` — until v2 normalization, lifecycle defaults to "stable"
21
+ * for every entry. LLM and audio entries default to allow (curated).
22
+ */
23
+
24
+ interface CatalogDefaultDecision {
25
+ allowed: boolean;
26
+ reason: string;
27
+ }
28
+ declare function evaluateCatalogDefaults(model: ResolvedModel): CatalogDefaultDecision;
29
+
30
+ export { type CatalogDefaultDecision, evaluateCatalogDefaults };
@@ -0,0 +1,4 @@
1
+ export { evaluateAccess, evaluateCatalogDefaults } from '../chunk-HRRG2RZO.mjs';
2
+ import '../chunk-WTHHXXIK.mjs';
3
+ //# sourceMappingURL=index.mjs.map
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,84 @@
1
+ import { A as AudioCapabilities } from '../audio-BzVF_wke.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Audio Model Catalog — TTS + STT provider models.
6
+ *
7
+ * Pairs with the voice catalog (`@agentproto/model-catalog/voice`) but a
8
+ * separate concern: voices describe *what the output sounds like*, models
9
+ * here describe *how the provider bills*. A single TTS model (e.g.
10
+ * ElevenLabs `multilingual-v2`) can render hundreds of voices at the
11
+ * same rate.
12
+ *
13
+ * Billing follows the per-kind dispatcher in `cost/index.ts`:
14
+ * - TTS bills `per_1k_chars` (multiply characters/1000 × creditCost)
15
+ * - STT bills `per_minute` (multiply ceil(seconds/60) × creditCost)
16
+ *
17
+ * Adding a model = 1 entry here + (if used by an integration) a
18
+ * provider call-site that passes the model id to the cost dispatcher
19
+ * so `calculateCost(modelId, { kind: "audio", characters / seconds })`
20
+ * returns real numbers instead of the placeholder.
21
+ *
22
+ * Prices are point-in-time (refresh monthly via the drift-check
23
+ * script). Sources noted per entry — production cost ≠ retail; we
24
+ * markup ~1.25-1.5× into `creditCost` (displayed credits, 1 cred ≈
25
+ * €0.01) consistent with the image/video catalogs.
26
+ */
27
+
28
+ /**
29
+ * Audio MODALITY labels — what an audio model does. A model may do more
30
+ * than one (e.g. a combined engine, or a provider exposing both cascade
31
+ * TTS and conversational s2s), so these are boolean flags on
32
+ * `AudioCapabilities`, not a single discriminator. The model's catalog
33
+ * `kind` is always the family `"audio"`; modality lives here.
34
+ * - `tts` — text → speech
35
+ * - `stt` — speech → text
36
+ * - `s2s` — speech ↔ speech (one model; distinct from a tts+llm+stt cascade)
37
+ */
38
+ type AudioModality = "tts" | "stt" | "s2s";
39
+ type AudioBillingUnit = "per_1k_chars" | "per_minute" | "per_second";
40
+ type AudioProvider = "elevenlabs" | "minimax" | "openai" | "replicate" | "deepgram" | "assemblyai" | "google";
41
+ interface AudioPricing {
42
+ /** How the provider charges (drives the cost dispatcher math). */
43
+ billingUnit: AudioBillingUnit;
44
+ /** Production cost in USD per `billingUnit`. */
45
+ baseCost: number;
46
+ /**
47
+ * @deprecated Credits derived at call time via
48
+ * `computeCenticredits({ baseCostUsd: baseCost, category: "audio" })`.
49
+ * Kept optional for back-compat with existing entries.
50
+ */
51
+ creditCost?: number;
52
+ /** Bypass markup formula and charge exactly this many credits per billingUnit. */
53
+ overrideCreditCost?: number;
54
+ }
55
+
56
+ interface AudioModelDefinition {
57
+ id: string;
58
+ name: string;
59
+ /** Provider-facing identifier (e.g. `eleven_multilingual_v2`, `nova-3`). */
60
+ providerId: string;
61
+ provider: AudioProvider;
62
+ capabilities: AudioCapabilities;
63
+ pricing: AudioPricing;
64
+ description: string;
65
+ agentVisible: boolean;
66
+ }
67
+ declare const AUDIO_MODEL_CATALOG: Record<string, AudioModelDefinition>;
68
+ declare const AUDIO_MODEL_IDS: [string, ...string[]];
69
+ declare const AGENT_AUDIO_MODEL_IDS: [string, ...string[]];
70
+ declare const AGENT_TTS_MODEL_IDS: [string, ...string[]];
71
+ declare const AGENT_STT_MODEL_IDS: [string, ...string[]];
72
+ /** All catalog s2s entry ids (internal billing ids). */
73
+ declare const S2S_MODEL_IDS: string[];
74
+ /** Provider model strings the Gemini Live adapter accepts server-side,
75
+ * derived from the catalog's google/s2s entries. */
76
+ declare const GEMINI_LIVE_MODEL_IDS: string[];
77
+ /** Default Gemini Live model — the low-latency flash tier (`google/gemini-live`). */
78
+ declare const DEFAULT_GEMINI_LIVE_MODEL: string;
79
+ /** True when `id` is one of the accepted Gemini Live provider model strings. */
80
+ declare function isAcceptedGeminiLiveModel(id: string): boolean;
81
+ /** Generate a markdown table of agent-visible TTS / STT models for prompt blocks */
82
+ declare function generateAudioModelTable(modality?: AudioModality): string;
83
+
84
+ export { AGENT_AUDIO_MODEL_IDS, AGENT_STT_MODEL_IDS, AGENT_TTS_MODEL_IDS, AUDIO_MODEL_CATALOG, AUDIO_MODEL_IDS, type AudioBillingUnit, type AudioModality, type AudioModelDefinition, type AudioProvider, DEFAULT_GEMINI_LIVE_MODEL, GEMINI_LIVE_MODEL_IDS, S2S_MODEL_IDS, generateAudioModelTable, isAcceptedGeminiLiveModel };
@@ -0,0 +1,3 @@
1
+ export { AGENT_AUDIO_MODEL_IDS, AGENT_STT_MODEL_IDS, AGENT_TTS_MODEL_IDS, AUDIO_MODEL_CATALOG, AUDIO_MODEL_IDS, DEFAULT_GEMINI_LIVE_MODEL, GEMINI_LIVE_MODEL_IDS, S2S_MODEL_IDS, generateAudioModelTable, isAcceptedGeminiLiveModel } from '../chunk-WRUWNKDB.mjs';
2
+ //# sourceMappingURL=index.mjs.map
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,92 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const AudioCapabilitiesSchema: z.ZodObject<{
4
+ tts: z.ZodOptional<z.ZodBoolean>;
5
+ stt: z.ZodOptional<z.ZodBoolean>;
6
+ s2s: z.ZodOptional<z.ZodBoolean>;
7
+ languages: z.ZodArray<z.ZodString>;
8
+ voiceCloning: z.ZodOptional<z.ZodBoolean>;
9
+ streaming: z.ZodOptional<z.ZodBoolean>;
10
+ timestamps: z.ZodOptional<z.ZodBoolean>;
11
+ diarization: z.ZodOptional<z.ZodBoolean>;
12
+ languageDetection: z.ZodOptional<z.ZodBoolean>;
13
+ }, z.core.$strip>;
14
+ type AudioCapabilities = z.infer<typeof AudioCapabilitiesSchema>;
15
+ declare const AudioPricingSchema: z.ZodObject<{
16
+ billingUnit: z.ZodEnum<{
17
+ per_second: "per_second";
18
+ per_character: "per_character";
19
+ }>;
20
+ baseCost: z.ZodNumber;
21
+ baseCostUnit: z.ZodOptional<z.ZodString>;
22
+ creditCost: z.ZodOptional<z.ZodNumber>;
23
+ overrideCreditCost: z.ZodOptional<z.ZodNumber>;
24
+ }, z.core.$strip>;
25
+ type AudioPricing = z.infer<typeof AudioPricingSchema>;
26
+ declare const AudioEntrySchema: z.ZodObject<{
27
+ kind: z.ZodLiteral<"audio">;
28
+ capabilities: z.ZodObject<{
29
+ tts: z.ZodOptional<z.ZodBoolean>;
30
+ stt: z.ZodOptional<z.ZodBoolean>;
31
+ s2s: z.ZodOptional<z.ZodBoolean>;
32
+ languages: z.ZodArray<z.ZodString>;
33
+ voiceCloning: z.ZodOptional<z.ZodBoolean>;
34
+ streaming: z.ZodOptional<z.ZodBoolean>;
35
+ timestamps: z.ZodOptional<z.ZodBoolean>;
36
+ diarization: z.ZodOptional<z.ZodBoolean>;
37
+ languageDetection: z.ZodOptional<z.ZodBoolean>;
38
+ }, z.core.$strip>;
39
+ pricing: z.ZodObject<{
40
+ billingUnit: z.ZodEnum<{
41
+ per_second: "per_second";
42
+ per_character: "per_character";
43
+ }>;
44
+ baseCost: z.ZodNumber;
45
+ baseCostUnit: z.ZodOptional<z.ZodString>;
46
+ creditCost: z.ZodOptional<z.ZodNumber>;
47
+ overrideCreditCost: z.ZodOptional<z.ZodNumber>;
48
+ }, z.core.$strip>;
49
+ supportedLocales: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
+ id: z.ZodString;
51
+ name: z.ZodString;
52
+ description: z.ZodDefault<z.ZodString>;
53
+ provider: z.ZodEnum<{
54
+ anthropic: "anthropic";
55
+ assemblyai: "assemblyai";
56
+ deepgram: "deepgram";
57
+ elevenlabs: "elevenlabs";
58
+ "gemini-live": "gemini-live";
59
+ google: "google";
60
+ minimax: "minimax";
61
+ mistral: "mistral";
62
+ moonshot: "moonshot";
63
+ openai: "openai";
64
+ "openai-realtime": "openai-realtime";
65
+ openrouter: "openrouter";
66
+ replicate: "replicate";
67
+ }>;
68
+ providerId: z.ZodString;
69
+ agentVisible: z.ZodDefault<z.ZodBoolean>;
70
+ lifecycle: z.ZodDefault<z.ZodEnum<{
71
+ stable: "stable";
72
+ preview: "preview";
73
+ deprecated: "deprecated";
74
+ }>>;
75
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
76
+ catalogPriceTier: z.ZodDefault<z.ZodEnum<{
77
+ low: "low";
78
+ mid: "mid";
79
+ high: "high";
80
+ premium: "premium";
81
+ }>>;
82
+ nsfwPolicy: z.ZodDefault<z.ZodEnum<{
83
+ filtered: "filtered";
84
+ permissive: "permissive";
85
+ strict: "strict";
86
+ }>>;
87
+ regions: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
+ }, z.core.$strip>;
90
+ type AudioEntry = z.infer<typeof AudioEntrySchema>;
91
+
92
+ export { type AudioCapabilities as A, AudioCapabilitiesSchema as a, type AudioEntry as b, AudioEntrySchema as c, type AudioPricing as d, AudioPricingSchema as e };
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Shared schema fragments for every model catalog entry.
5
+ *
6
+ * `baseEntryShape` is spread into per-kind schemas so each kind stays a
7
+ * plain `z.object` — required by `z.discriminatedUnion`.
8
+ *
9
+ * Mirrors the pattern in
10
+ * `packages/agencies/registry-client/src/types.ts` (`basePayloadShape`).
11
+ */
12
+ declare const ModelKindSchema: z.ZodEnum<{
13
+ llm: "llm";
14
+ image: "image";
15
+ video: "video";
16
+ audio: "audio";
17
+ }>;
18
+ type ModelKind = z.infer<typeof ModelKindSchema>;
19
+ declare const LifecycleSchema: z.ZodEnum<{
20
+ stable: "stable";
21
+ preview: "preview";
22
+ deprecated: "deprecated";
23
+ }>;
24
+ type Lifecycle = z.infer<typeof LifecycleSchema>;
25
+ /**
26
+ * `catalogPriceTier` — the model's intrinsic cost bucket. Distinct from
27
+ * `subscriptionPlanTier` (the user's billing level) and `modelPreset`
28
+ * (an app's per-conversation UX picker). Always qualify when discussing
29
+ * tiers — bare `priceTier` / `tier` is ambiguous in this codebase.
30
+ */
31
+ declare const CatalogPriceTierSchema: z.ZodEnum<{
32
+ low: "low";
33
+ mid: "mid";
34
+ high: "high";
35
+ premium: "premium";
36
+ }>;
37
+ type CatalogPriceTier = z.infer<typeof CatalogPriceTierSchema>;
38
+ declare const NsfwPolicySchema: z.ZodEnum<{
39
+ filtered: "filtered";
40
+ permissive: "permissive";
41
+ strict: "strict";
42
+ }>;
43
+ type NsfwPolicy = z.infer<typeof NsfwPolicySchema>;
44
+ /**
45
+ * Canonical model-provider registry — the single source of truth for the
46
+ * `provider` field on every catalog entry. Adding a model on a new
47
+ * provider means adding it here first, so a typo or an un-onboarded
48
+ * provider is a validation/build error rather than a silently-broken
49
+ * entry. `CatalogVoiceProviderSchema` is the voice-callable subset.
50
+ */
51
+ declare const CatalogProviderSchema: z.ZodEnum<{
52
+ anthropic: "anthropic";
53
+ assemblyai: "assemblyai";
54
+ deepgram: "deepgram";
55
+ elevenlabs: "elevenlabs";
56
+ "gemini-live": "gemini-live";
57
+ google: "google";
58
+ minimax: "minimax";
59
+ mistral: "mistral";
60
+ moonshot: "moonshot";
61
+ openai: "openai";
62
+ "openai-realtime": "openai-realtime";
63
+ openrouter: "openrouter";
64
+ replicate: "replicate";
65
+ }>;
66
+ type CatalogProvider = z.infer<typeof CatalogProviderSchema>;
67
+ declare const baseEntryShape: {
68
+ readonly id: z.ZodString;
69
+ readonly name: z.ZodString;
70
+ readonly description: z.ZodDefault<z.ZodString>;
71
+ readonly provider: z.ZodEnum<{
72
+ anthropic: "anthropic";
73
+ assemblyai: "assemblyai";
74
+ deepgram: "deepgram";
75
+ elevenlabs: "elevenlabs";
76
+ "gemini-live": "gemini-live";
77
+ google: "google";
78
+ minimax: "minimax";
79
+ mistral: "mistral";
80
+ moonshot: "moonshot";
81
+ openai: "openai";
82
+ "openai-realtime": "openai-realtime";
83
+ openrouter: "openrouter";
84
+ replicate: "replicate";
85
+ }>;
86
+ readonly providerId: z.ZodString;
87
+ readonly agentVisible: z.ZodDefault<z.ZodBoolean>;
88
+ readonly lifecycle: z.ZodDefault<z.ZodEnum<{
89
+ stable: "stable";
90
+ preview: "preview";
91
+ deprecated: "deprecated";
92
+ }>>;
93
+ readonly tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
94
+ readonly catalogPriceTier: z.ZodDefault<z.ZodEnum<{
95
+ low: "low";
96
+ mid: "mid";
97
+ high: "high";
98
+ premium: "premium";
99
+ }>>;
100
+ readonly nsfwPolicy: z.ZodDefault<z.ZodEnum<{
101
+ filtered: "filtered";
102
+ permissive: "permissive";
103
+ strict: "strict";
104
+ }>>;
105
+ readonly regions: z.ZodOptional<z.ZodArray<z.ZodString>>;
106
+ readonly aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ };
108
+
109
+ export { type CatalogProvider as C, type Lifecycle as L, type ModelKind as M, type NsfwPolicy as N, type CatalogPriceTier as a, CatalogPriceTierSchema as b, CatalogProviderSchema as c, LifecycleSchema as d, ModelKindSchema as e, NsfwPolicySchema as f, baseEntryShape as g };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * BYOK (Bring Your Own Keys) policy.
3
+ *
4
+ * Single pure function — `shouldDebit` — that decides whether a model
5
+ * run should debit user credits or be recorded as a non-debiting shadow
6
+ * usage row. Truth table mirrors the open-coded behavior at
7
+ * the app orchestrator
8
+ * (commit `eeb1acdc`):
9
+ *
10
+ * byokActive | hasConnector | result
11
+ * -----------|--------------|----------------------------------
12
+ * true | true | { debit: false, shadow: true }
13
+ * true | false | { debit: true, shadow: false } ← BYOK flag set but no key — fall back to credits
14
+ * false | true | { debit: true, shadow: false }
15
+ * false | false | { debit: true, shadow: false }
16
+ *
17
+ * No DB calls, no I/O. Caller (orchestrator, MCP server) is responsible
18
+ * for resolving `byokActive` and `hasConnector` upstream.
19
+ */
20
+ interface ShouldDebitInput {
21
+ modelId: string;
22
+ byokActive: boolean;
23
+ hasConnector: boolean;
24
+ }
25
+ interface ShouldDebitDecision {
26
+ debit: boolean;
27
+ shadow: boolean;
28
+ /** Stable string for logs/metrics; not user-facing copy. */
29
+ reason: "byok-active-with-connector" | "byok-flag-but-no-connector" | "non-byok";
30
+ }
31
+ declare function shouldDebit(input: ShouldDebitInput): ShouldDebitDecision;
32
+
33
+ export { type ShouldDebitDecision, type ShouldDebitInput, shouldDebit };
@@ -0,0 +1,3 @@
1
+ export { shouldDebit } from '../chunk-XFDXTFV3.mjs';
2
+ //# sourceMappingURL=index.mjs.map
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}