@x12i/ai-profiles 1.5.0 → 1.7.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/README.md +126 -27
- package/dist/buildModelsRegistry.d.ts +2 -0
- package/dist/buildModelsRegistry.d.ts.map +1 -1
- package/dist/buildModelsRegistry.js +5 -5
- package/dist/buildModelsRegistry.js.map +1 -1
- package/dist/buildResolvedProfile.d.ts +2 -1
- package/dist/buildResolvedProfile.d.ts.map +1 -1
- package/dist/buildResolvedProfile.js +12 -2
- package/dist/buildResolvedProfile.js.map +1 -1
- package/dist/catalogEnrichment.d.ts.map +1 -1
- package/dist/catalogEnrichment.js +13 -6
- package/dist/catalogEnrichment.js.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -1
- package/dist/costPolicy.d.ts +7 -0
- package/dist/costPolicy.d.ts.map +1 -0
- package/dist/costPolicy.js +81 -0
- package/dist/costPolicy.js.map +1 -0
- package/dist/data/models-catalog.json +108 -0
- package/dist/data/models-profiles.json +326 -316
- package/dist/data/models-profiles.schema.json +38 -11
- package/dist/data/models-registry.json +129 -21
- package/dist/data/profiles-shortcuts.json +49 -9
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/modalityPolicy.d.ts +37 -0
- package/dist/modalityPolicy.d.ts.map +1 -0
- package/dist/modalityPolicy.js +200 -0
- package/dist/modalityPolicy.js.map +1 -0
- package/dist/modelIdentity.d.ts.map +1 -1
- package/dist/modelIdentity.js +41 -22
- package/dist/modelIdentity.js.map +1 -1
- package/dist/modelsCatalog.d.ts.map +1 -1
- package/dist/modelsCatalog.js +1 -0
- package/dist/modelsCatalog.js.map +1 -1
- package/dist/profileCatalogSupplement.d.ts.map +1 -1
- package/dist/profileCatalogSupplement.js +57 -0
- package/dist/profileCatalogSupplement.js.map +1 -1
- package/dist/profileRegistryV2.d.ts +8 -8
- package/dist/profileRegistryV2.d.ts.map +1 -1
- package/dist/profileRegistryV2.js +12 -70
- package/dist/profileRegistryV2.js.map +1 -1
- package/dist/profileRegistryV3.d.ts +3 -0
- package/dist/profileRegistryV3.d.ts.map +1 -1
- package/dist/profileRegistryV3.js +90 -77
- package/dist/profileRegistryV3.js.map +1 -1
- package/dist/resolveAIProfile.d.ts +1 -1
- package/dist/resolveAIProfile.d.ts.map +1 -1
- package/dist/resolveAIProfile.js +28 -4
- package/dist/resolveAIProfile.js.map +1 -1
- package/dist/resolveCatalogListing.d.ts +10 -0
- package/dist/resolveCatalogListing.d.ts.map +1 -0
- package/dist/resolveCatalogListing.js +59 -0
- package/dist/resolveCatalogListing.js.map +1 -0
- package/dist/resolveModelIdentity.d.ts +17 -0
- package/dist/resolveModelIdentity.d.ts.map +1 -0
- package/dist/resolveModelIdentity.js +108 -0
- package/dist/resolveModelIdentity.js.map +1 -0
- package/dist/resolveModelRouting.d.ts +2 -2
- package/dist/resolveModelRouting.d.ts.map +1 -1
- package/dist/resolveModelRouting.js +3 -3
- package/dist/resolveModelRouting.js.map +1 -1
- package/dist/types.d.ts +77 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/validateProfileCatalogLinkage.d.ts +8 -0
- package/dist/validateProfileCatalogLinkage.d.ts.map +1 -0
- package/dist/validateProfileCatalogLinkage.js +185 -0
- package/dist/validateProfileCatalogLinkage.js.map +1 -0
- package/dist/validateProfileModalityCoverage.d.ts +9 -0
- package/dist/validateProfileModalityCoverage.d.ts.map +1 -0
- package/dist/validateProfileModalityCoverage.js +52 -0
- package/dist/validateProfileModalityCoverage.js.map +1 -0
- package/dist/validation/validateModelsProfilesJson.d.ts.map +1 -1
- package/dist/validation/validateModelsProfilesJson.js +1 -6
- package/dist/validation/validateModelsProfilesJson.js.map +1 -1
- package/dist/vendorModelId.d.ts +4 -0
- package/dist/vendorModelId.d.ts.map +1 -0
- package/dist/vendorModelId.js +14 -0
- package/dist/vendorModelId.js.map +1 -0
- package/dist/vendorPolicy.d.ts.map +1 -1
- package/dist/vendorPolicy.js +1 -0
- package/dist/vendorPolicy.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -19,17 +19,17 @@ When a graph node or function asks for `deep`, it means: high reasoning effort,
|
|
|
19
19
|
| Layer | Role | Example |
|
|
20
20
|
|-------|------|---------|
|
|
21
21
|
| **Profile** | Semantic intent (cost, speed, reasoning tier, output mode, agentic behavior) | `cheap`, `balanced`, `json`, `agentic` |
|
|
22
|
-
| **Choice** | Implementation option within that profile (provider, model, batch vs sync, cost/quality trade-off) | `default`, `
|
|
22
|
+
| **Choice** | Implementation option within that profile (provider, model, batch vs sync, cost/quality trade-off) | `default`, `google_floor`, `anthropic_cheap` |
|
|
23
23
|
|
|
24
24
|
Every profile has a **`defaultChoice`** (recommended) and typically **two alternatives** so operators can tune without changing task code:
|
|
25
25
|
|
|
26
26
|
- **Provider diversity** — Anthropic (writing/reasoning), OpenAI (code/instruction following), Google (cost, long context) within the same profile.
|
|
27
|
-
- **Cost flexibility** — e.g. `balanced` + `
|
|
28
|
-
- **Capability variants** — e.g. `
|
|
29
|
-
- **Execution mode** — e.g. `cheap` + `
|
|
27
|
+
- **Cost flexibility** — e.g. `balanced` + `google_balanced` vs `anthropic_balanced` for the same “normal work” intent.
|
|
28
|
+
- **Capability variants** — e.g. `google_deep` when the constraint is window size, not reasoning tier alone.
|
|
29
|
+
- **Execution mode** — e.g. `cheap` + `google_floor` with `executionMode: batch` for background bulk work.
|
|
30
30
|
- **Resilience** — swap choice or fall back within the same profile when a provider is down or rate-limited.
|
|
31
31
|
|
|
32
|
-
**Shortcuts** (`profiles-shortcuts.json`) are named entry points that may pin a profile and optionally a choice (e.g. `cheapest` → `cheap` + `
|
|
32
|
+
**Shortcuts** (`profiles-shortcuts.json`) are named entry points that may pin a profile and optionally a choice (e.g. `cheapest` → `cheap` + `google_floor`). **Aliases** on each profile are alternate names for the same profile (e.g. `economy` → `cheap`).
|
|
33
33
|
|
|
34
34
|
Tasks should declare **requirements** (`profile` + optional `choice`), not model names. Profiles are the vocabulary; choices are how that vocabulary is implemented under different constraints.
|
|
35
35
|
|
|
@@ -63,14 +63,14 @@ Each profile’s `choices` in `models-profiles.json` follow a consistent pattern
|
|
|
63
63
|
|
|
64
64
|
| Profile | Choices (bundled) | What the variants optimize |
|
|
65
65
|
|---------|-------------------|------------------------------|
|
|
66
|
-
| `cheap` | `default`, `
|
|
67
|
-
| `fast` | `default`, `
|
|
68
|
-
| `balanced` | `default`, `
|
|
69
|
-
| `deep` | `default`, `openai_deep`, `
|
|
70
|
-
| `pro` | `default`, `claude_pro`, `
|
|
71
|
-
| `json` | `default`, `
|
|
72
|
-
| `agentic` | `default`, `openai_agentic`, `
|
|
73
|
-
| `research` | `default`, `
|
|
66
|
+
| `cheap` | `default`, `google_floor`, `anthropic_cheap`, `deepseek_cheap`, `minimax_cheap` | Normal cheap vs batch floor vs safer Haiku vs DeepSeek volume floor vs MiniMax M2.5 |
|
|
67
|
+
| `fast` | `default`, `google_fast`, `anthropic_fast`, `grok_fast`, `minimax_fast` | Interactive default vs lower cost vs stronger quality vs Grok vs MiniMax M2 |
|
|
68
|
+
| `balanced` | `default`, `anthropic_balanced`, `google_balanced`, `minimax_balanced` | General default vs stronger reasoning vs lower cost vs MiniMax M2.5 |
|
|
69
|
+
| `deep` | `default`, `openai_deep`, `google_deep`, `deepseek_pro`, `grok_flagship`, `minimax_deep` | High reasoning default vs OpenAI vs long context vs DeepSeek vs Grok vs MiniMax M2.7 |
|
|
70
|
+
| `pro` | `default`, `claude_pro`, `anthropic_pro` | Premium default vs Claude premium vs Sonnet-level “pro-like” at lower cost |
|
|
71
|
+
| `json` | `default`, `google_json`, `anthropic_json` | Reliable schema output vs volume/cost vs complex extraction needing reasoning |
|
|
72
|
+
| `agentic` | `default`, `openai_agentic`, `google_agentic`, `minimax_agentic` | Agent default vs OpenAI orchestration vs lower-cost moderate agents vs MiniMax |
|
|
73
|
+
| `research` | `default`, `openai_research`, `google_research` | Synthesis default vs highest quality vs very large context |
|
|
74
74
|
| `cyber` | `default`, `log_analysis`, `deep_forensics` | Policy/contract review vs bulk log JSON vs max forensics |
|
|
75
75
|
| `content` | `default`, `pseo_bulk`, `brand_voice` | Natural prose vs batch pSEO schema vs premium copy |
|
|
76
76
|
| `summarization` | `default`, `mega_context` | Fast digest (Haiku) vs multi-hundred-k token compression |
|
|
@@ -78,7 +78,7 @@ Each profile’s `choices` in `models-profiles.json` follow a consistent pattern
|
|
|
78
78
|
| `open_weights` | `default`, `multilingual_code` | Llama 3.3 70B vs Qwen 2.5 72B (coding / multilingual) |
|
|
79
79
|
| `local` | `llama_cpp_gguf`, `transformersjs_default` | GGUF via llama.cpp vs Hugging Face Transformers.js on CPU |
|
|
80
80
|
|
|
81
|
-
Bundled **shortcuts** that pin a choice include `cheapest`, `absolute-floor`, `grok-fast`, `deepseek-pro`, `qwen`, `cheap-json`, `audit`, `pseo`, `ocr`, and FuncX-style `weak` / `normal` / `strong` / `ultra` (see [Profile matrix](#profile-matrix-funcx-contract)).
|
|
81
|
+
Bundled **shortcuts** that pin a choice include `cheapest`, `absolute-floor`, `grok-fast`, `deepseek-pro`, `minimax-coding`, `google-balanced`, `qwen`, `cheap-json`, `audit`, `pseo`, `ocr`, and FuncX-style `weak` / `normal` / `strong` / `ultra` (see [Profile matrix](#profile-matrix-funcx-contract)).
|
|
82
82
|
|
|
83
83
|
Registry fields on each choice—`runtime` (`reasoningEffort`, `toolPolicy`, `outputMode`, `instructionTier`, `backend`), `modelStatus` (`verified` | `predicted`), `api` (vendor + OpenRouter slugs), and `reason`—document *why* that model backs the choice. **Pricing and capabilities** come from `models-catalog.json` at resolve time. Profile-level `requiredCapabilities` describes intent for future dynamic selection (Optimixer). Consumers use `resolveAIProfile` to materialize the merged result.
|
|
84
84
|
|
|
@@ -90,31 +90,63 @@ npm install @x12i/ai-profiles
|
|
|
90
90
|
|
|
91
91
|
## Public API
|
|
92
92
|
|
|
93
|
+
### Profiles and registry loading
|
|
94
|
+
|
|
93
95
|
| Export | Sync? | Purpose |
|
|
94
96
|
|--------|-------|---------|
|
|
95
97
|
| `listAIProfiles(options?)` | No (async) | Profile summaries: primary `profile` key, `aliases[]`, choices, defaults |
|
|
96
98
|
| `getAIRegistryStatistics(options?)` | No (async) | Counts: profiles, choices, providers, shortcuts, catalog models, linkage health |
|
|
97
99
|
| `formatRegistryStatistics(stats)` | Yes | Human-readable summary for logs / CLI |
|
|
100
|
+
| `loadAIProfilesRegistry(options?)` | No (async) | Raw profiles + shortcuts registry (`auto` / `remote` / `bundled`, 24h memory cache) |
|
|
101
|
+
| `loadAIProfilesRegistryWithWarnings(options?)` | No (async) | Same as above, plus `warnings[]` (stale cache, bundled fallback, etc.) |
|
|
98
102
|
| `loadModelsCatalog(options?)` | No (async) | Unified models catalog (`auto` / `remote` / `bundled`, same cache pattern as profiles) |
|
|
103
|
+
| `loadBundledModelsCatalog()` | Yes | Package-shipped `models-catalog.json` only |
|
|
104
|
+
| `loadBundledModelsRegistry()` | Yes | Package-shipped `models-registry.json` (linkage index) |
|
|
99
105
|
| `listAIShortcuts()` | Yes | Shortcut table: `{ key, profile, choice?, description? }[]` |
|
|
100
|
-
| `resolveAIProfile(input, options?)` | No (async) | Resolve
|
|
101
|
-
| `
|
|
106
|
+
| `resolveAIProfile(input, options?)` | No (async) | Resolve profile/shortcut/alias → model, pricing, runtime, canonical `profile` key |
|
|
107
|
+
| `isKnownProfileOrShortcut(input)` | Yes (bundled only) | Whether input is a known primary key, shortcut, or alias |
|
|
108
|
+
| `AIProfilesError` | — | Typed errors (`UNKNOWN_PROFILE`, …) |
|
|
109
|
+
|
|
110
|
+
### Model identity (vendor + model strings)
|
|
111
|
+
|
|
112
|
+
Use these when callers pass **raw model ids or OpenRouter slugs**, not profile names.
|
|
113
|
+
|
|
114
|
+
| Export | Sync? | Purpose |
|
|
115
|
+
|--------|-------|---------|
|
|
116
|
+
| `resolveModelIdentity(input, options?)` | Yes | Given a bare id or `vendor/slug`, return `{ provider, modelId, invocation? }` via bundled registry + catalog fallback |
|
|
117
|
+
| `buildModelInvocation(provider, modelId)` | Yes | `{ direct, openrouter }` endpoints for a provider hint + model string |
|
|
118
|
+
| `buildDirectInvocation(provider, modelId)` | Yes | Vendor-direct `{ provider, modelId }`; splits prefixed slugs for all vendors |
|
|
102
119
|
| `buildOpenRouterModelId(provider, modelId)` | Yes | Build an OpenRouter slug (`openai/gpt-5.4`) from registry fields |
|
|
120
|
+
| `parseDirectFromOpenRouterSlug(slug, family?)` | Yes | Split `vendor/model` → direct slice (`custom` + bare id when vendor is not a first-class provider) |
|
|
121
|
+
| `normalizeAnthropicVersionSlug(slug)` | Yes | Dotted minor versions for Anthropic (`4-6` → `4.6`) |
|
|
122
|
+
| `buildRegistryKey(provider, modelId)` | Yes | Stable registry key (`vendor:…`) used in `models-registry.json` |
|
|
123
|
+
| `matchOpenRouterCatalog(provider, modelId, index)` | Yes | Match a choice against a catalog index |
|
|
124
|
+
| `lookupInvocationForChoice(registry, provider, modelId)` | Yes | Lookup prebuilt invocation from `models-registry.json` |
|
|
125
|
+
|
|
126
|
+
**Prefixed slugs:** `buildDirectInvocation("meta-llama", "meta-llama/llama-3.1-8b-instruct")` yields `{ provider: "meta-llama", modelId: "llama-3.1-8b-instruct" }`. Host paths keep the nested id when the provider hint differs (e.g. Together: `together` + `meta-llama/Llama-3.3-70b-instruct`). Bare and prefixed Anthropic inputs normalize to the same direct and OpenRouter ids.
|
|
127
|
+
|
|
128
|
+
### Routing, validation, and maintainer tooling
|
|
129
|
+
|
|
130
|
+
| Export | Sync? | Purpose |
|
|
131
|
+
|--------|-------|---------|
|
|
132
|
+
| `resolveUseOpenRouter(explicit?)` | Yes | Resolve OpenRouter vs vendor-direct routing (option → env → default) |
|
|
103
133
|
| `validateBundledProfileVendorCoverage(options?)` | Yes | Advisory report of leading-vendor coverage per profile |
|
|
134
|
+
| `validateBundledProfileModalityCoverage(options?)` | Yes | Advisory report of profile choice vs required input/output media |
|
|
104
135
|
| `isProfileVendorTrimReady(profile, allowedProviders)` | Yes | Whether auto-pick can satisfy a vendor filter |
|
|
136
|
+
| `isProfileModalityCoverageReady(profileKey)` | Yes | Whether a profile has at least one modality-compatible choice |
|
|
105
137
|
| `listFaultyProfileChoices()` | Yes | Profile choices with faulty OpenRouter catalog linkage |
|
|
106
|
-
| `
|
|
107
|
-
| `AIProfilesError` | — | Typed errors (`UNKNOWN_PROFILE`, …) |
|
|
138
|
+
| `buildModelsRegistry`, `verifyOpenRouterAlignment`, … | Yes | Catalog/registry build and alignment (see scripts below) |
|
|
108
139
|
|
|
109
|
-
Registry JSON lives in
|
|
140
|
+
Registry JSON lives in four bundled assets:
|
|
110
141
|
|
|
111
142
|
| File | Schema | Role |
|
|
112
143
|
|------|--------|------|
|
|
113
144
|
| `models-profiles.json` | `x12i.ai-profiles.model-registry.v3` | Profile intent, choices, `requiredCapabilities`, `modelStatus` — **no embedded pricing** |
|
|
114
145
|
| `models-catalog.json` | `x12i.ai-profiles.models-catalog` | Per-model pricing, context window, capabilities (OpenRouter-normalized) |
|
|
146
|
+
| `models-registry.json` | `x12i.ai-profiles.models-registry` | Built linkage index: vendor keys, OpenRouter slugs, `invocation` pairs |
|
|
115
147
|
| `profiles-shortcuts.json` | `x12i.ai-profiles.shortcuts` | Named entry points |
|
|
116
148
|
|
|
117
|
-
**v3 contract:** `
|
|
149
|
+
**v3 contract:** Each profile choice stores only `provider` + **vendor-native** `modelId` as a pointer into `models-catalog.json`, which owns the `direct` and `openrouter` listings. Never embed `api`, `defaultTransport`, or OpenRouter slugs on profile choices. `resolveAIProfile` picks transport via env/options and merges catalog pricing, limits, and capabilities — the client-facing shape is unchanged. Run `npm run registry:finish` to strip legacy fields, verify linkage, and rebuild `models-registry.json`.
|
|
118
150
|
|
|
119
151
|
Validate with `src/data/models-profiles.schema.json`. Maintainer scripts: `npm run migrate:profiles-v3`, `npm run registry:finish` (catalog supplement + verified defaults + linkage rebuild).
|
|
120
152
|
|
|
@@ -173,7 +205,7 @@ CLI (after build): `npm run stats` (text) or `npm run stats:json`.
|
|
|
173
205
|
|
|
174
206
|
Each **profile** has exactly one **primary key** (e.g. `balanced`, `cheap`) and **many aliases** — alternate strings that mean the same profile. Data is in `models-profiles.json` under each profile’s `aliases` array.
|
|
175
207
|
|
|
176
|
-
**Shortcuts** (`profiles-shortcuts.json`) are a second registry of names. A shortcut points at a profile and may pin a specific **choice** (e.g. `cheapest` → `cheap` + `
|
|
208
|
+
**Shortcuts** (`profiles-shortcuts.json`) are a second registry of names. A shortcut points at a profile and may pin a specific **choice** (e.g. `cheapest` → `cheap` + `google_floor`).
|
|
177
209
|
|
|
178
210
|
The same string can appear as both an alias and a shortcut. That is intentional.
|
|
179
211
|
|
|
@@ -200,7 +232,7 @@ await resolveAIProfile("cost-sensitive"); // profile: cheap, choice: default
|
|
|
200
232
|
await resolveAIProfile("default"); // profile: balanced (via default shortcut)
|
|
201
233
|
|
|
202
234
|
// Shortcut with explicit choice
|
|
203
|
-
await resolveAIProfile("cheapest"); // profile: cheap, choice:
|
|
235
|
+
await resolveAIProfile("cheapest"); // profile: cheap, choice: google_floor
|
|
204
236
|
```
|
|
205
237
|
|
|
206
238
|
`listAIProfiles()` returns each profile’s `aliases` so UIs can show friendly labels. `listAIShortcuts()` lists shortcut keys separately (not duplicated inside `listAIProfiles()`).
|
|
@@ -230,7 +262,7 @@ After validation, call `resolveAIProfile` (usually `source: "auto"` or `"bundled
|
|
|
230
262
|
|
|
231
263
|
```ts
|
|
232
264
|
const model = await resolveAIProfile("cheap", {
|
|
233
|
-
choice: "
|
|
265
|
+
choice: "anthropic_cheap",
|
|
234
266
|
});
|
|
235
267
|
```
|
|
236
268
|
|
|
@@ -297,15 +329,31 @@ await resolveAIProfile("cheap", { useOpenRouter: true }); // still OpenRouter
|
|
|
297
329
|
Helper exports:
|
|
298
330
|
|
|
299
331
|
```ts
|
|
300
|
-
import {
|
|
332
|
+
import {
|
|
333
|
+
resolveUseOpenRouter,
|
|
334
|
+
buildOpenRouterModelId,
|
|
335
|
+
buildModelInvocation,
|
|
336
|
+
resolveModelIdentity,
|
|
337
|
+
} from "@x12i/ai-profiles";
|
|
301
338
|
|
|
302
339
|
resolveUseOpenRouter(); // true by default
|
|
303
340
|
resolveUseOpenRouter(false); // explicit override
|
|
304
341
|
|
|
305
342
|
buildOpenRouterModelId("openai", "gpt-5.4"); // "openai/gpt-5.4"
|
|
343
|
+
|
|
344
|
+
// Same direct + OpenRouter shape whether input is bare or prefixed:
|
|
345
|
+
buildModelInvocation("anthropic", "claude-3-5-sonnet-20241022");
|
|
346
|
+
buildModelInvocation("anthropic", "anthropic/claude-3-5-sonnet-20241022");
|
|
347
|
+
|
|
348
|
+
// Bare model string → vendor + model (no profile name required):
|
|
349
|
+
resolveModelIdentity("google/gemini-2.5-flash-lite");
|
|
350
|
+
// { provider: "google", modelId: "gemini-2.5-flash-lite", invocation: { … } }
|
|
351
|
+
|
|
352
|
+
resolveModelIdentity("google/gemini-2.5-flash-lite", { asOpenRouter: true });
|
|
353
|
+
// { provider: "openrouter", modelId: "google/gemini-2.5-flash-lite", … }
|
|
306
354
|
```
|
|
307
355
|
|
|
308
|
-
Tests: `test/resolveModelRouting.test.ts`.
|
|
356
|
+
Tests: `test/resolveModelRouting.test.ts`, `test/modelIdentity.test.ts`, `test/resolveModelIdentity.test.ts`.
|
|
309
357
|
|
|
310
358
|
## Use bundled only
|
|
311
359
|
|
|
@@ -419,7 +467,7 @@ Top-level `provider` / `modelId` / `routing` remain the **active** path selected
|
|
|
419
467
|
|
|
420
468
|
### Vendor trimming
|
|
421
469
|
|
|
422
|
-
Restrict resolution to specific vendors (auto-picks within the profile when the default is outside the set). **Leading vendors** (`openai`, `anthropic`, `google`, `deepseek`, `xai`) are **preferred** during auto-pick, not forced — explicit `choice` still honors `together` and other providers.
|
|
470
|
+
Restrict resolution to specific vendors (auto-picks within the profile when the default is outside the set). **Leading vendors** (`openai`, `anthropic`, `google`, `deepseek`, `minimax`, `xai`) are **preferred** during auto-pick, not forced — explicit `choice` still honors `together` and other providers.
|
|
423
471
|
|
|
424
472
|
```ts
|
|
425
473
|
await resolveAIProfile("balanced", {
|
|
@@ -428,6 +476,57 @@ await resolveAIProfile("balanced", {
|
|
|
428
476
|
});
|
|
429
477
|
```
|
|
430
478
|
|
|
479
|
+
### Modality filtering (input / output media)
|
|
480
|
+
|
|
481
|
+
Every profile declares **required input and output media** in `requiredCapabilities`:
|
|
482
|
+
|
|
483
|
+
- Most profiles: `inputModalities: ["text"]`, `outputModalities: ["text"]`
|
|
484
|
+
- `vision`: `inputModalities: ["text", "image"]`, `outputModalities: ["text"]`
|
|
485
|
+
|
|
486
|
+
Supported values: `text`, `image`, `audio`, `video`, `file` (aligned with `models-catalog.json`).
|
|
487
|
+
|
|
488
|
+
During resolution, choices whose catalog modalities do not satisfy the contract are **excluded**. A text-only model cannot be picked for `vision`; a vision-capable model can still serve text profiles.
|
|
489
|
+
|
|
490
|
+
```ts
|
|
491
|
+
const resolved = await resolveAIProfile("vision");
|
|
492
|
+
// resolved.requiredModalities.input includes "image"
|
|
493
|
+
// resolved.modalities reflects the picked model from catalog
|
|
494
|
+
|
|
495
|
+
await resolveAIProfile("cheap", {
|
|
496
|
+
inputModalities: ["text", "image"], // override for this call
|
|
497
|
+
outputModalities: ["text"],
|
|
498
|
+
});
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Override at resolve time with `inputModalities` / `outputModalities`. Incompatible explicit `choice` values throw `NO_MODALITY_MATCH`.
|
|
502
|
+
|
|
503
|
+
Registry maintenance:
|
|
504
|
+
|
|
505
|
+
```ts
|
|
506
|
+
import { validateBundledProfileModalityCoverage } from "@x12i/ai-profiles";
|
|
507
|
+
|
|
508
|
+
validateBundledProfileModalityCoverage(); // { ok, profiles[] } with mismatches
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
`npm run catalog:build` writes `MODALITY_MISMATCH` rows to `reports/fault-report.json`.
|
|
512
|
+
|
|
513
|
+
### Cost cap filtering
|
|
514
|
+
|
|
515
|
+
Restrict auto-pick to choices whose catalog pricing stays under a USD-per-1M-token ceiling:
|
|
516
|
+
|
|
517
|
+
```ts
|
|
518
|
+
// Both input and output rates must be <= $0.20 / 1M tokens
|
|
519
|
+
await resolveAIProfile("balanced", { costCapPer1M: 0.2 });
|
|
520
|
+
|
|
521
|
+
// Finer control
|
|
522
|
+
await resolveAIProfile("cheap", {
|
|
523
|
+
costCapPer1M: { maxInput: 0.2, maxOutput: 2 },
|
|
524
|
+
choice: "minimax_cheap",
|
|
525
|
+
});
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
When the default choice exceeds the cap, resolution auto-picks the next compatible alternative (respecting fallback order and vendor preferences). Explicit `choice` values over the cap throw `NO_COST_CAP_MATCH`. Local/self-hosted choices are treated as zero cost.
|
|
529
|
+
|
|
431
530
|
### Keeping models aligned over time
|
|
432
531
|
|
|
433
532
|
Bundled linkage lives in `src/data/models-registry.json`, built from `models-profiles.json` and `src/data/models-catalog.json`.
|
|
@@ -456,7 +555,7 @@ npm run verify:openrouter:live # legacy script vs live catalog
|
|
|
456
555
|
|
|
457
556
|
With the seed catalog (<50 models), choices not yet listed are marked `catalog-miss` in the registry (warnings in `reports/fault-report.json`, not CI failures). A full catalog promotes true `faulty` rows for slug mismatches.
|
|
458
557
|
|
|
459
|
-
Unit tests in `test/openrouterAlignment.test.ts`, `test/modelIdentity.test.ts`, and `test/resolveModelRouting.test.ts` guard resolution rules offline.
|
|
558
|
+
Unit tests in `test/openrouterAlignment.test.ts`, `test/modelIdentity.test.ts`, `test/resolveModelIdentity.test.ts`, and `test/resolveModelRouting.test.ts` guard resolution rules offline.
|
|
460
559
|
|
|
461
560
|
Vendor-direct-only choices (not routed via OpenRouter) can opt out:
|
|
462
561
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ModelRegistryEntry, ModelsProfilesJson, ModelsRegistryJson, ModelsCatalogJson } from "./types.js";
|
|
2
2
|
import { validateProfileVendorCoverage } from "./validateProfileVendorCoverage.js";
|
|
3
|
+
import { validateProfileModalityCoverage } from "./validateProfileModalityCoverage.js";
|
|
3
4
|
export interface FaultyProfileChoice {
|
|
4
5
|
profile: string;
|
|
5
6
|
choice: string;
|
|
@@ -19,6 +20,7 @@ export interface ModelsRegistryBuildResult {
|
|
|
19
20
|
faulty: FaultyProfileChoice[];
|
|
20
21
|
catalogMiss: CatalogMissChoice[];
|
|
21
22
|
vendorWarnings: ReturnType<typeof validateProfileVendorCoverage>;
|
|
23
|
+
modalityWarnings: ReturnType<typeof validateProfileModalityCoverage>;
|
|
22
24
|
}
|
|
23
25
|
export declare function buildModelsRegistry(profiles: ModelsProfilesJson, catalog: ModelsCatalogJson | unknown): ModelsRegistryBuildResult;
|
|
24
26
|
export declare function listFaultyFromRegistry(registry: ModelsRegistryJson): FaultyProfileChoice[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildModelsRegistry.d.ts","sourceRoot":"","sources":["../src/buildModelsRegistry.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"buildModelsRegistry.d.ts","sourceRoot":"","sources":["../src/buildModelsRegistry.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,cAAc,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;IACjE,gBAAgB,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC;CACtE;AAgBD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,iBAAiB,GAAG,OAAO,GACnC,yBAAyB,CA4J3B;AAmBD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,kBAAkB,GAC3B,mBAAmB,EAAE,CAoBvB"}
|
|
@@ -2,6 +2,7 @@ import { buildModelsCatalogIndex, normalizeModelsCatalog } from "./modelsCatalog
|
|
|
2
2
|
import { buildRegistryKey, matchOpenRouterCatalog, shouldCheckOpenRouterAlignment, } from "./modelIdentity.js";
|
|
3
3
|
import { buildModelInvocationFromChoice, getChoiceVendorModelId, } from "./profileRegistryV2.js";
|
|
4
4
|
import { validateProfileVendorCoverage } from "./validateProfileVendorCoverage.js";
|
|
5
|
+
import { validateProfileModalityCoverage } from "./validateProfileModalityCoverage.js";
|
|
5
6
|
const SEED_CATALOG_MODEL_THRESHOLD = 50;
|
|
6
7
|
function isSeedCatalog(catalog) {
|
|
7
8
|
return catalog.models.length < SEED_CATALOG_MODEL_THRESHOLD;
|
|
@@ -23,7 +24,7 @@ export function buildModelsRegistry(profiles, catalog) {
|
|
|
23
24
|
const referencedOrIds = new Set();
|
|
24
25
|
for (const [profileKey, profile] of Object.entries(profiles.profiles)) {
|
|
25
26
|
for (const [choiceKey, choice] of Object.entries(profile.choices)) {
|
|
26
|
-
const invocation = buildModelInvocationFromChoice(choice);
|
|
27
|
+
const invocation = buildModelInvocationFromChoice(choice, normalizedCatalog);
|
|
27
28
|
const registryKey = buildRegistryKey(choice.provider, getChoiceVendorModelId(choice));
|
|
28
29
|
const ref = { profile: profileKey, choice: choiceKey };
|
|
29
30
|
if (choice.provider === "local") {
|
|
@@ -63,10 +64,6 @@ export function buildModelsRegistry(profiles, catalog) {
|
|
|
63
64
|
canonicalSlug: match.canonicalSlug,
|
|
64
65
|
matchMethod: match.matchMethod,
|
|
65
66
|
};
|
|
66
|
-
invocation.openrouter = {
|
|
67
|
-
provider: "openrouter",
|
|
68
|
-
modelId: match.openRouterModelId,
|
|
69
|
-
};
|
|
70
67
|
}
|
|
71
68
|
else if (seedCatalog) {
|
|
72
69
|
linkage = { status: "catalog-miss", exemptReason: "seed-catalog" };
|
|
@@ -154,6 +151,9 @@ export function buildModelsRegistry(profiles, catalog) {
|
|
|
154
151
|
faulty,
|
|
155
152
|
catalogMiss,
|
|
156
153
|
vendorWarnings: validateProfileVendorCoverage(profiles),
|
|
154
|
+
modalityWarnings: validateProfileModalityCoverage(profiles, {
|
|
155
|
+
catalog: normalizedCatalog,
|
|
156
|
+
}),
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
function mergeRegistryEntry(models, entry) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildModelsRegistry.js","sourceRoot":"","sources":["../src/buildModelsRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,sBAA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EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC;QACzB,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAA4B;IAE5B,MAAM,MAAM,GAA0B,EAAE,CAAC;IAEzC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ;YAAE,SAAS;QAEhD,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC;gBACV,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,UAAU;oBACrC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;oBACvC,CAAC,CAAC,EAAE;aACP,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AIProfileChoice, AIProfileDefinition, AIProfileShortcut, AIProfileWarning, AIProfilesRegistry, ModelsCatalogJson, ResolvedAIProfile } from "./types.js";
|
|
1
|
+
import type { AIProfileChoice, AIProfileDefinition, AIProfileShortcut, AIProfileWarning, AIProfilesRegistry, CostCapPer1M, ModelsCatalogJson, ResolvedAIProfile } from "./types.js";
|
|
2
2
|
interface BuildResolvedProfileInput {
|
|
3
3
|
input: string;
|
|
4
4
|
shortcutKey?: string;
|
|
@@ -10,6 +10,7 @@ interface BuildResolvedProfileInput {
|
|
|
10
10
|
loaderWarnings?: AIProfileWarning[];
|
|
11
11
|
useOpenRouter?: boolean;
|
|
12
12
|
catalog?: ModelsCatalogJson;
|
|
13
|
+
costCapApplied?: CostCapPer1M;
|
|
13
14
|
}
|
|
14
15
|
export declare function buildResolvedProfile(params: BuildResolvedProfileInput): ResolvedAIProfile;
|
|
15
16
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildResolvedProfile.d.ts","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildResolvedProfile.d.ts","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EAEZ,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,cAAc,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B;AA8CD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,GAChC,iBAAiB,CAiLnB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_CACHE_TTL_MS, DEFAULT_RUNTIME_DEFAULTS } from "./constants.js";
|
|
2
2
|
import { enrichChoiceFromCatalog } from "./catalogEnrichment.js";
|
|
3
|
+
import { getChoiceModalities, resolveRequiredModalities, } from "./modalityPolicy.js";
|
|
3
4
|
import { getMemoryCache } from "./loader/memoryCache.js";
|
|
4
5
|
import { loadBundledModelsCatalog } from "./loader/loadBundledModelsCatalog.js";
|
|
5
6
|
import { lookupInvocationForChoice, loadBundledModelsRegistry } from "./loadModelsRegistry.js";
|
|
6
7
|
import { buildModelInvocationFromChoice } from "./profileRegistryV2.js";
|
|
8
|
+
import { resolveChoiceInvocation } from "./resolveCatalogListing.js";
|
|
7
9
|
import { resolveChoicePricing } from "./profileRegistryV3.js";
|
|
8
10
|
import { resolveBackend, resolveInstructionTier, } from "./resolveInstructionTierAndBackend.js";
|
|
9
11
|
import { applyModelRouting, resolveUseOpenRouter, } from "./resolveModelRouting.js";
|
|
@@ -37,6 +39,7 @@ function loadCatalogForEnrichment(catalog) {
|
|
|
37
39
|
}
|
|
38
40
|
export function buildResolvedProfile(params) {
|
|
39
41
|
const { input, shortcutKey, profile, choice, shortcut, registry, loaderWarnings = [], useOpenRouter: explicitUseOpenRouter, catalog: catalogInput, } = params;
|
|
42
|
+
const costCapApplied = params.costCapApplied;
|
|
40
43
|
const warnings = [...loaderWarnings];
|
|
41
44
|
const cache = getMemoryCache();
|
|
42
45
|
const cacheLoadedAt = cache?.loadedAt ?? Date.parse(registry.loadedAt);
|
|
@@ -67,8 +70,8 @@ export function buildResolvedProfile(params) {
|
|
|
67
70
|
const instructionTier = resolveInstructionTier(profile, mergedRuntime.instructionTier);
|
|
68
71
|
const resolvedBackend = resolveBackend(profile, choice, mergedRuntime.backend);
|
|
69
72
|
const useOpenRouter = resolveUseOpenRouter(explicitUseOpenRouter);
|
|
70
|
-
const routed = applyModelRouting(choice, resolvedBackend, useOpenRouter);
|
|
71
73
|
const catalog = loadCatalogForEnrichment(catalogInput);
|
|
74
|
+
const routed = applyModelRouting(choice, resolvedBackend, useOpenRouter, catalog);
|
|
72
75
|
const enriched = catalog
|
|
73
76
|
? enrichChoiceFromCatalog(catalog, choice, {
|
|
74
77
|
provider: routed.provider,
|
|
@@ -89,7 +92,9 @@ export function buildResolvedProfile(params) {
|
|
|
89
92
|
message: `Pricing is missing for choice '${choice.choice}' on profile '${profile.profile}'.`,
|
|
90
93
|
});
|
|
91
94
|
}
|
|
92
|
-
const invocation =
|
|
95
|
+
const invocation = (catalog
|
|
96
|
+
? resolveChoiceInvocation(choice, catalog)
|
|
97
|
+
: undefined) ?? resolveInvocation(profile.profile, params.choiceKey, choice);
|
|
93
98
|
if (!invocation.openrouter && useOpenRouter) {
|
|
94
99
|
try {
|
|
95
100
|
const modelsRegistry = loadBundledModelsRegistry();
|
|
@@ -123,6 +128,8 @@ export function buildResolvedProfile(params) {
|
|
|
123
128
|
maxOutputTokens: limits.maxOutputTokens,
|
|
124
129
|
}
|
|
125
130
|
: undefined;
|
|
131
|
+
const requiredModalities = resolveRequiredModalities(profile.profile, profile);
|
|
132
|
+
const modalities = getChoiceModalities(choice, catalog);
|
|
126
133
|
const resolved = {
|
|
127
134
|
input,
|
|
128
135
|
profile: profile.profile,
|
|
@@ -144,6 +151,9 @@ export function buildResolvedProfile(params) {
|
|
|
144
151
|
...(profile.requiredCapabilities !== undefined
|
|
145
152
|
? { requiredCapabilities: profile.requiredCapabilities }
|
|
146
153
|
: {}),
|
|
154
|
+
modalities,
|
|
155
|
+
requiredModalities,
|
|
156
|
+
...(costCapApplied ? { costCapApplied } : {}),
|
|
147
157
|
runtime,
|
|
148
158
|
invocation,
|
|
149
159
|
...(choice.metadata !== undefined ? { metadata: choice.metadata } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildResolvedProfile.js","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,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AM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS;YAChC,CAAC,CAAC,EAAE,eAAe,EAAE,QAAQ,CAAC,OAAO,EAAE;YACvC,CAAC,CAAC,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,SAAS;KACV,CAAC;IAEF,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;QAC5B,QAAQ,CAAC,QAAQ,GAAG;YAClB,GAAG,EAAE,WAAW;YAChB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogEnrichment.d.ts","sourceRoot":"","sources":["../src/catalogEnrichment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalogEnrichment.d.ts","sourceRoot":"","sources":["../src/catalogEnrichment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EAGjB,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAwCpB,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,GACvB,cAAc,GAAG,SAAS,CAiB5B;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,iBAAiB,GACvB,mBAAmB,CAMrB;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iBAAiB,GACvB,yBAAyB,CAO3B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE;IACN,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,GACA,iBAAiB,GAAG,SAAS,CA6B/B;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,eAAe,EACvB,MAAM,CAAC,EAAE;IAAE,QAAQ,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjD;IACD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC,CAiBA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildModelsCatalogIndex } from "./modelsCatalog.js";
|
|
2
|
+
import { normalizeModalityContract } from "./modalityPolicy.js";
|
|
2
3
|
import { getChoiceOpenRouterModelId, getChoiceVendorModelId } from "./profileRegistryV2.js";
|
|
3
4
|
function normalizeKey(value) {
|
|
4
5
|
return value.trim().toLowerCase();
|
|
@@ -7,6 +8,9 @@ function modalitiesIncludeImage(modalities) {
|
|
|
7
8
|
return modalities?.input?.includes("image") ?? false;
|
|
8
9
|
}
|
|
9
10
|
function capabilitiesFromSlice(caps, modalities, pricing) {
|
|
11
|
+
const normalizedModalities = modalities
|
|
12
|
+
? normalizeModalityContract(modalities)
|
|
13
|
+
: undefined;
|
|
10
14
|
return {
|
|
11
15
|
supportsVision: modalitiesIncludeImage(modalities),
|
|
12
16
|
supportsTools: caps?.toolCalling,
|
|
@@ -15,6 +19,12 @@ function capabilitiesFromSlice(caps, modalities, pricing) {
|
|
|
15
19
|
supportsCaching: pricing?.cachedInput !== undefined || pricing?.cacheWrite !== undefined,
|
|
16
20
|
supportsBatch: pricing?.batchInput !== undefined || pricing?.batchOutput !== undefined,
|
|
17
21
|
supportsStreaming: true,
|
|
22
|
+
...(normalizedModalities
|
|
23
|
+
? {
|
|
24
|
+
inputModalities: normalizedModalities.input,
|
|
25
|
+
outputModalities: normalizedModalities.output,
|
|
26
|
+
}
|
|
27
|
+
: {}),
|
|
18
28
|
};
|
|
19
29
|
}
|
|
20
30
|
export function pricingFromCatalogEntry(entry) {
|
|
@@ -66,13 +76,10 @@ export function findCatalogModelEntry(catalog, params) {
|
|
|
66
76
|
normalizeKey(model.direct.modelId) === normalizeKey(params.modelId));
|
|
67
77
|
}
|
|
68
78
|
export function enrichChoiceFromCatalog(catalog, choice, routed) {
|
|
69
|
-
const provider = routed?.provider ?? choice.provider;
|
|
70
|
-
const modelId = routed?.modelId ?? getChoiceVendorModelId(choice);
|
|
71
|
-
const openRouterModelId = getChoiceOpenRouterModelId(choice);
|
|
72
79
|
const entry = findCatalogModelEntry(catalog, {
|
|
73
|
-
provider,
|
|
74
|
-
modelId,
|
|
75
|
-
openRouterModelId,
|
|
80
|
+
provider: choice.provider,
|
|
81
|
+
modelId: getChoiceVendorModelId(choice),
|
|
82
|
+
openRouterModelId: getChoiceOpenRouterModelId(choice, catalog),
|
|
76
83
|
});
|
|
77
84
|
if (!entry) {
|
|
78
85
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogEnrichment.js","sourceRoot":"","sources":["../src/catalogEnrichment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAa5F,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC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MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;QACzC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CACtE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,OAA0B,EAC1B,MAAuB,EACvB,MAAkD;IAOlD,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,EAAE;QAC3C,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,sBAAsB,CAAC,MAAM,CAAC;QACvC,iBAAiB,EAAE,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC;KAC/D,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,uBAAuB,CAAC,KAAK,CAAC;QACvC,MAAM,EAAE,sBAAsB,CAAC,KAAK,CAAC;QACrC,YAAY,EAAE,4BAA4B,CAAC,KAAK,CAAC;QACjD,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -13,5 +13,7 @@ export declare const MODELS_PROFILES_SCHEMAS: readonly ["x12i.ai-profiles.models
|
|
|
13
13
|
export declare const PROFILES_SHORTCUTS_SCHEMA: "x12i.ai-profiles.shortcuts";
|
|
14
14
|
export declare const INSTRUCTION_TIERS: readonly ["default", "cpu", "reasoning"];
|
|
15
15
|
export declare const AI_PROFILE_BACKENDS: readonly ["openrouter", "llama-cpp", "transformersjs", "custom"];
|
|
16
|
+
/** Canonical media types for model input/output (aligned with OpenRouter catalog). */
|
|
17
|
+
export declare const MODEL_MODALITIES: readonly ["text", "image", "audio", "video", "file"];
|
|
16
18
|
export declare const DEFAULT_RUNTIME_DEFAULTS: Required<AIRuntimeDefaults>;
|
|
17
19
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AACxD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,eAAO,MAAM,0BAA0B,sDACc,CAAC;AAEtD,eAAO,MAAM,6BAA6B,yDACc,CAAC;AAEzD,eAAO,MAAM,yBAAyB,qDACc,CAAC;AAErD,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,wCACC,CAAC;AAExC,eAAO,MAAM,sBAAsB,EAAG,kCAA2C,CAAC;AAClF,eAAO,MAAM,yBAAyB,EACpC,oCAA6C,CAAC;AAChD,eAAO,MAAM,yBAAyB,EACpC,oCAA6C,CAAC;AAEhD,eAAO,MAAM,uBAAuB,2HAI1B,CAAC;AACX,eAAO,MAAM,yBAAyB,EAAG,4BAAqC,CAAC;AAE/E,eAAO,MAAM,iBAAiB,0CAA2C,CAAC;AAE1E,eAAO,MAAM,mBAAmB,kEAKtB,CAAC;AAEX,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,iBAAiB,CAahE,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AACxD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,eAAO,MAAM,0BAA0B,sDACc,CAAC;AAEtD,eAAO,MAAM,6BAA6B,yDACc,CAAC;AAEzD,eAAO,MAAM,yBAAyB,qDACc,CAAC;AAErD,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,wCACC,CAAC;AAExC,eAAO,MAAM,sBAAsB,EAAG,kCAA2C,CAAC;AAClF,eAAO,MAAM,yBAAyB,EACpC,oCAA6C,CAAC;AAChD,eAAO,MAAM,yBAAyB,EACpC,oCAA6C,CAAC;AAEhD,eAAO,MAAM,uBAAuB,2HAI1B,CAAC;AACX,eAAO,MAAM,yBAAyB,EAAG,4BAAqC,CAAC;AAE/E,eAAO,MAAM,iBAAiB,0CAA2C,CAAC;AAE1E,eAAO,MAAM,mBAAmB,kEAKtB,CAAC;AAEX,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,sDAMnB,CAAC;AAEX,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,iBAAiB,CAahE,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -21,6 +21,14 @@ export const AI_PROFILE_BACKENDS = [
|
|
|
21
21
|
"transformersjs",
|
|
22
22
|
"custom",
|
|
23
23
|
];
|
|
24
|
+
/** Canonical media types for model input/output (aligned with OpenRouter catalog). */
|
|
25
|
+
export const MODEL_MODALITIES = [
|
|
26
|
+
"text",
|
|
27
|
+
"image",
|
|
28
|
+
"audio",
|
|
29
|
+
"video",
|
|
30
|
+
"file",
|
|
31
|
+
];
|
|
24
32
|
export const DEFAULT_RUNTIME_DEFAULTS = {
|
|
25
33
|
reasoningEffort: "medium",
|
|
26
34
|
outputMode: "text",
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,MAAM,CAAC,MAAM,0BAA0B,GACrC,mDAAmD,CAAC;AAEtD,MAAM,CAAC,MAAM,6BAA6B,GACxC,sDAAsD,CAAC;AAEzD,MAAM,CAAC,MAAM,yBAAyB,GACpC,kDAAkD,CAAC;AAErD,oFAAoF;AACpF,MAAM,CAAC,MAAM,yBA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D,CAAC;AAErD,oFAAoF;AACpF,MAAM,CAAC,MAAM,yBAAyB,GACpC,qCAAqC,CAAC;AAExC,MAAM,CAAC,MAAM,sBAAsB,GAAG,kCAA2C,CAAC;AAClF,MAAM,CAAC,MAAM,yBAAyB,GACpC,oCAA6C,CAAC;AAChD,MAAM,CAAC,MAAM,yBAAyB,GACpC,oCAA6C,CAAC;AAEhD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,sBAAsB;IACtB,yBAAyB;IACzB,yBAAyB;CACjB,CAAC;AACX,MAAM,CAAC,MAAM,yBAAyB,GAAG,4BAAqC,CAAC;AAE/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,WAAW,CAAU,CAAC;AAE1E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,QAAQ;CACA,CAAC;AAEX,sFAAsF;AACtF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;CACE,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAgC;IACnE,eAAe,EAAE,QAAQ;IACzB,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,GAAG;IAChB,UAAU,EAAE,MAAM;IAClB,aAAa,EAAE,MAAM;IACrB,gBAAgB,EAAE,KAAK;IACvB,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,KAAK;IACtB,kBAAkB,EAAE,KAAK;IACzB,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,SAAS;IAC1B,OAAO,EAAE,YAAY;CACtB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AIProfileChoice, AIModelPricing, CostCapPer1M, CostCapOption, ModelsCatalogJson } from "./types.js";
|
|
2
|
+
export declare function normalizeCostCap(cap: CostCapOption | undefined): CostCapPer1M | undefined;
|
|
3
|
+
export declare function getChoicePricingForCap(choice: AIProfileChoice, catalog?: ModelsCatalogJson): AIModelPricing | undefined;
|
|
4
|
+
export declare function choiceWithinCostCap(choice: AIProfileChoice, cap: CostCapPer1M, catalog?: ModelsCatalogJson): boolean;
|
|
5
|
+
export declare function filterChoicesByCostCap(choices: Record<string, AIProfileChoice>, cap: CostCapPer1M, catalog?: ModelsCatalogJson): Record<string, AIProfileChoice>;
|
|
6
|
+
export declare function formatCostCap(cap: CostCapPer1M): string;
|
|
7
|
+
//# sourceMappingURL=costPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"costPolicy.d.ts","sourceRoot":"","sources":["../src/costPolicy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,GAAG,SAAS,GAC7B,YAAY,GAAG,SAAS,CAiB1B;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,GAAG,SAAS,CAgB5B;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,YAAY,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CA6BT;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACxC,GAAG,EAAE,YAAY,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAUjC;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAYvD"}
|