@x12i/ai-tools 1.0.2
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 +214 -0
- package/dist/AiModelsCatalogClient-4RF5BCDL.cjs +9 -0
- package/dist/AiModelsCatalogClient-4RF5BCDL.cjs.map +1 -0
- package/dist/AiModelsCatalogClient-B-dNLXX0.d.ts +29 -0
- package/dist/AiModelsCatalogClient-CSVlKql5.d.cts +29 -0
- package/dist/AiModelsCatalogClient-NUF3CBLW.js +9 -0
- package/dist/AiModelsCatalogClient-NUF3CBLW.js.map +1 -0
- package/dist/aliases/index.cjs +11 -0
- package/dist/aliases/index.cjs.map +1 -0
- package/dist/aliases/index.d.cts +21 -0
- package/dist/aliases/index.d.ts +21 -0
- package/dist/aliases/index.js +11 -0
- package/dist/aliases/index.js.map +1 -0
- package/dist/catalox/index.cjs +21 -0
- package/dist/catalox/index.cjs.map +1 -0
- package/dist/catalox/index.d.cts +23 -0
- package/dist/catalox/index.d.ts +23 -0
- package/dist/catalox/index.js +21 -0
- package/dist/catalox/index.js.map +1 -0
- package/dist/chunk-2PYACSZ5.cjs +1 -0
- package/dist/chunk-2PYACSZ5.cjs.map +1 -0
- package/dist/chunk-3E67S427.cjs +1 -0
- package/dist/chunk-3E67S427.cjs.map +1 -0
- package/dist/chunk-4NAY6HRP.js +137 -0
- package/dist/chunk-4NAY6HRP.js.map +1 -0
- package/dist/chunk-5HNFAYTO.cjs +254 -0
- package/dist/chunk-5HNFAYTO.cjs.map +1 -0
- package/dist/chunk-6QGDZTGH.js +127 -0
- package/dist/chunk-6QGDZTGH.js.map +1 -0
- package/dist/chunk-7Q742NI3.cjs +106 -0
- package/dist/chunk-7Q742NI3.cjs.map +1 -0
- package/dist/chunk-AJEKEWWB.js +106 -0
- package/dist/chunk-AJEKEWWB.js.map +1 -0
- package/dist/chunk-AV6OE2YQ.cjs +127 -0
- package/dist/chunk-AV6OE2YQ.cjs.map +1 -0
- package/dist/chunk-COK34C6P.js +1 -0
- package/dist/chunk-COK34C6P.js.map +1 -0
- package/dist/chunk-DJ5SWJDY.js +729 -0
- package/dist/chunk-DJ5SWJDY.js.map +1 -0
- package/dist/chunk-F2F4UEFD.cjs +75 -0
- package/dist/chunk-F2F4UEFD.cjs.map +1 -0
- package/dist/chunk-G2G4KSC5.js +30 -0
- package/dist/chunk-G2G4KSC5.js.map +1 -0
- package/dist/chunk-HHNHWYTP.cjs +105 -0
- package/dist/chunk-HHNHWYTP.cjs.map +1 -0
- package/dist/chunk-HN6UAQAE.cjs +83 -0
- package/dist/chunk-HN6UAQAE.cjs.map +1 -0
- package/dist/chunk-KHODXGPV.js +1 -0
- package/dist/chunk-KHODXGPV.js.map +1 -0
- package/dist/chunk-KQOALKKX.js +75 -0
- package/dist/chunk-KQOALKKX.js.map +1 -0
- package/dist/chunk-LYOU7CA2.cjs +30 -0
- package/dist/chunk-LYOU7CA2.cjs.map +1 -0
- package/dist/chunk-ML2FRR4L.js +105 -0
- package/dist/chunk-ML2FRR4L.js.map +1 -0
- package/dist/chunk-MLRHYOCD.js +160 -0
- package/dist/chunk-MLRHYOCD.js.map +1 -0
- package/dist/chunk-O2A6OVEH.js +240 -0
- package/dist/chunk-O2A6OVEH.js.map +1 -0
- package/dist/chunk-ONA73BU6.cjs +160 -0
- package/dist/chunk-ONA73BU6.cjs.map +1 -0
- package/dist/chunk-QCRLKVB3.cjs +137 -0
- package/dist/chunk-QCRLKVB3.cjs.map +1 -0
- package/dist/chunk-QWAX7VQO.cjs +240 -0
- package/dist/chunk-QWAX7VQO.cjs.map +1 -0
- package/dist/chunk-TF4L2NEC.cjs +729 -0
- package/dist/chunk-TF4L2NEC.cjs.map +1 -0
- package/dist/chunk-XRBZQQQU.js +254 -0
- package/dist/chunk-XRBZQQQU.js.map +1 -0
- package/dist/chunk-YHO57D2V.js +83 -0
- package/dist/chunk-YHO57D2V.js.map +1 -0
- package/dist/cli/index.cjs +403 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +403 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cost/index.cjs +7 -0
- package/dist/cost/index.cjs.map +1 -0
- package/dist/cost/index.d.cts +52 -0
- package/dist/cost/index.d.ts +52 -0
- package/dist/cost/index.js +7 -0
- package/dist/cost/index.js.map +1 -0
- package/dist/index.cjs +104 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +58 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -0
- package/dist/modelNameResolver-Bn8QnkSj.d.ts +80 -0
- package/dist/modelNameResolver-bZD-eBSJ.d.cts +80 -0
- package/dist/models/index.cjs +33 -0
- package/dist/models/index.cjs.map +1 -0
- package/dist/models/index.d.cts +75 -0
- package/dist/models/index.d.ts +75 -0
- package/dist/models/index.js +33 -0
- package/dist/models/index.js.map +1 -0
- package/dist/sync/index.cjs +38 -0
- package/dist/sync/index.cjs.map +1 -0
- package/dist/sync/index.d.cts +12 -0
- package/dist/sync/index.d.ts +12 -0
- package/dist/sync/index.js +38 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/toolbox/index.cjs +7 -0
- package/dist/toolbox/index.cjs.map +1 -0
- package/dist/toolbox/index.d.cts +72 -0
- package/dist/toolbox/index.d.ts +72 -0
- package/dist/toolbox/index.js +7 -0
- package/dist/toolbox/index.js.map +1 -0
- package/dist/types-DdGB3YaA.d.cts +278 -0
- package/dist/types-DdGB3YaA.d.ts +278 -0
- package/package.json +115 -0
- package/schemas/aliases.json +28 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk5HNFAYTOcjs = require('./chunk-5HNFAYTO.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkLYOU7CA2cjs = require('./chunk-LYOU7CA2.cjs');
|
|
9
|
+
require('./chunk-3E67S427.cjs');
|
|
10
|
+
require('./chunk-2PYACSZ5.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkHN6UAQAEcjs = require('./chunk-HN6UAQAE.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkONA73BU6cjs = require('./chunk-ONA73BU6.cjs');
|
|
19
|
+
require('./chunk-HHNHWYTP.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _chunkQWAX7VQOcjs = require('./chunk-QWAX7VQO.cjs');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
var _chunkQCRLKVB3cjs = require('./chunk-QCRLKVB3.cjs');
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var _chunkAV6OE2YQcjs = require('./chunk-AV6OE2YQ.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunkF2F4UEFDcjs = require('./chunk-F2F4UEFD.cjs');
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
var _chunkTF4L2NECcjs = require('./chunk-TF4L2NEC.cjs');
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var _chunk7Q742NI3cjs = require('./chunk-7Q742NI3.cjs');
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
exports.AIToolbox = _chunk5HNFAYTOcjs.AIToolbox; exports.AI_MODELS_CATALOG_ID = _chunkTF4L2NECcjs.AI_MODELS_CATALOG_ID; exports.AI_MODELS_DESCRIPTOR = _chunkTF4L2NECcjs.AI_MODELS_DESCRIPTOR; exports.AI_TOOLS_APP_ID = _chunkTF4L2NECcjs.AI_TOOLS_APP_ID; exports.AiModelsCatalogClient = _chunkF2F4UEFDcjs.AiModelsCatalogClient; exports.AiModelsService = _chunkQCRLKVB3cjs.AiModelsService; exports.AiToolsError = _chunk7Q742NI3cjs.AiToolsError; exports.AliasConflictError = _chunk7Q742NI3cjs.AliasConflictError; exports.AliasFileParseError = _chunk7Q742NI3cjs.AliasFileParseError; exports.AliasFileWriteError = _chunk7Q742NI3cjs.AliasFileWriteError; exports.AliasInvalidNameError = _chunk7Q742NI3cjs.AliasInvalidNameError; exports.AliasNotFoundError = _chunk7Q742NI3cjs.AliasNotFoundError; exports.AliasRegistry = _chunkQWAX7VQOcjs.AliasRegistry; exports.AliasResolver = _chunkQWAX7VQOcjs.AliasResolver; exports.CostCalculationError = _chunk7Q742NI3cjs.CostCalculationError; exports.CostCalculator = _chunkHN6UAQAEcjs.CostCalculator; exports.ModelNameResolver = _chunkTF4L2NECcjs.ModelNameResolver; exports.ModelNotFoundError = _chunk7Q742NI3cjs.ModelNotFoundError; exports.ModelResolutionError = _chunk7Q742NI3cjs.ModelResolutionError; exports.OpenRouterSyncProvider = _chunkONA73BU6cjs.OpenRouterSyncProvider; exports.REASONING_SUPPORTED_PARAMETERS = _chunkAV6OE2YQcjs.REASONING_SUPPORTED_PARAMETERS; exports.SyncError = _chunk7Q742NI3cjs.SyncError; exports.computeSupportsReasoning = _chunkAV6OE2YQcjs.computeSupportsReasoning; exports.countModels = _chunkQCRLKVB3cjs.countModels; exports.createModelNameResolver = _chunkLYOU7CA2cjs.createModelNameResolver; exports.ensureAiModelsCatalog = _chunkONA73BU6cjs.ensureAiModelsCatalog; exports.filterModels = _chunkQCRLKVB3cjs.filterModels; exports.getModelInfo = _chunkQCRLKVB3cjs.getModelInfo; exports.hasReasoningPricing = _chunkAV6OE2YQcjs.hasReasoningPricing; exports.isReasoningModel = _chunkAV6OE2YQcjs.isReasoningModel; exports.isRoutedViaOpenRouter = _chunkLYOU7CA2cjs.isRoutedViaOpenRouter; exports.loadOpenRouterRoutingEnv = _chunkTF4L2NECcjs.loadOpenRouterRoutingEnv; exports.normalizeOpenRouterModel = _chunkAV6OE2YQcjs.normalizeOpenRouterModel; exports.providerIdToEnvKeyPrefix = _chunkTF4L2NECcjs.providerIdToEnvKeyPrefix; exports.resolveModel = _chunkLYOU7CA2cjs.resolveModel; exports.shouldDefaultRouteViaOpenRouter = _chunkTF4L2NECcjs.shouldDefaultRouteViaOpenRouter; exports.supportsReasoningParameter = _chunkAV6OE2YQcjs.supportsReasoningParameter; exports.syncAiModelsCatalog = _chunkONA73BU6cjs.syncAiModelsCatalog; exports.vendorApiKeyEnvName = _chunkTF4L2NECcjs.vendorApiKeyEnvName;
|
|
104
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/ami/Documents/prometheus/x12i/ai-tools/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,0lFAAC","file":"/Users/ami/Documents/prometheus/x12i/ai-tools/dist/index.cjs"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export { AiCostResult, AiUsageInput, CostCalculator, CostCalculatorOptions } from './cost/index.cjs';
|
|
2
|
+
export { A as AiModelsCatalogClient, a as AiModelsCatalogClientOptions } from './AiModelsCatalogClient-CSVlKql5.cjs';
|
|
3
|
+
export { AiModelsService, AiModelsServiceOptions, REASONING_SUPPORTED_PARAMETERS, ReasoningModelInput, computeSupportsReasoning, countModels, filterModels, getModelInfo, hasReasoningPricing, isReasoningModel, normalizeOpenRouterModel, supportsReasoningParameter } from './models/index.cjs';
|
|
4
|
+
import { h as ModelResolutionInput, i as ModelResolutionNotFound } from './types-DdGB3YaA.cjs';
|
|
5
|
+
export { A as AiModelPricing, a as AiModelRecord, b as AliasEntry, c as AliasFileSchema, d as AliasRegistry, e as AliasRegistryOptions, f as AliasValidationReport, M as ModelListFilters, g as ModelListResult, j as ModelResolutionResult, k as ModelResolutionSuccess, l as ModelResolverOptions, m as OpenRouterModelApi, n as OpenRouterModelsQuery, r as OpenRouterRoutingConfig, R as ResolutionStrategy, t as ResolvedModel, u as ResolvedModelRef, v as loadOpenRouterRoutingEnv, w as providerIdToEnvKeyPrefix, x as shouldDefaultRouteViaOpenRouter, y as vendorApiKeyEnvName } from './types-DdGB3YaA.cjs';
|
|
6
|
+
import { Catalox, CatalogDescriptor } from '@x12i/catalox';
|
|
7
|
+
export { M as ModelNameResolver, O as OpenRouterSyncProvider, a as OpenRouterSyncProviderOptions, S as SyncOptions, b as SyncResult, c as createModelNameResolver, i as isRoutedViaOpenRouter, r as resolveModel, s as syncAiModelsCatalog } from './modelNameResolver-bZD-eBSJ.cjs';
|
|
8
|
+
export { AIToolbox, AiToolboxOptions, Fallback, FallbackChain, Guard, GuardConfig, RouteRule, Router, TrackResult, Tracker } from './toolbox/index.cjs';
|
|
9
|
+
export { AliasResolver, AliasResolverOptions } from './aliases/index.cjs';
|
|
10
|
+
import 'firebase-admin/firestore';
|
|
11
|
+
|
|
12
|
+
type EnsureAiModelsCatalogOptions = {
|
|
13
|
+
appId?: string;
|
|
14
|
+
catalogId?: string;
|
|
15
|
+
};
|
|
16
|
+
declare function ensureAiModelsCatalog(catalox: Catalox, options?: EnsureAiModelsCatalogOptions): Promise<void>;
|
|
17
|
+
|
|
18
|
+
declare const AI_MODELS_CATALOG_ID = "ai-models";
|
|
19
|
+
declare const AI_TOOLS_APP_ID = "ai-tools";
|
|
20
|
+
declare const AI_MODELS_DESCRIPTOR: CatalogDescriptor;
|
|
21
|
+
|
|
22
|
+
type AiToolsErrorCode = "MODEL_NOT_FOUND" | "SYNC_FETCH_FAILED" | "SYNC_UPSERT_FAILED" | "CATALOG_BOOTSTRAP_FAILED" | "COST_CALCULATION_FAILED" | "INVALID_USAGE_INPUT" | "OPENROUTER_AUTH_FAILED" | "OPENROUTER_MODELS_FETCH_FAILED" | "CACHE_READ_ERROR" | "ALIAS_NOT_FOUND" | "ALIAS_INVALID_NAME" | "ALIAS_CONFLICT" | "ALIAS_FILE_PARSE_ERROR" | "ALIAS_FILE_WRITE_ERROR";
|
|
23
|
+
declare class AiToolsError extends Error {
|
|
24
|
+
readonly code: AiToolsErrorCode;
|
|
25
|
+
readonly cause?: unknown | undefined;
|
|
26
|
+
constructor(code: AiToolsErrorCode, message: string, cause?: unknown | undefined);
|
|
27
|
+
}
|
|
28
|
+
declare class ModelNotFoundError extends AiToolsError {
|
|
29
|
+
constructor(modelId: string);
|
|
30
|
+
}
|
|
31
|
+
declare class ModelResolutionError extends AiToolsError {
|
|
32
|
+
readonly input: ModelResolutionInput;
|
|
33
|
+
readonly result: ModelResolutionNotFound;
|
|
34
|
+
constructor(input: ModelResolutionInput, result: ModelResolutionNotFound);
|
|
35
|
+
}
|
|
36
|
+
declare class AliasNotFoundError extends AiToolsError {
|
|
37
|
+
constructor(aliasName: string);
|
|
38
|
+
}
|
|
39
|
+
declare class AliasInvalidNameError extends AiToolsError {
|
|
40
|
+
constructor(aliasName: string);
|
|
41
|
+
}
|
|
42
|
+
declare class AliasConflictError extends AiToolsError {
|
|
43
|
+
constructor(aliasName: string);
|
|
44
|
+
}
|
|
45
|
+
declare class AliasFileParseError extends AiToolsError {
|
|
46
|
+
constructor(path: string, cause?: unknown);
|
|
47
|
+
}
|
|
48
|
+
declare class AliasFileWriteError extends AiToolsError {
|
|
49
|
+
constructor(path: string, cause?: unknown);
|
|
50
|
+
}
|
|
51
|
+
declare class SyncError extends AiToolsError {
|
|
52
|
+
constructor(code: Extract<AiToolsErrorCode, "SYNC_FETCH_FAILED" | "SYNC_UPSERT_FAILED" | "OPENROUTER_AUTH_FAILED" | "OPENROUTER_MODELS_FETCH_FAILED">, message: string, cause?: unknown);
|
|
53
|
+
}
|
|
54
|
+
declare class CostCalculationError extends AiToolsError {
|
|
55
|
+
constructor(message: string, cause?: unknown);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { AI_MODELS_CATALOG_ID, AI_MODELS_DESCRIPTOR, AI_TOOLS_APP_ID, AiToolsError, type AiToolsErrorCode, AliasConflictError, AliasFileParseError, AliasFileWriteError, AliasInvalidNameError, AliasNotFoundError, CostCalculationError, type EnsureAiModelsCatalogOptions, ModelNotFoundError, ModelResolutionError, ModelResolutionInput, SyncError, ensureAiModelsCatalog };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export { AiCostResult, AiUsageInput, CostCalculator, CostCalculatorOptions } from './cost/index.js';
|
|
2
|
+
export { A as AiModelsCatalogClient, a as AiModelsCatalogClientOptions } from './AiModelsCatalogClient-B-dNLXX0.js';
|
|
3
|
+
export { AiModelsService, AiModelsServiceOptions, REASONING_SUPPORTED_PARAMETERS, ReasoningModelInput, computeSupportsReasoning, countModels, filterModels, getModelInfo, hasReasoningPricing, isReasoningModel, normalizeOpenRouterModel, supportsReasoningParameter } from './models/index.js';
|
|
4
|
+
import { h as ModelResolutionInput, i as ModelResolutionNotFound } from './types-DdGB3YaA.js';
|
|
5
|
+
export { A as AiModelPricing, a as AiModelRecord, b as AliasEntry, c as AliasFileSchema, d as AliasRegistry, e as AliasRegistryOptions, f as AliasValidationReport, M as ModelListFilters, g as ModelListResult, j as ModelResolutionResult, k as ModelResolutionSuccess, l as ModelResolverOptions, m as OpenRouterModelApi, n as OpenRouterModelsQuery, r as OpenRouterRoutingConfig, R as ResolutionStrategy, t as ResolvedModel, u as ResolvedModelRef, v as loadOpenRouterRoutingEnv, w as providerIdToEnvKeyPrefix, x as shouldDefaultRouteViaOpenRouter, y as vendorApiKeyEnvName } from './types-DdGB3YaA.js';
|
|
6
|
+
import { Catalox, CatalogDescriptor } from '@x12i/catalox';
|
|
7
|
+
export { M as ModelNameResolver, O as OpenRouterSyncProvider, a as OpenRouterSyncProviderOptions, S as SyncOptions, b as SyncResult, c as createModelNameResolver, i as isRoutedViaOpenRouter, r as resolveModel, s as syncAiModelsCatalog } from './modelNameResolver-Bn8QnkSj.js';
|
|
8
|
+
export { AIToolbox, AiToolboxOptions, Fallback, FallbackChain, Guard, GuardConfig, RouteRule, Router, TrackResult, Tracker } from './toolbox/index.js';
|
|
9
|
+
export { AliasResolver, AliasResolverOptions } from './aliases/index.js';
|
|
10
|
+
import 'firebase-admin/firestore';
|
|
11
|
+
|
|
12
|
+
type EnsureAiModelsCatalogOptions = {
|
|
13
|
+
appId?: string;
|
|
14
|
+
catalogId?: string;
|
|
15
|
+
};
|
|
16
|
+
declare function ensureAiModelsCatalog(catalox: Catalox, options?: EnsureAiModelsCatalogOptions): Promise<void>;
|
|
17
|
+
|
|
18
|
+
declare const AI_MODELS_CATALOG_ID = "ai-models";
|
|
19
|
+
declare const AI_TOOLS_APP_ID = "ai-tools";
|
|
20
|
+
declare const AI_MODELS_DESCRIPTOR: CatalogDescriptor;
|
|
21
|
+
|
|
22
|
+
type AiToolsErrorCode = "MODEL_NOT_FOUND" | "SYNC_FETCH_FAILED" | "SYNC_UPSERT_FAILED" | "CATALOG_BOOTSTRAP_FAILED" | "COST_CALCULATION_FAILED" | "INVALID_USAGE_INPUT" | "OPENROUTER_AUTH_FAILED" | "OPENROUTER_MODELS_FETCH_FAILED" | "CACHE_READ_ERROR" | "ALIAS_NOT_FOUND" | "ALIAS_INVALID_NAME" | "ALIAS_CONFLICT" | "ALIAS_FILE_PARSE_ERROR" | "ALIAS_FILE_WRITE_ERROR";
|
|
23
|
+
declare class AiToolsError extends Error {
|
|
24
|
+
readonly code: AiToolsErrorCode;
|
|
25
|
+
readonly cause?: unknown | undefined;
|
|
26
|
+
constructor(code: AiToolsErrorCode, message: string, cause?: unknown | undefined);
|
|
27
|
+
}
|
|
28
|
+
declare class ModelNotFoundError extends AiToolsError {
|
|
29
|
+
constructor(modelId: string);
|
|
30
|
+
}
|
|
31
|
+
declare class ModelResolutionError extends AiToolsError {
|
|
32
|
+
readonly input: ModelResolutionInput;
|
|
33
|
+
readonly result: ModelResolutionNotFound;
|
|
34
|
+
constructor(input: ModelResolutionInput, result: ModelResolutionNotFound);
|
|
35
|
+
}
|
|
36
|
+
declare class AliasNotFoundError extends AiToolsError {
|
|
37
|
+
constructor(aliasName: string);
|
|
38
|
+
}
|
|
39
|
+
declare class AliasInvalidNameError extends AiToolsError {
|
|
40
|
+
constructor(aliasName: string);
|
|
41
|
+
}
|
|
42
|
+
declare class AliasConflictError extends AiToolsError {
|
|
43
|
+
constructor(aliasName: string);
|
|
44
|
+
}
|
|
45
|
+
declare class AliasFileParseError extends AiToolsError {
|
|
46
|
+
constructor(path: string, cause?: unknown);
|
|
47
|
+
}
|
|
48
|
+
declare class AliasFileWriteError extends AiToolsError {
|
|
49
|
+
constructor(path: string, cause?: unknown);
|
|
50
|
+
}
|
|
51
|
+
declare class SyncError extends AiToolsError {
|
|
52
|
+
constructor(code: Extract<AiToolsErrorCode, "SYNC_FETCH_FAILED" | "SYNC_UPSERT_FAILED" | "OPENROUTER_AUTH_FAILED" | "OPENROUTER_MODELS_FETCH_FAILED">, message: string, cause?: unknown);
|
|
53
|
+
}
|
|
54
|
+
declare class CostCalculationError extends AiToolsError {
|
|
55
|
+
constructor(message: string, cause?: unknown);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { AI_MODELS_CATALOG_ID, AI_MODELS_DESCRIPTOR, AI_TOOLS_APP_ID, AiToolsError, type AiToolsErrorCode, AliasConflictError, AliasFileParseError, AliasFileWriteError, AliasInvalidNameError, AliasNotFoundError, CostCalculationError, type EnsureAiModelsCatalogOptions, ModelNotFoundError, ModelResolutionError, ModelResolutionInput, SyncError, ensureAiModelsCatalog };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AIToolbox
|
|
3
|
+
} from "./chunk-XRBZQQQU.js";
|
|
4
|
+
import {
|
|
5
|
+
createModelNameResolver,
|
|
6
|
+
isRoutedViaOpenRouter,
|
|
7
|
+
resolveModel
|
|
8
|
+
} from "./chunk-G2G4KSC5.js";
|
|
9
|
+
import "./chunk-KHODXGPV.js";
|
|
10
|
+
import "./chunk-COK34C6P.js";
|
|
11
|
+
import {
|
|
12
|
+
CostCalculator
|
|
13
|
+
} from "./chunk-YHO57D2V.js";
|
|
14
|
+
import {
|
|
15
|
+
OpenRouterSyncProvider,
|
|
16
|
+
ensureAiModelsCatalog,
|
|
17
|
+
syncAiModelsCatalog
|
|
18
|
+
} from "./chunk-MLRHYOCD.js";
|
|
19
|
+
import "./chunk-ML2FRR4L.js";
|
|
20
|
+
import {
|
|
21
|
+
AliasRegistry,
|
|
22
|
+
AliasResolver
|
|
23
|
+
} from "./chunk-O2A6OVEH.js";
|
|
24
|
+
import {
|
|
25
|
+
AiModelsService,
|
|
26
|
+
countModels,
|
|
27
|
+
filterModels,
|
|
28
|
+
getModelInfo
|
|
29
|
+
} from "./chunk-4NAY6HRP.js";
|
|
30
|
+
import {
|
|
31
|
+
REASONING_SUPPORTED_PARAMETERS,
|
|
32
|
+
computeSupportsReasoning,
|
|
33
|
+
hasReasoningPricing,
|
|
34
|
+
isReasoningModel,
|
|
35
|
+
normalizeOpenRouterModel,
|
|
36
|
+
supportsReasoningParameter
|
|
37
|
+
} from "./chunk-6QGDZTGH.js";
|
|
38
|
+
import {
|
|
39
|
+
AiModelsCatalogClient
|
|
40
|
+
} from "./chunk-KQOALKKX.js";
|
|
41
|
+
import {
|
|
42
|
+
AI_MODELS_CATALOG_ID,
|
|
43
|
+
AI_MODELS_DESCRIPTOR,
|
|
44
|
+
AI_TOOLS_APP_ID,
|
|
45
|
+
ModelNameResolver,
|
|
46
|
+
loadOpenRouterRoutingEnv,
|
|
47
|
+
providerIdToEnvKeyPrefix,
|
|
48
|
+
shouldDefaultRouteViaOpenRouter,
|
|
49
|
+
vendorApiKeyEnvName
|
|
50
|
+
} from "./chunk-DJ5SWJDY.js";
|
|
51
|
+
import {
|
|
52
|
+
AiToolsError,
|
|
53
|
+
AliasConflictError,
|
|
54
|
+
AliasFileParseError,
|
|
55
|
+
AliasFileWriteError,
|
|
56
|
+
AliasInvalidNameError,
|
|
57
|
+
AliasNotFoundError,
|
|
58
|
+
CostCalculationError,
|
|
59
|
+
ModelNotFoundError,
|
|
60
|
+
ModelResolutionError,
|
|
61
|
+
SyncError
|
|
62
|
+
} from "./chunk-AJEKEWWB.js";
|
|
63
|
+
export {
|
|
64
|
+
AIToolbox,
|
|
65
|
+
AI_MODELS_CATALOG_ID,
|
|
66
|
+
AI_MODELS_DESCRIPTOR,
|
|
67
|
+
AI_TOOLS_APP_ID,
|
|
68
|
+
AiModelsCatalogClient,
|
|
69
|
+
AiModelsService,
|
|
70
|
+
AiToolsError,
|
|
71
|
+
AliasConflictError,
|
|
72
|
+
AliasFileParseError,
|
|
73
|
+
AliasFileWriteError,
|
|
74
|
+
AliasInvalidNameError,
|
|
75
|
+
AliasNotFoundError,
|
|
76
|
+
AliasRegistry,
|
|
77
|
+
AliasResolver,
|
|
78
|
+
CostCalculationError,
|
|
79
|
+
CostCalculator,
|
|
80
|
+
ModelNameResolver,
|
|
81
|
+
ModelNotFoundError,
|
|
82
|
+
ModelResolutionError,
|
|
83
|
+
OpenRouterSyncProvider,
|
|
84
|
+
REASONING_SUPPORTED_PARAMETERS,
|
|
85
|
+
SyncError,
|
|
86
|
+
computeSupportsReasoning,
|
|
87
|
+
countModels,
|
|
88
|
+
createModelNameResolver,
|
|
89
|
+
ensureAiModelsCatalog,
|
|
90
|
+
filterModels,
|
|
91
|
+
getModelInfo,
|
|
92
|
+
hasReasoningPricing,
|
|
93
|
+
isReasoningModel,
|
|
94
|
+
isRoutedViaOpenRouter,
|
|
95
|
+
loadOpenRouterRoutingEnv,
|
|
96
|
+
normalizeOpenRouterModel,
|
|
97
|
+
providerIdToEnvKeyPrefix,
|
|
98
|
+
resolveModel,
|
|
99
|
+
shouldDefaultRouteViaOpenRouter,
|
|
100
|
+
supportsReasoningParameter,
|
|
101
|
+
syncAiModelsCatalog,
|
|
102
|
+
vendorApiKeyEnvName
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { n as OpenRouterModelsQuery, a as AiModelRecord, l as ModelResolverOptions, h as ModelResolutionInput, j as ModelResolutionResult, k as ModelResolutionSuccess, d as AliasRegistry, t as ResolvedModel } from './types-DdGB3YaA.js';
|
|
2
|
+
import { Catalox } from '@x12i/catalox';
|
|
3
|
+
import { Firestore } from 'firebase-admin/firestore';
|
|
4
|
+
|
|
5
|
+
type OpenRouterSyncProviderOptions = {
|
|
6
|
+
/** Optional — public GET /models needs no key. */
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
/** Query params passed to OpenRouter (default: all modalities). */
|
|
10
|
+
query?: OpenRouterModelsQuery;
|
|
11
|
+
};
|
|
12
|
+
declare class OpenRouterSyncProvider {
|
|
13
|
+
private readonly apiKey?;
|
|
14
|
+
private readonly baseUrl;
|
|
15
|
+
private readonly query?;
|
|
16
|
+
constructor(options?: OpenRouterSyncProviderOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Fetches the full OpenRouter model catalog (public, no API key required).
|
|
19
|
+
* @see https://openrouter.ai/api/v1/models
|
|
20
|
+
*/
|
|
21
|
+
fetchModels(): Promise<AiModelRecord[]>;
|
|
22
|
+
/** Build the URL used for the last fetch pattern (for debugging). */
|
|
23
|
+
getModelsUrl(): string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type SyncOptions = {
|
|
27
|
+
catalox: Catalox;
|
|
28
|
+
firestore: Firestore;
|
|
29
|
+
openRouterApiKey?: string;
|
|
30
|
+
openRouterQuery?: OpenRouterModelsQuery;
|
|
31
|
+
appId?: string;
|
|
32
|
+
catalogId?: string;
|
|
33
|
+
dryRun?: boolean;
|
|
34
|
+
verbose?: boolean;
|
|
35
|
+
forceCache?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type SyncResult = {
|
|
38
|
+
fetched: number;
|
|
39
|
+
upserted: number;
|
|
40
|
+
skipped: number;
|
|
41
|
+
errors: Array<{
|
|
42
|
+
modelId: string;
|
|
43
|
+
error: string;
|
|
44
|
+
}>;
|
|
45
|
+
durationMs: number;
|
|
46
|
+
};
|
|
47
|
+
declare function syncAiModelsCatalog(options: SyncOptions): Promise<SyncResult>;
|
|
48
|
+
|
|
49
|
+
declare class ModelNameResolver {
|
|
50
|
+
private readonly catalog;
|
|
51
|
+
private readonly indexes;
|
|
52
|
+
private readonly ctx;
|
|
53
|
+
constructor(catalog: Map<string, AiModelRecord>, options?: ModelResolverOptions);
|
|
54
|
+
resolve(input: ModelResolutionInput): ModelResolutionResult;
|
|
55
|
+
resolveMany(inputs: ModelResolutionInput[]): ModelResolutionResult[];
|
|
56
|
+
resolveOrThrow(input: ModelResolutionInput): ModelResolutionSuccess;
|
|
57
|
+
private runPipeline;
|
|
58
|
+
private exactMatch;
|
|
59
|
+
private catalogAliasMatch;
|
|
60
|
+
private slugMatch;
|
|
61
|
+
private inferProviderFromSlug;
|
|
62
|
+
private providerPrefixInjection;
|
|
63
|
+
private crossProviderCorrection;
|
|
64
|
+
private stripVersionSuffixes;
|
|
65
|
+
private dateSuffixMatch;
|
|
66
|
+
private findLatestVersioned;
|
|
67
|
+
private shorthandMap;
|
|
68
|
+
private partialMatch;
|
|
69
|
+
private computeRoutedViaOpenRouter;
|
|
70
|
+
private success;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare function createModelNameResolver(catalog: Map<string, AiModelRecord>, options?: ModelResolverOptions): ModelNameResolver;
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Prefer `ModelNameResolver.resolve()` for full resolution metadata.
|
|
76
|
+
*/
|
|
77
|
+
declare function resolveModel(input: string, models: Map<string, AiModelRecord>, aliasRegistry?: AliasRegistry, provider?: string): ResolvedModel | null;
|
|
78
|
+
declare function isRoutedViaOpenRouter(provider: string | undefined, model: AiModelRecord, matchedKey: string): boolean;
|
|
79
|
+
|
|
80
|
+
export { ModelNameResolver as M, OpenRouterSyncProvider as O, type SyncOptions as S, type OpenRouterSyncProviderOptions as a, type SyncResult as b, createModelNameResolver as c, isRoutedViaOpenRouter as i, resolveModel as r, syncAiModelsCatalog as s };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { n as OpenRouterModelsQuery, a as AiModelRecord, l as ModelResolverOptions, h as ModelResolutionInput, j as ModelResolutionResult, k as ModelResolutionSuccess, d as AliasRegistry, t as ResolvedModel } from './types-DdGB3YaA.cjs';
|
|
2
|
+
import { Catalox } from '@x12i/catalox';
|
|
3
|
+
import { Firestore } from 'firebase-admin/firestore';
|
|
4
|
+
|
|
5
|
+
type OpenRouterSyncProviderOptions = {
|
|
6
|
+
/** Optional — public GET /models needs no key. */
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
/** Query params passed to OpenRouter (default: all modalities). */
|
|
10
|
+
query?: OpenRouterModelsQuery;
|
|
11
|
+
};
|
|
12
|
+
declare class OpenRouterSyncProvider {
|
|
13
|
+
private readonly apiKey?;
|
|
14
|
+
private readonly baseUrl;
|
|
15
|
+
private readonly query?;
|
|
16
|
+
constructor(options?: OpenRouterSyncProviderOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Fetches the full OpenRouter model catalog (public, no API key required).
|
|
19
|
+
* @see https://openrouter.ai/api/v1/models
|
|
20
|
+
*/
|
|
21
|
+
fetchModels(): Promise<AiModelRecord[]>;
|
|
22
|
+
/** Build the URL used for the last fetch pattern (for debugging). */
|
|
23
|
+
getModelsUrl(): string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type SyncOptions = {
|
|
27
|
+
catalox: Catalox;
|
|
28
|
+
firestore: Firestore;
|
|
29
|
+
openRouterApiKey?: string;
|
|
30
|
+
openRouterQuery?: OpenRouterModelsQuery;
|
|
31
|
+
appId?: string;
|
|
32
|
+
catalogId?: string;
|
|
33
|
+
dryRun?: boolean;
|
|
34
|
+
verbose?: boolean;
|
|
35
|
+
forceCache?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type SyncResult = {
|
|
38
|
+
fetched: number;
|
|
39
|
+
upserted: number;
|
|
40
|
+
skipped: number;
|
|
41
|
+
errors: Array<{
|
|
42
|
+
modelId: string;
|
|
43
|
+
error: string;
|
|
44
|
+
}>;
|
|
45
|
+
durationMs: number;
|
|
46
|
+
};
|
|
47
|
+
declare function syncAiModelsCatalog(options: SyncOptions): Promise<SyncResult>;
|
|
48
|
+
|
|
49
|
+
declare class ModelNameResolver {
|
|
50
|
+
private readonly catalog;
|
|
51
|
+
private readonly indexes;
|
|
52
|
+
private readonly ctx;
|
|
53
|
+
constructor(catalog: Map<string, AiModelRecord>, options?: ModelResolverOptions);
|
|
54
|
+
resolve(input: ModelResolutionInput): ModelResolutionResult;
|
|
55
|
+
resolveMany(inputs: ModelResolutionInput[]): ModelResolutionResult[];
|
|
56
|
+
resolveOrThrow(input: ModelResolutionInput): ModelResolutionSuccess;
|
|
57
|
+
private runPipeline;
|
|
58
|
+
private exactMatch;
|
|
59
|
+
private catalogAliasMatch;
|
|
60
|
+
private slugMatch;
|
|
61
|
+
private inferProviderFromSlug;
|
|
62
|
+
private providerPrefixInjection;
|
|
63
|
+
private crossProviderCorrection;
|
|
64
|
+
private stripVersionSuffixes;
|
|
65
|
+
private dateSuffixMatch;
|
|
66
|
+
private findLatestVersioned;
|
|
67
|
+
private shorthandMap;
|
|
68
|
+
private partialMatch;
|
|
69
|
+
private computeRoutedViaOpenRouter;
|
|
70
|
+
private success;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare function createModelNameResolver(catalog: Map<string, AiModelRecord>, options?: ModelResolverOptions): ModelNameResolver;
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Prefer `ModelNameResolver.resolve()` for full resolution metadata.
|
|
76
|
+
*/
|
|
77
|
+
declare function resolveModel(input: string, models: Map<string, AiModelRecord>, aliasRegistry?: AliasRegistry, provider?: string): ResolvedModel | null;
|
|
78
|
+
declare function isRoutedViaOpenRouter(provider: string | undefined, model: AiModelRecord, matchedKey: string): boolean;
|
|
79
|
+
|
|
80
|
+
export { ModelNameResolver as M, OpenRouterSyncProvider as O, type SyncOptions as S, type OpenRouterSyncProviderOptions as a, type SyncResult as b, createModelNameResolver as c, isRoutedViaOpenRouter as i, resolveModel as r, syncAiModelsCatalog as s };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-2PYACSZ5.cjs');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkQCRLKVB3cjs = require('../chunk-QCRLKVB3.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkAV6OE2YQcjs = require('../chunk-AV6OE2YQ.cjs');
|
|
17
|
+
require('../chunk-F2F4UEFD.cjs');
|
|
18
|
+
require('../chunk-TF4L2NEC.cjs');
|
|
19
|
+
require('../chunk-7Q742NI3.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
exports.AiModelsService = _chunkQCRLKVB3cjs.AiModelsService; exports.REASONING_SUPPORTED_PARAMETERS = _chunkAV6OE2YQcjs.REASONING_SUPPORTED_PARAMETERS; exports.computeSupportsReasoning = _chunkAV6OE2YQcjs.computeSupportsReasoning; exports.countModels = _chunkQCRLKVB3cjs.countModels; exports.extractProviderId = _chunkAV6OE2YQcjs.extractProviderId; exports.filterModels = _chunkQCRLKVB3cjs.filterModels; exports.getModelInfo = _chunkQCRLKVB3cjs.getModelInfo; exports.hasReasoningPricing = _chunkAV6OE2YQcjs.hasReasoningPricing; exports.isReasoningModel = _chunkAV6OE2YQcjs.isReasoningModel; exports.normalizeOpenRouterModel = _chunkAV6OE2YQcjs.normalizeOpenRouterModel; exports.supportsReasoningParameter = _chunkAV6OE2YQcjs.supportsReasoningParameter;
|
|
33
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/ami/Documents/prometheus/x12i/ai-tools/dist/models/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,gvBAAC","file":"/Users/ami/Documents/prometheus/x12i/ai-tools/dist/models/index.cjs"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { a as AiModelRecord, M as ModelListFilters, g as ModelListResult, j as ModelResolutionResult, m as OpenRouterModelApi } from '../types-DdGB3YaA.cjs';
|
|
2
|
+
export { A as AiModelPricing, O as OpenRouterArchitectureApi, n as OpenRouterModelsQuery, o as OpenRouterModelsResponse, p as OpenRouterOutputModality, q as OpenRouterPricingApi, s as OpenRouterTopProviderApi } from '../types-DdGB3YaA.cjs';
|
|
3
|
+
import { Catalox, CatalogQueryOptions } from '@x12i/catalox';
|
|
4
|
+
|
|
5
|
+
type AiModelsServiceOptions = {
|
|
6
|
+
catalox: Catalox;
|
|
7
|
+
appId?: string;
|
|
8
|
+
catalogId?: string;
|
|
9
|
+
cacheTtlMs?: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* High-level model catalog API — list, filter, count, and get full model info.
|
|
13
|
+
*/
|
|
14
|
+
declare class AiModelsService {
|
|
15
|
+
private readonly client;
|
|
16
|
+
private readonly catalox;
|
|
17
|
+
private readonly appId;
|
|
18
|
+
private readonly catalogId;
|
|
19
|
+
constructor(options: AiModelsServiceOptions);
|
|
20
|
+
private context;
|
|
21
|
+
/** Load all models (cached). */
|
|
22
|
+
getAllModels(): Promise<Map<string, AiModelRecord>>;
|
|
23
|
+
/** List models with in-memory filters (fast after cache warm). */
|
|
24
|
+
listModels(filters?: ModelListFilters): Promise<ModelListResult>;
|
|
25
|
+
/** Count models matching filters. */
|
|
26
|
+
countModels(filters?: Omit<ModelListFilters, "limit" | "offset">): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Full model record by id or alias (same resolution as cost calculator).
|
|
29
|
+
*/
|
|
30
|
+
getModelInfo(modelIdOrAlias: string): Promise<AiModelRecord | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Query via Catalox indexed fields (provider, status, output modality, tools).
|
|
33
|
+
* Falls back to in-memory filter when Catalox returns partial pages.
|
|
34
|
+
*/
|
|
35
|
+
listModelsFromCatalog(filters?: ModelListFilters, options?: CatalogQueryOptions): Promise<ModelListResult>;
|
|
36
|
+
resolve(modelIdOrAlias: string, provider?: string): Promise<ModelResolutionResult>;
|
|
37
|
+
refresh(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/** Convenience: getModelInfo */
|
|
40
|
+
declare function getModelInfo(service: AiModelsService, modelIdOrAlias: string): Promise<AiModelRecord | null>;
|
|
41
|
+
|
|
42
|
+
declare function filterModels(models: Iterable<AiModelRecord>, filters?: ModelListFilters): AiModelRecord[];
|
|
43
|
+
declare function countModels(models: Iterable<AiModelRecord>, filters?: Omit<ModelListFilters, "limit" | "offset">): number;
|
|
44
|
+
|
|
45
|
+
declare function extractProviderId(modelId: string): string;
|
|
46
|
+
declare function normalizeOpenRouterModel(row: OpenRouterModelApi, syncedAt: string): AiModelRecord;
|
|
47
|
+
|
|
48
|
+
/** OpenRouter `supported_parameters` values that indicate reasoning API support. */
|
|
49
|
+
declare const REASONING_SUPPORTED_PARAMETERS: readonly ["reasoning", "include_reasoning"];
|
|
50
|
+
type ReasoningModelInput = Pick<AiModelRecord, "supportedParameters" | "pricing" | "openRouterPricing"> & {
|
|
51
|
+
supportsReasoning?: boolean;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Whether the model accepts OpenRouter's `reasoning` request parameter
|
|
55
|
+
* (effort, max_tokens, exclude, enabled).
|
|
56
|
+
*/
|
|
57
|
+
declare function supportsReasoningParameter(model: Pick<AiModelRecord, "supportedParameters">): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the model bills separate reasoning / thinking tokens
|
|
60
|
+
* (`internal_reasoning` in OpenRouter pricing).
|
|
61
|
+
*/
|
|
62
|
+
declare function hasReasoningPricing(model: Pick<AiModelRecord, "pricing" | "openRouterPricing">): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Compute `supportsReasoning` from catalog fields (used during sync normalization).
|
|
65
|
+
*/
|
|
66
|
+
declare function computeSupportsReasoning(model: ReasoningModelInput): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* True when the model supports reasoning tokens (API param and/or separate reasoning pricing).
|
|
69
|
+
*
|
|
70
|
+
* Prefer `model.supportsReasoning` on {@link AiModelRecord} after catalog sync;
|
|
71
|
+
* this helper also works when only partial fields are available.
|
|
72
|
+
*/
|
|
73
|
+
declare function isReasoningModel(model: ReasoningModelInput): boolean;
|
|
74
|
+
|
|
75
|
+
export { AiModelRecord, AiModelsService, type AiModelsServiceOptions, ModelListFilters, ModelListResult, OpenRouterModelApi, REASONING_SUPPORTED_PARAMETERS, type ReasoningModelInput, computeSupportsReasoning, countModels, extractProviderId, filterModels, getModelInfo, hasReasoningPricing, isReasoningModel, normalizeOpenRouterModel, supportsReasoningParameter };
|