@molecule/api-resource-ai-models 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +115 -0
- package/dist/browser-guard.d.ts +2 -0
- package/dist/browser-guard.d.ts.map +1 -0
- package/dist/browser-guard.js +18 -0
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +1 -0
- package/dist/handlers/list.d.ts +34 -0
- package/dist/handlers/list.d.ts.map +1 -0
- package/dist/handlers/list.js +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/lookup.d.ts +93 -0
- package/dist/lookup.d.ts.map +1 -0
- package/dist/lookup.js +121 -0
- package/dist/models.d.ts +78 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +1233 -0
- package/dist/requestHandlerMap.d.ts +13 -0
- package/dist/requestHandlerMap.d.ts.map +1 -0
- package/dist/requestHandlerMap.js +12 -0
- package/dist/routes.d.ts +13 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +14 -0
- package/dist/types.d.ts +315 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/package.json +59 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps route handler names to their implementations.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { list } from './handlers/list.js';
|
|
7
|
+
/**
|
|
8
|
+
* Map of request handlers for the AI model catalog routes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const requestHandlerMap: {
|
|
11
|
+
readonly list: typeof list;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=requestHandlerMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestHandlerMap.d.ts","sourceRoot":"","sources":["../src/requestHandlerMap.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,iBAAiB;;CAEpB,CAAA"}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI model catalog routes.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** Route array for the AI model catalog: GET list of available models. */
|
|
7
|
+
export declare const routes: readonly [{
|
|
8
|
+
readonly method: "get";
|
|
9
|
+
readonly path: "/ai/models";
|
|
10
|
+
readonly handler: "list";
|
|
11
|
+
readonly middlewares: readonly ["authenticate"];
|
|
12
|
+
}];
|
|
13
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,MAAM;;;;;EAOT,CAAA"}
|
package/dist/routes.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI model catalog routes.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** Route array for the AI model catalog: GET list of available models. */
|
|
7
|
+
export const routes = [
|
|
8
|
+
{
|
|
9
|
+
method: 'get',
|
|
10
|
+
path: '/ai/models',
|
|
11
|
+
handler: 'list',
|
|
12
|
+
middlewares: ['authenticate'],
|
|
13
|
+
},
|
|
14
|
+
];
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI model catalog types.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for model metadata. The full `ModelDefinition` is
|
|
5
|
+
* consumed both by server-side code (chat handler, compaction) and over the
|
|
6
|
+
* wire by `GET /ai/models`. Nothing in this shape is sensitive enough to hide
|
|
7
|
+
* from authenticated clients today; if that changes, introduce a `PublicModel`
|
|
8
|
+
* projection here and have the handler convert before responding.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* AI provider identifier.
|
|
14
|
+
*
|
|
15
|
+
* Maps to the bond category used at runtime (e.g. `bond('ai', 'anthropic', anthropicProvider)`).
|
|
16
|
+
* Adding a new provider here means a corresponding AI bond package must exist.
|
|
17
|
+
*/
|
|
18
|
+
export type AIProviderID = 'anthropic' | 'openai' | 'google' | 'xai' | 'deepseek' | 'meta' | 'moonshot' | 'minimax' | 'alibaba' | 'zhipu'
|
|
19
|
+
/**
|
|
20
|
+
* A model served by a USER-configured endpoint + key (bring-your-own AI)
|
|
21
|
+
* rather than a platform bond. Never appears in the static catalog — hosts
|
|
22
|
+
* synthesize these definitions at runtime from per-project provider config,
|
|
23
|
+
* with all prices 0 (the user pays their own provider directly).
|
|
24
|
+
*/
|
|
25
|
+
| 'custom';
|
|
26
|
+
/**
|
|
27
|
+
* A reasoning-effort value — a model's OWN native effort level.
|
|
28
|
+
*
|
|
29
|
+
* There is no abstract cross-model scale: the value stored on a project and
|
|
30
|
+
* sent to the provider IS the model's real level (e.g. `'high'` / `'xhigh'` /
|
|
31
|
+
* `'max'` on current Claude models, `'medium'` on Grok, or a scaled
|
|
32
|
+
* thinking-budget label like `'16K'` on budget-configurable models). Each model
|
|
33
|
+
* declares its own ordered {@link ModelDefinition.supportedEffortLevels}; a
|
|
34
|
+
* value that isn't in the active model's set degrades to the nearest one (see
|
|
35
|
+
* `model-selection.ts`). Mirrored by the client-side `EffortLevel` in
|
|
36
|
+
* `@molecule/app-ai-models`; keep the two in sync. Re-declared (rather than
|
|
37
|
+
* imported) by the ide-react and molecule-dev consumers per the cross-stack
|
|
38
|
+
* rule, but this catalog is the canonical home.
|
|
39
|
+
*/
|
|
40
|
+
export type EffortLevel = string;
|
|
41
|
+
/**
|
|
42
|
+
* Full server-side metadata for an AI model. Consumed directly by the chat
|
|
43
|
+
* handler, compaction, and any other server-side cost / budget logic.
|
|
44
|
+
*/
|
|
45
|
+
export interface ModelDefinition {
|
|
46
|
+
/** API model ID (e.g. `'claude-sonnet-4-6'`, `'gpt-5.4'`). */
|
|
47
|
+
id: string;
|
|
48
|
+
/** Which AI provider serves this model. */
|
|
49
|
+
provider: AIProviderID;
|
|
50
|
+
/** Human-readable label (e.g. `'Claude Sonnet 4.6'`). */
|
|
51
|
+
label: string;
|
|
52
|
+
/** Short description for UI display. */
|
|
53
|
+
description: string;
|
|
54
|
+
/** Maximum input context window in tokens. */
|
|
55
|
+
contextWindow: number;
|
|
56
|
+
/** Maximum output tokens per response. */
|
|
57
|
+
maxOutputTokens: number;
|
|
58
|
+
/** Whether the model supports extended thinking / chain-of-thought. */
|
|
59
|
+
supportsThinking: boolean;
|
|
60
|
+
/** Default thinking budget in tokens (only relevant when `supportsThinking` is true). */
|
|
61
|
+
thinkingBudgetTokens: number;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the thinking budget can be controlled via API params.
|
|
64
|
+
* When false, the model always reasons but does not accept a thinking / reasoning_effort param.
|
|
65
|
+
*/
|
|
66
|
+
thinkingConfigurable: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The model's OWN reasoning-effort levels, ordered ascending (least → most
|
|
69
|
+
* effort) — the exact values a user picks, that get persisted, and that the
|
|
70
|
+
* `/effort` command offers. There is NO abstract scale: these are the model's
|
|
71
|
+
* real levels.
|
|
72
|
+
*
|
|
73
|
+
* - **Native-effort models** (Anthropic `output_config.effort`, OpenAI
|
|
74
|
+
* `reasoning_effort`, Gemini `thinking_level`, …) list their provider values
|
|
75
|
+
* verbatim, e.g. `['low', 'high', 'xhigh', 'max']` — each value is sent as
|
|
76
|
+
* the provider's effort param as-is.
|
|
77
|
+
* - **Budget-configurable models** (a raw thinking-token budget, no native
|
|
78
|
+
* level names — e.g. Claude Haiku 4.5, Qwen3.7) list scaled-budget LABELS,
|
|
79
|
+
* e.g. `['4K', '8K', '16K', '32K']`, with {@link effortBudgetTokens} mapping
|
|
80
|
+
* each label to the actual token budget sent.
|
|
81
|
+
* - **Fixed-reasoning models** (DeepSeek executors, Kimi, …) omit this field
|
|
82
|
+
* entirely — reasoning depth can't be tuned, so there is nothing to pick.
|
|
83
|
+
*
|
|
84
|
+
* A persisted value outside the active model's set degrades to the nearest one
|
|
85
|
+
* (`model-selection.ts` `resolveEffortForModel`). Absent → no effort choice.
|
|
86
|
+
*/
|
|
87
|
+
supportedEffortLevels?: EffortLevel[];
|
|
88
|
+
/**
|
|
89
|
+
* The model's default effort value — the one used when the user hasn't chosen.
|
|
90
|
+
* MUST be a member of {@link supportedEffortLevels}. Absent only when the model
|
|
91
|
+
* has no effort levels (fixed reasoning).
|
|
92
|
+
*/
|
|
93
|
+
defaultEffortLevel?: EffortLevel;
|
|
94
|
+
/**
|
|
95
|
+
* For budget-configurable models ONLY: maps each label in
|
|
96
|
+
* {@link supportedEffortLevels} to the thinking-token budget it sends
|
|
97
|
+
* (e.g. `{ '4K': 4000, '8K': 8000, '16K': 16000, '32K': 32000 }`). Its
|
|
98
|
+
* presence is what marks a model as budget-driven rather than native-effort:
|
|
99
|
+
* a model WITH this map sends `budget_tokens`; a model WITHOUT it sends its
|
|
100
|
+
* chosen level as the provider's native effort param.
|
|
101
|
+
*
|
|
102
|
+
* CRITICAL for Anthropic 4.6+ models (Fable 5, Opus 4.8/4.6, Sonnet 5 / 4.6):
|
|
103
|
+
* these must NOT carry this map — they are native-effort models, and sending
|
|
104
|
+
* `budget_tokens` returns a 400 on Fable 5 / Opus 4.8 / Sonnet 5.
|
|
105
|
+
*/
|
|
106
|
+
effortBudgetTokens?: Record<string, number>;
|
|
107
|
+
/** Whether the model supports vision (images, documents, etc.). */
|
|
108
|
+
supportsVision: boolean;
|
|
109
|
+
/** Whether the model supports prompt caching. */
|
|
110
|
+
supportsPromptCaching: boolean;
|
|
111
|
+
/** Whether the model supports tool use / function calling. */
|
|
112
|
+
supportsTools: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The model cannot combine function tools with ANY reasoning on the provider's
|
|
115
|
+
* chat-completions endpoint, so a request carrying tools must pin reasoning
|
|
116
|
+
* OFF or it is rejected outright.
|
|
117
|
+
*
|
|
118
|
+
* Set for the gpt-5.6 family, which answers a tools request with:
|
|
119
|
+
* `Function tools with reasoning_effort are not supported for <model> in
|
|
120
|
+
* /v1/chat/completions. To use function tools, use /v1/responses or set
|
|
121
|
+
* reasoning_effort to 'none'.` (400 — verified live, 2026-07-30). Omitting the
|
|
122
|
+
* effort field entirely does NOT help: the model applies its own default and
|
|
123
|
+
* still 400s. Only an explicit `'none'` works.
|
|
124
|
+
*
|
|
125
|
+
* This is a per-model API fact, so it lives in the catalogue rather than as a
|
|
126
|
+
* model-name branch inside a bond.
|
|
127
|
+
*
|
|
128
|
+
* **This is a workaround, not the fix.** Pinning reasoning off means an agentic
|
|
129
|
+
* caller — which always carries tools — never gets reasoning from these models.
|
|
130
|
+
* The real fix is migrating the OpenAI bond to `/v1/responses`, which supports
|
|
131
|
+
* both together; until then, working-without-reasoning beats 400.
|
|
132
|
+
*/
|
|
133
|
+
toolsRequireReasoningOff?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Provider-specific server tool type for web search (e.g. `'web_search_20250305'`).
|
|
136
|
+
* When set, the chat handler sends this as a ServerTool alongside custom tools.
|
|
137
|
+
* Omit if the model / provider does not support native web search.
|
|
138
|
+
*/
|
|
139
|
+
webSearchToolType?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Provider-specific server tool type for code execution (e.g. `'code_execution_20250825'`).
|
|
142
|
+
* Omit if the model / provider does not support native code execution.
|
|
143
|
+
*/
|
|
144
|
+
codeExecutionToolType?: string;
|
|
145
|
+
/**
|
|
146
|
+
* Provider-specific server tool type for web fetch / URL context (e.g. `'web_fetch_20260209'`).
|
|
147
|
+
* Omit if the model / provider does not support native web fetch.
|
|
148
|
+
*/
|
|
149
|
+
webFetchToolType?: string;
|
|
150
|
+
/** Whether this model is available on the free tier (only one model should be true). */
|
|
151
|
+
freeTier?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Regions in which this model is free-tier selectable even though the model
|
|
154
|
+
* as a whole is not `freeTier` — for models whose regional hosts price very
|
|
155
|
+
* differently (e.g. a cheap native host powering the free planner while its
|
|
156
|
+
* ~3× re-host stays paid-only). Ignored when `freeTier` is true (all regions
|
|
157
|
+
* free); omitted → no free-tier access outside `freeTier`.
|
|
158
|
+
*/
|
|
159
|
+
freeTierRegions?: string[];
|
|
160
|
+
/**
|
|
161
|
+
* Processing regions this model can run in, as arbitrary region codes; the
|
|
162
|
+
* FIRST entry is the model's default region. Omit for `['us']` (the platform
|
|
163
|
+
* default — a single-region US model). A single-entry list pins the model to
|
|
164
|
+
* that region regardless of the user's per-model choice (e.g. `['cn']` for a
|
|
165
|
+
* model with no US re-host). Dispatch resolves a region to the
|
|
166
|
+
* `<provider>-<region>` named bond (`'us'` → the bare `<provider>` bond).
|
|
167
|
+
*/
|
|
168
|
+
regions?: string[];
|
|
169
|
+
/**
|
|
170
|
+
* Per-region price overrides in USD per MTok, keyed by region code, for
|
|
171
|
+
* regions whose host bills differently from the base rates (e.g. a US
|
|
172
|
+
* re-host of a Chinese-origin model). The BASE `*PricePerMTok` fields always
|
|
173
|
+
* carry the native provider's list prices (what models.dev / the freshness
|
|
174
|
+
* gate verify); a region with no entry here bills at the base rates. Omitted
|
|
175
|
+
* cache fields fall back to the region's `inputPricePerMTok` (hosts with no
|
|
176
|
+
* cache discount / no write premium).
|
|
177
|
+
*/
|
|
178
|
+
regionPricing?: Record<string, {
|
|
179
|
+
/** Region input price per million uncached tokens in USD. */
|
|
180
|
+
inputPricePerMTok: number;
|
|
181
|
+
/** Region output price per million tokens in USD. */
|
|
182
|
+
outputPricePerMTok: number;
|
|
183
|
+
/** Region prompt-cache read price per million tokens in USD. */
|
|
184
|
+
cacheReadPricePerMTok?: number;
|
|
185
|
+
/** Region prompt-cache write price per million tokens in USD. */
|
|
186
|
+
cacheWritePricePerMTok?: number;
|
|
187
|
+
}>;
|
|
188
|
+
/** Input price per million *uncached* (fresh) input tokens in USD. */
|
|
189
|
+
inputPricePerMTok: number;
|
|
190
|
+
/** Output price per million tokens in USD. */
|
|
191
|
+
outputPricePerMTok: number;
|
|
192
|
+
/**
|
|
193
|
+
* Price per million prompt-cache *read* (cache-hit) input tokens in USD.
|
|
194
|
+
*
|
|
195
|
+
* REQUIRED — never omit. Prompt caching is enabled for the agentic loop, so
|
|
196
|
+
* for a long conversation the cache-read tokens are the DOMINANT input
|
|
197
|
+
* category. Pricing them at `0` (the bug this field fixes) systematically
|
|
198
|
+
* under-measures real upstream spend and lets cost-gated budgets be blown
|
|
199
|
+
* past their caps. Conventionally a steep discount on `inputPricePerMTok`
|
|
200
|
+
* (e.g. Anthropic / OpenAI / DeepSeek bill cache reads at ~0.1×). MUST be
|
|
201
|
+
* `<= inputPricePerMTok` — a cache hit is never more expensive than fresh
|
|
202
|
+
* input.
|
|
203
|
+
*/
|
|
204
|
+
cacheReadPricePerMTok: number;
|
|
205
|
+
/**
|
|
206
|
+
* Price per million prompt-cache *write* (cache-creation) input tokens in USD.
|
|
207
|
+
*
|
|
208
|
+
* REQUIRED — never omit. The first time a prefix is cached the provider may
|
|
209
|
+
* charge a premium (Anthropic's 5-minute cache write is ~1.25× input);
|
|
210
|
+
* providers that auto-cache at no extra charge (OpenAI, DeepSeek) set this
|
|
211
|
+
* equal to `inputPricePerMTok`. MUST be `>= inputPricePerMTok` — a cache
|
|
212
|
+
* write is never cheaper than fresh input. Only the Anthropic bond currently
|
|
213
|
+
* emits `cacheCreationInputTokens`, but every model declares this so a new
|
|
214
|
+
* cache-emitting bond can never silently bill cache writes at `0`.
|
|
215
|
+
*/
|
|
216
|
+
cacheWritePricePerMTok: number;
|
|
217
|
+
/**
|
|
218
|
+
* Optional provider peak-hour pricing: during the listed UTC windows, ALL of
|
|
219
|
+
* this model's token prices (input, output, cache read/write) bill at
|
|
220
|
+
* `multiplier × ` the listed rates. Metering MUST price each request by its
|
|
221
|
+
* own timestamp via `priceMultiplierAt()` — never assume the flat rate — or
|
|
222
|
+
* peak-hour usage is under-metered and the platform eats the difference
|
|
223
|
+
* (e.g. DeepSeek's announced 2× Beijing-business-hours pricing).
|
|
224
|
+
*
|
|
225
|
+
* Windows are minutes-since-midnight UTC, half-open `[start, end)`; a window
|
|
226
|
+
* may wrap midnight (`start > end`).
|
|
227
|
+
*/
|
|
228
|
+
peakPricing?: {
|
|
229
|
+
windows: {
|
|
230
|
+
startMinuteUtc: number;
|
|
231
|
+
endMinuteUtc: number;
|
|
232
|
+
}[];
|
|
233
|
+
multiplier: number;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Fast-mode ("priority speed") pricing — the per-MTok rates billed when a
|
|
237
|
+
* request runs with the provider's fast/priority tier (e.g. Anthropic's
|
|
238
|
+
* `speed: "fast"` research preview: same model, up to ~2.5× output speed, at
|
|
239
|
+
* premium pricing). PRESENCE of this field is the capability flag: a model
|
|
240
|
+
* without it does not support fast mode, and metering/UI/dispatch all key off
|
|
241
|
+
* that. All four fields are required for the same never-under-meter reasons
|
|
242
|
+
* as the base rates. Metering MUST price a turn by the speed the provider
|
|
243
|
+
* REPORTS it ran at (`TokenUsage.speed`), not the speed requested — a
|
|
244
|
+
* fast-mode 429 that falls back to standard must not bill 2×.
|
|
245
|
+
*/
|
|
246
|
+
fastPricing?: {
|
|
247
|
+
/** Fast-mode input price per million uncached tokens in USD. */
|
|
248
|
+
inputPricePerMTok: number;
|
|
249
|
+
/** Fast-mode output price per million tokens in USD. */
|
|
250
|
+
outputPricePerMTok: number;
|
|
251
|
+
/** Fast-mode prompt-cache read price per million tokens in USD. */
|
|
252
|
+
cacheReadPricePerMTok: number;
|
|
253
|
+
/** Fast-mode prompt-cache write price per million tokens in USD. */
|
|
254
|
+
cacheWritePricePerMTok: number;
|
|
255
|
+
};
|
|
256
|
+
/** Reliable knowledge cutoff date (YYYY-MM-DD). */
|
|
257
|
+
knowledgeCutoff: string;
|
|
258
|
+
/**
|
|
259
|
+
* When the model was (or will be) deprecated (YYYY-MM-DD).
|
|
260
|
+
*
|
|
261
|
+
* Past dates: still selectable, but the picker tucks them into an "Older
|
|
262
|
+
* models" section so newcomers default to current entries. Saved selections
|
|
263
|
+
* (a user previously picked this) keep working. Future dates: still treated
|
|
264
|
+
* as current — useful for scheduling a deprecation in advance.
|
|
265
|
+
*
|
|
266
|
+
* Omit entirely for current models.
|
|
267
|
+
*/
|
|
268
|
+
deprecatedAt?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Whether this model is fully disabled — removed from selection and the
|
|
271
|
+
* public listing while remaining priceable for historical usage.
|
|
272
|
+
*
|
|
273
|
+
* Stronger than {@link deprecatedAt}: a deprecated model is still selectable
|
|
274
|
+
* (the picker just tucks it into an "Older models" section), whereas a
|
|
275
|
+
* disabled model vanishes from every *exposure* surface — it is excluded from
|
|
276
|
+
* `MODEL_IDS`, `getAvailableModels()`, the `GET /ai/models` listing, and the
|
|
277
|
+
* client-side free-tier / deprecation-partition helpers. Use it for a model
|
|
278
|
+
* the provider has retired or deprecated (e.g. `grok-code-fast-1`).
|
|
279
|
+
*
|
|
280
|
+
* `getModel(id)` STILL returns a disabled entry so a saved selection or a
|
|
281
|
+
* historical usage row can always be priced — NEVER delete a disabled model,
|
|
282
|
+
* or its past usage silently meters as free. Omit entirely for active models.
|
|
283
|
+
*/
|
|
284
|
+
disabled?: boolean;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The model ids the SERVER falls back to per mode/job when the user hasn't
|
|
288
|
+
* picked one — already resolved for the requester's tier (a free-tier caller
|
|
289
|
+
* sees the free-tier clamp ids, a paid caller the paid defaults). Lets the
|
|
290
|
+
* client label an unset per-mode picker "Default (<model>)" instead of a
|
|
291
|
+
* vague "default" the user can't decode.
|
|
292
|
+
*/
|
|
293
|
+
export interface ModeModelDefaults {
|
|
294
|
+
/** Model id used in plan mode when nothing is configured. */
|
|
295
|
+
plan: string;
|
|
296
|
+
/** Model id used in execute mode when nothing is configured. */
|
|
297
|
+
execute: string;
|
|
298
|
+
/** Model id used for commit-message generation when nothing is configured. */
|
|
299
|
+
commit: string;
|
|
300
|
+
/** Model id used for conversation compaction when nothing is configured. */
|
|
301
|
+
compact: string;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Response shape returned by `GET /ai/models`.
|
|
305
|
+
*/
|
|
306
|
+
export interface ListModelsResponse {
|
|
307
|
+
models: ModelDefinition[];
|
|
308
|
+
/**
|
|
309
|
+
* Per-mode server default model ids for the requester's tier. Optional —
|
|
310
|
+
* servers that don't compute tier-aware defaults omit it, and clients fall
|
|
311
|
+
* back to generic "default" labeling.
|
|
312
|
+
*/
|
|
313
|
+
defaults?: ModeModelDefaults;
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,UAAU,GACV,MAAM,GACN,UAAU,GACV,SAAS,GACT,SAAS,GACT,OAAO;AACT;;;;;GAKG;GACD,QAAQ,CAAA;AAEZ;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAA;IACV,2CAA2C;IAC3C,QAAQ,EAAE,YAAY,CAAA;IACtB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAA;IACrB,0CAA0C;IA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
* AI model catalog types.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for model metadata. The full `ModelDefinition` is
|
|
5
|
+
* consumed both by server-side code (chat handler, compaction) and over the
|
|
6
|
+
* wire by `GET /ai/models`. Nothing in this shape is sensitive enough to hide
|
|
7
|
+
* from authenticated clients today; if that changes, introduce a `PublicModel`
|
|
8
|
+
* projection here and have the handler convert before responding.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/api-resource-ai-models",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AI model catalog — server-side source of truth plus an authentication-gated discovery endpoint",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"molecule",
|
|
24
|
+
"ai",
|
|
25
|
+
"models"
|
|
26
|
+
],
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@molecule/api-bond": "1.0.0",
|
|
30
|
+
"@molecule/api-i18n": "1.0.0",
|
|
31
|
+
"@molecule/api-resource": "1.0.0",
|
|
32
|
+
"@types/node": "26.1.2",
|
|
33
|
+
"typescript": "6.0.3",
|
|
34
|
+
"vitest": "4.1.10"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@molecule/api-bond": "^1.0.0",
|
|
38
|
+
"@molecule/api-i18n": "^1.0.0",
|
|
39
|
+
"@molecule/api-resource": "^1.0.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"@molecule/api-i18n": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"@molecule/api-resource": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
52
|
+
"directory": "packages/api/resources/ai-models"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/api/resources/ai-models",
|
|
55
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
}
|
|
59
|
+
}
|