@llmgateway/models 0.0.1 → 1.1.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 +104 -0
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -9
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/get-cheapest-from-available-providers.d.ts +0 -30
- package/dist/get-cheapest-from-available-providers.js +0 -183
- package/dist/get-cheapest-from-available-providers.js.map +0 -1
- package/dist/get-cheapest-model-for-provider.d.ts +0 -2
- package/dist/get-cheapest-model-for-provider.js +0 -49
- package/dist/get-cheapest-model-for-provider.js.map +0 -1
- package/dist/get-provider-endpoint.d.ts +0 -3
- package/dist/get-provider-endpoint.js +0 -243
- package/dist/get-provider-endpoint.js.map +0 -1
- package/dist/get-provider-headers.d.ts +0 -5
- package/dist/get-provider-headers.js +0 -45
- package/dist/get-provider-headers.js.map +0 -1
- package/dist/models.spec.d.ts +0 -1
- package/dist/models.spec.js +0 -263
- package/dist/models.spec.js.map +0 -1
- package/dist/prepare-request-body.d.ts +0 -10
- package/dist/prepare-request-body.js +0 -1081
- package/dist/prepare-request-body.js.map +0 -1
- package/dist/prepare-request-body.spec.d.ts +0 -1
- package/dist/prepare-request-body.spec.js +0 -231
- package/dist/prepare-request-body.spec.js.map +0 -1
- package/dist/process-image-url.d.ts +0 -4
- package/dist/process-image-url.js +0 -121
- package/dist/process-image-url.js.map +0 -1
- package/dist/transform-anthropic-messages.d.ts +0 -2
- package/dist/transform-anthropic-messages.js +0 -185
- package/dist/transform-anthropic-messages.js.map +0 -1
- package/dist/transform-google-messages.d.ts +0 -25
- package/dist/transform-google-messages.js +0 -122
- package/dist/transform-google-messages.js.map +0 -1
- package/dist/validate-provider-key.d.ts +0 -4
- package/dist/validate-provider-key.js +0 -113
- package/dist/validate-provider-key.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @llmgateway/models
|
|
2
|
+
|
|
3
|
+
Model and provider definitions for [LLM Gateway](https://llmgateway.io) - the unified API for all LLM providers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @llmgateway/models
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Models
|
|
14
|
+
|
|
15
|
+
The `models` array contains all supported LLM models with their pricing and provider mappings:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { models } from "@llmgateway/models";
|
|
19
|
+
|
|
20
|
+
// Find a specific model
|
|
21
|
+
const gpt4 = models.find((m) => m.id === "gpt-4o");
|
|
22
|
+
|
|
23
|
+
console.log(gpt4.id); // "gpt-4o"
|
|
24
|
+
console.log(gpt4.family); // "openai"
|
|
25
|
+
console.log(gpt4.contextSize); // 128000
|
|
26
|
+
console.log(gpt4.providers); // Provider mappings with pricing
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Model Properties
|
|
30
|
+
|
|
31
|
+
| Property | Type | Description |
|
|
32
|
+
| ------------------- | ------------------------ | ---------------------------------------------- |
|
|
33
|
+
| `id` | `string` | Unique model identifier |
|
|
34
|
+
| `family` | `string` | Model family (openai, anthropic, google, etc.) |
|
|
35
|
+
| `contextSize` | `number` | Maximum context window in tokens |
|
|
36
|
+
| `maxOutput` | `number` | Maximum output tokens |
|
|
37
|
+
| `providers` | `ProviderModelMapping[]` | Available providers with pricing |
|
|
38
|
+
| `supportsImages` | `boolean` | Whether model supports image inputs |
|
|
39
|
+
| `supportsTools` | `boolean` | Whether model supports tool/function calling |
|
|
40
|
+
| `supportsReasoning` | `boolean` | Whether model supports extended reasoning |
|
|
41
|
+
| `free` | `boolean` | Whether model is free to use |
|
|
42
|
+
|
|
43
|
+
#### Provider Mapping Properties
|
|
44
|
+
|
|
45
|
+
| Property | Type | Description |
|
|
46
|
+
| ------------------ | -------- | ---------------------------------- |
|
|
47
|
+
| `providerId` | `string` | Provider identifier |
|
|
48
|
+
| `modelName` | `string` | Model name at the provider |
|
|
49
|
+
| `inputPrice` | `number` | Price per input token (USD) |
|
|
50
|
+
| `outputPrice` | `number` | Price per output token (USD) |
|
|
51
|
+
| `cachedInputPrice` | `number` | Price per cached input token (USD) |
|
|
52
|
+
| `contextSize` | `number` | Provider-specific context size |
|
|
53
|
+
| `maxOutput` | `number` | Provider-specific max output |
|
|
54
|
+
|
|
55
|
+
### Providers
|
|
56
|
+
|
|
57
|
+
The `providers` array contains all supported LLM providers:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { providers } from "@llmgateway/models";
|
|
61
|
+
|
|
62
|
+
// List all providers
|
|
63
|
+
providers.forEach((p) => {
|
|
64
|
+
console.log(`${p.name}: ${p.description}`);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Find a specific provider
|
|
68
|
+
const openai = providers.find((p) => p.id === "openai");
|
|
69
|
+
console.log(openai.name); // "OpenAI"
|
|
70
|
+
console.log(openai.website); // "https://openai.com"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Provider Properties
|
|
74
|
+
|
|
75
|
+
| Property | Type | Description |
|
|
76
|
+
| ------------- | --------- | ----------------------------------- |
|
|
77
|
+
| `id` | `string` | Unique provider identifier |
|
|
78
|
+
| `name` | `string` | Display name |
|
|
79
|
+
| `description` | `string` | Provider description |
|
|
80
|
+
| `website` | `string` | Provider website URL |
|
|
81
|
+
| `streaming` | `boolean` | Whether provider supports streaming |
|
|
82
|
+
| `color` | `string` | Brand color (hex) |
|
|
83
|
+
|
|
84
|
+
## Supported Providers
|
|
85
|
+
|
|
86
|
+
- OpenAI
|
|
87
|
+
- Anthropic
|
|
88
|
+
- Google AI Studio
|
|
89
|
+
- Google Vertex AI
|
|
90
|
+
- Azure OpenAI
|
|
91
|
+
- AWS Bedrock
|
|
92
|
+
- Mistral
|
|
93
|
+
- DeepSeek
|
|
94
|
+
- xAI (Grok)
|
|
95
|
+
- Perplexity
|
|
96
|
+
- And more...
|
|
97
|
+
|
|
98
|
+
## Full Model List
|
|
99
|
+
|
|
100
|
+
For the complete list of models with live pricing, visit [llmgateway.io/models](https://llmgateway.io/models).
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
See [LICENSE](https://github.com/theopenco/llmgateway/blob/main/LICENSE) for details.
|
package/dist/index.d.ts
CHANGED
|
@@ -5,12 +5,3 @@ export * from "./providers.js";
|
|
|
5
5
|
export * from "./types.js";
|
|
6
6
|
export * from "./type-guards.js";
|
|
7
7
|
export * from "./helpers.js";
|
|
8
|
-
export * from "./transform-anthropic-messages.js";
|
|
9
|
-
export * from "./process-image-url.js";
|
|
10
|
-
export * from "./transform-google-messages.js";
|
|
11
|
-
export * from "./get-provider-headers.js";
|
|
12
|
-
export * from "./prepare-request-body.js";
|
|
13
|
-
export * from "./get-provider-endpoint.js";
|
|
14
|
-
export * from "./get-cheapest-from-available-providers.js";
|
|
15
|
-
export * from "./validate-provider-key.js";
|
|
16
|
-
export * from "./get-cheapest-model-for-provider.js";
|
package/dist/index.js
CHANGED
|
@@ -5,13 +5,4 @@ export * from "./providers.js";
|
|
|
5
5
|
export * from "./types.js";
|
|
6
6
|
export * from "./type-guards.js";
|
|
7
7
|
export * from "./helpers.js";
|
|
8
|
-
export * from "./transform-anthropic-messages.js";
|
|
9
|
-
export * from "./process-image-url.js";
|
|
10
|
-
export * from "./transform-google-messages.js";
|
|
11
|
-
export * from "./get-provider-headers.js";
|
|
12
|
-
export * from "./prepare-request-body.js";
|
|
13
|
-
export * from "./get-provider-endpoint.js";
|
|
14
|
-
export * from "./get-cheapest-from-available-providers.js";
|
|
15
|
-
export * from "./validate-provider-key.js";
|
|
16
|
-
export * from "./get-cheapest-model-for-provider.js";
|
|
17
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmgateway/models",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/theopenco/llmgateway",
|
|
8
|
+
"directory": "packages/models"
|
|
9
|
+
},
|
|
5
10
|
"license": "SEE LICENSE IN ../../LICENSE",
|
|
6
11
|
"type": "module",
|
|
7
12
|
"exports": {
|
|
@@ -20,10 +25,5 @@
|
|
|
20
25
|
"dev": "tsc-watch --onSuccess 'resolve-tspaths'",
|
|
21
26
|
"format": "eslint --fix . && prettier --write .",
|
|
22
27
|
"lint": "eslint . && prettier --check ."
|
|
23
|
-
}
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@llmgateway/db": "workspace:*",
|
|
26
|
-
"@llmgateway/logger": "workspace:*"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {}
|
|
28
|
+
}
|
|
29
29
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AvailableModelProvider, ModelWithPricing } from "./types.js";
|
|
2
|
-
import type { ProviderMetrics } from "@llmgateway/db";
|
|
3
|
-
export interface RoutingMetadata {
|
|
4
|
-
availableProviders: string[];
|
|
5
|
-
selectedProvider: string;
|
|
6
|
-
selectionReason: string;
|
|
7
|
-
providerScores: Array<{
|
|
8
|
-
providerId: string;
|
|
9
|
-
score: number;
|
|
10
|
-
uptime?: number;
|
|
11
|
-
latency?: number;
|
|
12
|
-
throughput?: number;
|
|
13
|
-
price: number;
|
|
14
|
-
priority?: number;
|
|
15
|
-
}>;
|
|
16
|
-
originalProvider?: string;
|
|
17
|
-
originalProviderUptime?: number;
|
|
18
|
-
noFallback?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface ProviderSelectionResult<T extends AvailableModelProvider> {
|
|
21
|
-
provider: T;
|
|
22
|
-
metadata: RoutingMetadata;
|
|
23
|
-
}
|
|
24
|
-
export interface ProviderSelectionOptions {
|
|
25
|
-
metricsMap?: Map<string, ProviderMetrics>;
|
|
26
|
-
isStreaming?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare function getCheapestFromAvailableProviders<T extends AvailableModelProvider>(availableModelProviders: T[], modelWithPricing: ModelWithPricing & {
|
|
29
|
-
id: string;
|
|
30
|
-
}, options?: ProviderSelectionOptions): ProviderSelectionResult<T> | null;
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { getProviderDefinition } from "./providers.js";
|
|
2
|
-
const PRICE_WEIGHT = 0.2;
|
|
3
|
-
const UPTIME_WEIGHT = 0.5;
|
|
4
|
-
const THROUGHPUT_WEIGHT = 0.2;
|
|
5
|
-
const LATENCY_WEIGHT = 0.1;
|
|
6
|
-
const UPTIME_PENALTY_THRESHOLD = 95;
|
|
7
|
-
function calculateUptimePenalty(uptime) {
|
|
8
|
-
if (uptime >= UPTIME_PENALTY_THRESHOLD) {
|
|
9
|
-
return 0;
|
|
10
|
-
}
|
|
11
|
-
const deficit = (UPTIME_PENALTY_THRESHOLD - uptime) / UPTIME_PENALTY_THRESHOLD;
|
|
12
|
-
return Math.pow(deficit * 5, 2);
|
|
13
|
-
}
|
|
14
|
-
const DEFAULT_UPTIME = 100;
|
|
15
|
-
const DEFAULT_LATENCY = 1000;
|
|
16
|
-
const DEFAULT_THROUGHPUT = 50;
|
|
17
|
-
const EXPLORATION_RATE = 0.01;
|
|
18
|
-
export function getCheapestFromAvailableProviders(availableModelProviders, modelWithPricing, options) {
|
|
19
|
-
const metricsMap = options?.metricsMap;
|
|
20
|
-
const isStreaming = options?.isStreaming ?? false;
|
|
21
|
-
if (availableModelProviders.length === 0) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
const stableProviders = availableModelProviders.filter((provider) => {
|
|
25
|
-
const providerInfo = modelWithPricing.providers.find((p) => p.providerId === provider.providerId);
|
|
26
|
-
const providerStability = providerInfo && "stability" in providerInfo
|
|
27
|
-
? providerInfo.stability
|
|
28
|
-
: undefined;
|
|
29
|
-
const modelStability = "stability" in modelWithPricing
|
|
30
|
-
? modelWithPricing.stability
|
|
31
|
-
: undefined;
|
|
32
|
-
const effectiveStability = providerStability ?? modelStability;
|
|
33
|
-
return (effectiveStability !== "unstable" && effectiveStability !== "experimental");
|
|
34
|
-
});
|
|
35
|
-
if (stableProviders.length === 0) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const isTest = process.env.NODE_ENV === "test" || process.env.VITEST;
|
|
39
|
-
if (!isTest && Math.random() < EXPLORATION_RATE) {
|
|
40
|
-
const randomProvider = stableProviders[Math.floor(Math.random() * stableProviders.length)];
|
|
41
|
-
return {
|
|
42
|
-
provider: randomProvider,
|
|
43
|
-
metadata: {
|
|
44
|
-
availableProviders: stableProviders.map((p) => p.providerId),
|
|
45
|
-
selectedProvider: randomProvider.providerId,
|
|
46
|
-
selectionReason: "random-exploration",
|
|
47
|
-
providerScores: [],
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (!metricsMap || metricsMap.size === 0) {
|
|
52
|
-
return selectByPriceOnly(stableProviders, modelWithPricing);
|
|
53
|
-
}
|
|
54
|
-
const providerScores = [];
|
|
55
|
-
for (const provider of stableProviders) {
|
|
56
|
-
const providerInfo = modelWithPricing.providers.find((p) => p.providerId === provider.providerId);
|
|
57
|
-
const discount = providerInfo?.discount || 0;
|
|
58
|
-
const discountMultiplier = 1 - discount;
|
|
59
|
-
const price = (((providerInfo?.inputPrice || 0) + (providerInfo?.outputPrice || 0)) /
|
|
60
|
-
2) *
|
|
61
|
-
discountMultiplier;
|
|
62
|
-
const metricsKey = `${modelWithPricing.id}:${provider.providerId}`;
|
|
63
|
-
const metrics = metricsMap.get(metricsKey);
|
|
64
|
-
providerScores.push({
|
|
65
|
-
provider,
|
|
66
|
-
score: 0,
|
|
67
|
-
price,
|
|
68
|
-
uptime: metrics?.uptime,
|
|
69
|
-
latency: metrics?.averageLatency,
|
|
70
|
-
throughput: metrics?.throughput,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
const prices = providerScores.map((p) => p.price);
|
|
74
|
-
const minPrice = Math.min(...prices);
|
|
75
|
-
const maxPrice = Math.max(...prices);
|
|
76
|
-
const uptimes = providerScores.map((p) => p.uptime ?? DEFAULT_UPTIME);
|
|
77
|
-
const minUptime = Math.min(...uptimes);
|
|
78
|
-
const maxUptime = Math.max(...uptimes);
|
|
79
|
-
const throughputs = providerScores.map((p) => p.throughput ?? DEFAULT_THROUGHPUT);
|
|
80
|
-
const minThroughput = Math.min(...throughputs);
|
|
81
|
-
const maxThroughput = Math.max(...throughputs);
|
|
82
|
-
const latencies = providerScores.map((p) => p.latency ?? DEFAULT_LATENCY);
|
|
83
|
-
const minLatency = Math.min(...latencies);
|
|
84
|
-
const maxLatency = Math.max(...latencies);
|
|
85
|
-
for (const providerScore of providerScores) {
|
|
86
|
-
const priceRange = maxPrice - minPrice;
|
|
87
|
-
const priceScore = priceRange > 0 ? (providerScore.price - minPrice) / priceRange : 0;
|
|
88
|
-
const uptime = providerScore.uptime ?? DEFAULT_UPTIME;
|
|
89
|
-
const uptimeRange = maxUptime - minUptime;
|
|
90
|
-
const uptimeScore = uptimeRange > 0 ? (maxUptime - uptime) / uptimeRange : 0;
|
|
91
|
-
const uptimePenalty = calculateUptimePenalty(uptime);
|
|
92
|
-
const throughput = providerScore.throughput ?? DEFAULT_THROUGHPUT;
|
|
93
|
-
const throughputRange = maxThroughput - minThroughput;
|
|
94
|
-
const throughputScore = throughputRange > 0 ? (maxThroughput - throughput) / throughputRange : 0;
|
|
95
|
-
let latencyScore = 0;
|
|
96
|
-
if (isStreaming) {
|
|
97
|
-
const latency = providerScore.latency ?? DEFAULT_LATENCY;
|
|
98
|
-
const latencyRange = maxLatency - minLatency;
|
|
99
|
-
latencyScore =
|
|
100
|
-
latencyRange > 0 ? (latency - minLatency) / latencyRange : 0;
|
|
101
|
-
}
|
|
102
|
-
const effectiveLatencyWeight = isStreaming ? LATENCY_WEIGHT : 0;
|
|
103
|
-
const weightSum = PRICE_WEIGHT + UPTIME_WEIGHT + THROUGHPUT_WEIGHT + effectiveLatencyWeight;
|
|
104
|
-
const baseScore = (PRICE_WEIGHT / weightSum) * priceScore +
|
|
105
|
-
(UPTIME_WEIGHT / weightSum) * uptimeScore +
|
|
106
|
-
(THROUGHPUT_WEIGHT / weightSum) * throughputScore +
|
|
107
|
-
(effectiveLatencyWeight / weightSum) * latencyScore;
|
|
108
|
-
const providerDef = getProviderDefinition(providerScore.provider.providerId);
|
|
109
|
-
const priority = providerDef?.priority ?? 1;
|
|
110
|
-
const priorityPenalty = 1 - priority;
|
|
111
|
-
providerScore.score = baseScore + priorityPenalty + uptimePenalty;
|
|
112
|
-
}
|
|
113
|
-
let bestProvider = providerScores[0];
|
|
114
|
-
for (const providerScore of providerScores) {
|
|
115
|
-
if (providerScore.score < bestProvider.score) {
|
|
116
|
-
bestProvider = providerScore;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const metadata = {
|
|
120
|
-
availableProviders: providerScores.map((p) => p.provider.providerId),
|
|
121
|
-
selectedProvider: bestProvider.provider.providerId,
|
|
122
|
-
selectionReason: metricsMap ? "weighted-score" : "price-only",
|
|
123
|
-
providerScores: providerScores.map((p) => {
|
|
124
|
-
const providerDef = getProviderDefinition(p.provider.providerId);
|
|
125
|
-
const priority = providerDef?.priority ?? 1;
|
|
126
|
-
return {
|
|
127
|
-
providerId: p.provider.providerId,
|
|
128
|
-
score: Number(p.score.toFixed(3)),
|
|
129
|
-
uptime: p.uptime,
|
|
130
|
-
latency: p.latency,
|
|
131
|
-
throughput: p.throughput,
|
|
132
|
-
price: p.price,
|
|
133
|
-
priority,
|
|
134
|
-
};
|
|
135
|
-
}),
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
provider: bestProvider.provider,
|
|
139
|
-
metadata,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function selectByPriceOnly(stableProviders, modelWithPricing) {
|
|
143
|
-
let cheapestProvider = stableProviders[0];
|
|
144
|
-
let lowestEffectivePrice = Number.MAX_VALUE;
|
|
145
|
-
const providerPrices = [];
|
|
146
|
-
for (const provider of stableProviders) {
|
|
147
|
-
const providerInfo = modelWithPricing.providers.find((p) => p.providerId === provider.providerId);
|
|
148
|
-
const discount = providerInfo?.discount || 0;
|
|
149
|
-
const discountMultiplier = 1 - discount;
|
|
150
|
-
const totalPrice = (((providerInfo?.inputPrice || 0) + (providerInfo?.outputPrice || 0)) /
|
|
151
|
-
2) *
|
|
152
|
-
discountMultiplier;
|
|
153
|
-
const providerDef = getProviderDefinition(provider.providerId);
|
|
154
|
-
const priority = providerDef?.priority ?? 1;
|
|
155
|
-
const effectivePrice = priority > 0 ? totalPrice / priority : totalPrice;
|
|
156
|
-
providerPrices.push({
|
|
157
|
-
providerId: provider.providerId,
|
|
158
|
-
price: totalPrice,
|
|
159
|
-
effectivePrice,
|
|
160
|
-
priority,
|
|
161
|
-
});
|
|
162
|
-
if (effectivePrice < lowestEffectivePrice) {
|
|
163
|
-
lowestEffectivePrice = effectivePrice;
|
|
164
|
-
cheapestProvider = provider;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
const metadata = {
|
|
168
|
-
availableProviders: stableProviders.map((p) => p.providerId),
|
|
169
|
-
selectedProvider: cheapestProvider.providerId,
|
|
170
|
-
selectionReason: "price-only-no-metrics",
|
|
171
|
-
providerScores: providerPrices.map((p) => ({
|
|
172
|
-
providerId: p.providerId,
|
|
173
|
-
score: 0,
|
|
174
|
-
price: p.price,
|
|
175
|
-
priority: p.priority,
|
|
176
|
-
})),
|
|
177
|
-
};
|
|
178
|
-
return {
|
|
179
|
-
provider: cheapestProvider,
|
|
180
|
-
metadata,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
//# sourceMappingURL=get-cheapest-from-available-providers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-cheapest-from-available-providers.js","sourceRoot":"","sources":["../src/get-cheapest-from-available-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAgBvD,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,cAAc,GAAG,GAAG,CAAC;AAG3B,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAYpC,SAAS,sBAAsB,CAAC,MAAc;IAC7C,IAAI,MAAM,IAAI,wBAAwB,EAAE,CAAC;QACxC,OAAO,CAAC,CAAC;IACV,CAAC;IAED,MAAM,OAAO,GACZ,CAAC,wBAAwB,GAAG,MAAM,CAAC,GAAG,wBAAwB,CAAC;IAEhE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AACjC,CAAC;AAGD,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAG9B,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAyC9B,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AAQ,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;QAEzE,cAAc,CAAC,IAAI,CAAC;YACnB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,KAAK,EAAE,UAAU;YACjB,cAAc;YACd,QAAQ;SACR,CAAC,CAAC;QAEH,IAAI,cAAc,GAAG,oBAAoB,EAAE,CAAC;YAC3C,oBAAoB,GAAG,cAAc,CAAC;YACtC,gBAAgB,GAAG,QAAQ,CAAC;QAC7B,CAAC;IACF,CAAC;IAED,MAAM,QAAQ,GAAoB;QACjC,kBAAkB,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;QAC5D,gBAAgB,EAAE,gBAAgB,CAAC,UAAU;QAC7C,eAAe,EAAE,uBAAuB;QACxC,cAAc,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1C,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,QAAQ,EAAE,CAAC,CAAC,QAAQ;SACpB,CAAC,CAAC;KACH,CAAC;IAEF,OAAO;QACN,QAAQ,EAAE,gBAAgB;QAC1B,QAAQ;KACR,CAAC;AACH,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { models } from "./models.js";
|
|
2
|
-
export function getCheapestModelForProvider(provider) {
|
|
3
|
-
const currentDate = new Date();
|
|
4
|
-
const availableModels = models
|
|
5
|
-
.filter((model) => model.providers.some((p) => p.providerId === provider))
|
|
6
|
-
.map((model) => ({
|
|
7
|
-
model: model.id,
|
|
8
|
-
modelStability: "stability" in model
|
|
9
|
-
? model.stability
|
|
10
|
-
: undefined,
|
|
11
|
-
provider: model.providers.find((p) => p.providerId === provider),
|
|
12
|
-
}))
|
|
13
|
-
.filter(({ provider: providerInfo }) => {
|
|
14
|
-
const deprecated = providerInfo.deprecatedAt &&
|
|
15
|
-
currentDate >= providerInfo.deprecatedAt;
|
|
16
|
-
const deactivated = providerInfo.deactivatedAt &&
|
|
17
|
-
currentDate >= providerInfo.deactivatedAt;
|
|
18
|
-
return !deprecated && !deactivated;
|
|
19
|
-
})
|
|
20
|
-
.filter(({ provider: providerInfo }) => providerInfo.inputPrice !== undefined &&
|
|
21
|
-
providerInfo.outputPrice !== undefined)
|
|
22
|
-
.filter(({ provider: providerInfo, modelStability }) => {
|
|
23
|
-
const providerStability = "stability" in providerInfo
|
|
24
|
-
? providerInfo.stability
|
|
25
|
-
: undefined;
|
|
26
|
-
const effectiveStability = providerStability ?? modelStability;
|
|
27
|
-
return (effectiveStability !== "unstable" &&
|
|
28
|
-
effectiveStability !== "experimental");
|
|
29
|
-
});
|
|
30
|
-
if (availableModels.length === 0) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
const paidModels = availableModels.filter(({ provider: providerInfo }) => providerInfo.inputPrice !== 0 || providerInfo.outputPrice !== 0);
|
|
34
|
-
const modelsToConsider = paidModels.length > 0 ? paidModels : availableModels;
|
|
35
|
-
let cheapestModel = modelsToConsider[0].provider.modelName;
|
|
36
|
-
let lowestPrice = Number.MAX_VALUE;
|
|
37
|
-
for (const { provider: providerInfo } of modelsToConsider) {
|
|
38
|
-
const discount = providerInfo.discount ?? 0;
|
|
39
|
-
const discountMultiplier = 1 - discount;
|
|
40
|
-
const totalPrice = ((providerInfo.inputPrice + providerInfo.outputPrice) / 2) *
|
|
41
|
-
discountMultiplier;
|
|
42
|
-
if (totalPrice < lowestPrice) {
|
|
43
|
-
lowestPrice = totalPrice;
|
|
44
|
-
cheapestModel = providerInfo.modelName;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return cheapestModel;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=get-cheapest-model-for-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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AAY,CAAC,SAAS,CAAC;QACxC,CAAC;IACF,CAAC;IAED,OAAO,aAAa,CAAC;AACtB,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ProviderId } from "./providers.js";
|
|
2
|
-
import type { ProviderKeyOptions } from "@llmgateway/db";
|
|
3
|
-
export declare function getProviderEndpoint(provider: ProviderId, baseUrl?: string, model?: string, token?: string, stream?: boolean, supportsReasoning?: boolean, hasExistingToolCalls?: boolean, providerKeyOptions?: ProviderKeyOptions, configIndex?: number, imageGenerations?: boolean): string;
|