@linxiraos/pi-catalog 1.4.7 → 1.4.9
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/CHANGELOG.md +4 -23
- package/dist/types/compat/auth-ids.d.ts +2 -2
- package/dist/types/compat/catalog-policy.d.ts +6 -4
- package/dist/types/compat/factory-droid.d.ts +7 -1
- package/dist/types/compat/provider-ids.d.ts +1 -1
- package/dist/types/compat/resolve.d.ts +1 -1
- package/dist/types/compat/revision.d.ts +2 -0
- package/dist/types/compat/server-side-fallback.d.ts +6 -4
- package/dist/types/compat/types.d.ts +3 -1
- package/dist/types/discovery/cursor-proto.d.ts +8 -0
- package/dist/types/discovery/openai-compatible.d.ts +6 -0
- package/dist/types/model-manager.d.ts +11 -1
- package/dist/types/model-thinking.d.ts +4 -0
- package/dist/types/models.d.ts +16 -0
- package/dist/types/pricing.d.ts +66 -6
- package/dist/types/provider-models/openai-compat.d.ts +18 -13
- package/dist/types/types.d.ts +14 -19
- package/dist/types/utils.d.ts +8 -0
- package/package.json +4 -4
- package/src/compat/auth-ids.ts +5 -0
- package/src/compat/axes.ts +21 -9
- package/src/compat/catalog-policy.d.ts +9 -0
- package/src/compat/catalog-policy.ts +14 -10
- package/src/compat/collapse.ts +1 -1
- package/src/compat/factory-droid.d.ts +7 -1
- package/src/compat/factory-droid.ts +9 -1
- package/src/compat/provider-ids.d.ts +1 -1
- package/src/compat/provider-ids.ts +2 -0
- package/src/compat/resolve.d.ts +1 -1
- package/src/compat/resolve.ts +4 -5
- package/src/compat/revision.d.ts +2 -0
- package/src/compat/revision.ts +10 -0
- package/src/compat/rules/README.md +3 -1
- package/src/compat/rules/auth/_order.kdl +1 -1
- package/src/compat/rules/auth/mistral.kdl +4 -0
- package/src/compat/rules/auth/modular.kdl +9 -0
- package/src/compat/rules/auth/scaleway.kdl +17 -0
- package/src/compat/rules/classes/anthropic.kdl +5 -0
- package/src/compat/rules/classes/deepseek.kdl +1 -1
- package/src/compat/rules/classes/gemini.kdl +1 -1
- package/src/compat/rules/classes/xai.kdl +1 -1
- package/src/compat/rules/providers/anthropic.kdl +8 -4
- package/src/compat/rules/providers/cursor.kdl +10 -0
- package/src/compat/rules/providers/deepseek.kdl +2 -2
- package/src/compat/rules/providers/factory-droid.kdl +219 -13
- package/src/compat/rules/providers/modular.kdl +35 -0
- package/src/compat/rules/providers/openai-codex.kdl +1 -1
- package/src/compat/rules/providers/sambanova.kdl +2 -0
- package/src/compat/rules/providers/scaleway.kdl +179 -0
- package/src/compat/rules/runtime/behavior.kdl +13 -0
- package/src/compat/rules.json +1 -1
- package/src/compat/server-side-fallback.d.ts +9 -0
- package/src/compat/server-side-fallback.ts +7 -5
- package/src/compat/types.d.ts +3 -1
- package/src/compat/types.ts +3 -1
- package/src/discovery/codex.ts +2 -9
- package/src/discovery/cursor-proto.d.ts +8 -0
- package/src/discovery/cursor-proto.ts +12 -1
- package/src/discovery/factory-droid.ts +35 -11
- package/src/discovery/openai-compatible.d.ts +6 -0
- package/src/discovery/openai-compatible.ts +1 -1
- package/src/model-cache.ts +32 -58
- package/src/model-catalog-format.ts +5 -8
- package/src/model-manager.d.ts +11 -1
- package/src/model-manager.ts +85 -143
- package/src/model-thinking.d.ts +4 -0
- package/src/model-thinking.ts +10 -0
- package/src/model-tokenizer.ts +13 -12
- package/src/models.d.ts +16 -0
- package/src/models.json +1 -1
- package/src/models.ts +32 -1
- package/src/pricing.d.ts +66 -6
- package/src/pricing.ts +59 -94
- package/src/provider-models/catalog-snapshot.json.zst +0 -0
- package/src/provider-models/catalog-snapshot.json.zst.d.ts +3 -0
- package/src/provider-models/descriptors.ts +2 -0
- package/src/provider-models/openai-compat.d.ts +18 -13
- package/src/provider-models/openai-compat.ts +120 -71
- package/src/types.d.ts +14 -19
- package/src/types.ts +11 -18
- package/src/utils.d.ts +8 -0
- package/src/utils.ts +18 -0
- package/src/wire/factory-droid.ts +4 -3
package/src/models.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { classifyModel } from "./compat/taxonomy";
|
|
2
2
|
import { getCatalogProvider, getCatalogProviders, openModelCatalog } from "./model-catalog-format";
|
|
3
3
|
import modelsData from "./models.json" with { type: "json" };
|
|
4
|
-
import { dueEffectiveRate } from "./pricing";
|
|
4
|
+
import { dueDatedCard, dueEffectiveRate } from "./pricing";
|
|
5
5
|
import type {
|
|
6
6
|
Api,
|
|
7
7
|
EffectiveTokenCost,
|
|
@@ -77,6 +77,37 @@ export function getModelPricingStatus(model: Pick<Model<Api>, "cost" | "pricingS
|
|
|
77
77
|
return model.pricingStatus ?? "unknown";
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
/** Factory Droid credit rate in force at a time, and the next dated change to it. */
|
|
81
|
+
export interface FactoryDroidCreditRate {
|
|
82
|
+
rate: number;
|
|
83
|
+
/** The earliest later `credit-rates` card that changes `rate`: the rate it sets and when (Unix ms). */
|
|
84
|
+
next?: { rate: number; at: number };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Factory Droid Standard Credits rate at `timestamp` (Unix ms, default now):
|
|
89
|
+
* the `input` of the `credit-rates` card due then (the latest at or before
|
|
90
|
+
* it, as for cost cards), else the base rate. Undefined for models without a
|
|
91
|
+
* credit rate.
|
|
92
|
+
*/
|
|
93
|
+
export function getFactoryDroidCreditRate(
|
|
94
|
+
model: Pick<Model, "factoryDroidCredits" | "factoryDroidCreditCards">,
|
|
95
|
+
timestamp = Date.now(),
|
|
96
|
+
): FactoryDroidCreditRate | undefined {
|
|
97
|
+
const base = model.factoryDroidCredits;
|
|
98
|
+
if (base === undefined) return undefined;
|
|
99
|
+
const cards = model.factoryDroidCreditCards ?? [];
|
|
100
|
+
const rate = dueDatedCard(cards, timestamp)?.input ?? base;
|
|
101
|
+
let next: FactoryDroidCreditRate["next"];
|
|
102
|
+
for (const card of cards) {
|
|
103
|
+
const cardRate = card.input ?? base;
|
|
104
|
+
if (card.effectiveFrom > timestamp && cardRate !== rate && !(next && next.at <= card.effectiveFrom)) {
|
|
105
|
+
next = { rate: cardRate, at: card.effectiveFrom };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return next ? { rate, next } : { rate };
|
|
109
|
+
}
|
|
110
|
+
|
|
80
111
|
/**
|
|
81
112
|
* The base token card in force at `timestamp` (Unix ms, default now): the
|
|
82
113
|
* latest due `timeBased` effective rate, else the row's own legs. Price
|
package/src/pricing.d.ts
CHANGED
|
@@ -1,24 +1,84 @@
|
|
|
1
1
|
import type { EffectiveTokenCost, ModelCost, TimeBasedCost, TokenCost } from "./types";
|
|
2
|
+
/** Serialized time-based pricing schedule, as cached model rows carry it. */
|
|
3
|
+
export declare const TimeBasedCostShape: import("@linxiraos/pi-omptype").FluentType<{
|
|
4
|
+
effectiveRates?: ({
|
|
5
|
+
cacheRead: number;
|
|
6
|
+
cacheWrite: number;
|
|
7
|
+
input: number;
|
|
8
|
+
output: number;
|
|
9
|
+
} & {
|
|
10
|
+
effectiveFrom: number;
|
|
11
|
+
longContext?: ({
|
|
12
|
+
cacheRead: number;
|
|
13
|
+
cacheWrite: number;
|
|
14
|
+
input: number;
|
|
15
|
+
output: number;
|
|
16
|
+
} & {
|
|
17
|
+
inputThreshold: number;
|
|
18
|
+
inputThresholdInclusive?: boolean | undefined;
|
|
19
|
+
}) | undefined;
|
|
20
|
+
})[] | undefined;
|
|
21
|
+
offPeakMultiplier: number;
|
|
22
|
+
peakWindows: {
|
|
23
|
+
endMinute: number;
|
|
24
|
+
startMinute: number;
|
|
25
|
+
weekdays: number[];
|
|
26
|
+
}[];
|
|
27
|
+
}, {
|
|
28
|
+
effectiveRates?: ({
|
|
29
|
+
cacheRead: number;
|
|
30
|
+
cacheWrite: number;
|
|
31
|
+
input: number;
|
|
32
|
+
output: number;
|
|
33
|
+
} & {
|
|
34
|
+
effectiveFrom: number;
|
|
35
|
+
longContext?: ({
|
|
36
|
+
cacheRead: number;
|
|
37
|
+
cacheWrite: number;
|
|
38
|
+
input: number;
|
|
39
|
+
output: number;
|
|
40
|
+
} & {
|
|
41
|
+
inputThreshold: number;
|
|
42
|
+
inputThresholdInclusive?: boolean | undefined;
|
|
43
|
+
}) | undefined;
|
|
44
|
+
})[] | undefined;
|
|
45
|
+
offPeakMultiplier: number;
|
|
46
|
+
peakWindows: {
|
|
47
|
+
endMinute: number;
|
|
48
|
+
startMinute: number;
|
|
49
|
+
weekdays: number[];
|
|
50
|
+
}[];
|
|
51
|
+
}>;
|
|
2
52
|
/** Validate serialized schedules before admitting cached model rows. */
|
|
3
53
|
export declare function isTimeBasedCost(value: unknown): value is TimeBasedCost;
|
|
4
54
|
/** KDL object children are named records; normalize them once while constructing the model. */
|
|
5
55
|
export declare function materializeTimeBasedCost(value: unknown): TimeBasedCost;
|
|
56
|
+
/**
|
|
57
|
+
* The dated card due at `timestamp`: the one with the latest `effectiveFrom`
|
|
58
|
+
* at or before it, in any order, or undefined before the first card.
|
|
59
|
+
*/
|
|
60
|
+
export declare function dueDatedCard<T extends {
|
|
61
|
+
effectiveFrom: number;
|
|
62
|
+
}>(cards: readonly T[], timestamp: number): T | undefined;
|
|
6
63
|
/**
|
|
7
64
|
* The latest `effectiveRates` card of a materialized schedule due at
|
|
8
65
|
* `timestamp`, or undefined before the first one (or without a schedule).
|
|
9
66
|
*/
|
|
10
67
|
export declare function dueEffectiveRate(schedule: TimeBasedCost | undefined, timestamp: number): EffectiveTokenCost | undefined;
|
|
11
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* A dated `effective-rates` card of a `cost-patch`, `cost-fallback` or
|
|
70
|
+
* `credit-rates` rule: the legs it overwrites from `effectiveFrom` (Unix ms).
|
|
71
|
+
*/
|
|
12
72
|
export interface DatedCostCard extends Partial<TokenCost> {
|
|
13
73
|
effectiveFrom: number;
|
|
14
74
|
}
|
|
15
75
|
/**
|
|
16
|
-
* Parse the compiled `effective-rates` block of a `cost-patch
|
|
17
|
-
* `cost-fallback` payload into dated cards,
|
|
18
|
-
* malformed card, so a typo in a rule fails the
|
|
19
|
-
* leaving the old price in force.
|
|
76
|
+
* Parse the compiled `effective-rates` block of a `cost-patch`,
|
|
77
|
+
* `cost-fallback` or Factory Droid `credit-rates` payload into dated cards,
|
|
78
|
+
* ascending by date. Throws on a malformed card, so a typo in a rule fails the
|
|
79
|
+
* build instead of silently leaving the old price in force.
|
|
20
80
|
*/
|
|
21
|
-
export declare function parseDatedCostCards(costAxis: unknown, axis: "cost-patch" | "cost-fallback"): DatedCostCard[];
|
|
81
|
+
export declare function parseDatedCostCards(costAxis: unknown, axis: "cost-patch" | "cost-fallback" | "credit-rates"): DatedCostCard[];
|
|
22
82
|
/**
|
|
23
83
|
* Earliest instant a rate card can name (the `Date` range minimum). A leading
|
|
24
84
|
* card from here holds the price in force before the first dated change.
|
package/src/pricing.ts
CHANGED
|
@@ -1,84 +1,35 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
LongContextTokenCost,
|
|
4
|
-
ModelCost,
|
|
5
|
-
PeakPricingWindow,
|
|
6
|
-
TimeBasedCost,
|
|
7
|
-
TokenCost,
|
|
8
|
-
} from "./types";
|
|
1
|
+
import { type } from "@linxiraos/pi-omptype";
|
|
2
|
+
import type { EffectiveTokenCost, ModelCost, TimeBasedCost, TokenCost } from "./types";
|
|
9
3
|
import { isRecord } from "./utils";
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function isPeakWindow(value: unknown): value is PeakPricingWindow {
|
|
37
|
-
return (
|
|
38
|
-
isRecord(value) &&
|
|
39
|
-
Array.isArray(value.weekdays) &&
|
|
40
|
-
value.weekdays.length > 0 &&
|
|
41
|
-
value.weekdays.every(day => Number.isInteger(day) && day >= 0 && day <= 6) &&
|
|
42
|
-
new Set(value.weekdays).size === value.weekdays.length &&
|
|
43
|
-
typeof value.startMinute === "number" &&
|
|
44
|
-
Number.isInteger(value.startMinute) &&
|
|
45
|
-
typeof value.endMinute === "number" &&
|
|
46
|
-
Number.isInteger(value.endMinute) &&
|
|
47
|
-
value.startMinute >= 0 &&
|
|
48
|
-
value.endMinute <= 1440 &&
|
|
49
|
-
value.startMinute < value.endMinute
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function isEffectiveRate(value: unknown): value is EffectiveTokenCost {
|
|
54
|
-
return (
|
|
55
|
-
isRecord(value) &&
|
|
56
|
-
isRates(value) &&
|
|
57
|
-
typeof value.effectiveFrom === "number" &&
|
|
58
|
-
Number.isSafeInteger(value.effectiveFrom) &&
|
|
59
|
-
Math.abs(value.effectiveFrom) <= 8_640_000_000_000_000 &&
|
|
60
|
-
(value.longContext === undefined || isLongContext(value.longContext))
|
|
61
|
-
);
|
|
62
|
-
}
|
|
5
|
+
// Schedules are also checked on in-memory discovery output, where absent optionals may be explicit `undefined`.
|
|
6
|
+
const Rate = type("number >= 0");
|
|
7
|
+
const Rates = type({ input: Rate, output: Rate, cacheRead: Rate, cacheWrite: Rate });
|
|
8
|
+
const LongContext = Rates.and({ inputThreshold: "number > 0", "inputThresholdInclusive?": "boolean | undefined" });
|
|
9
|
+
const PeakWindow = type({
|
|
10
|
+
weekdays: type("0 <= number.integer <= 6").array().atLeastLength(1),
|
|
11
|
+
startMinute: "number.integer >= 0",
|
|
12
|
+
endMinute: "number.integer <= 1440",
|
|
13
|
+
}).narrow(window => new Set(window.weekdays).size === window.weekdays.length && window.startMinute < window.endMinute);
|
|
14
|
+
const EffectiveRate = Rates.and({
|
|
15
|
+
// The `Date` range.
|
|
16
|
+
effectiveFrom: "-8640000000000000 <= number.integer <= 8640000000000000",
|
|
17
|
+
"longContext?": LongContext.or("undefined"),
|
|
18
|
+
});
|
|
19
|
+
/** Serialized time-based pricing schedule, as cached model rows carry it. */
|
|
20
|
+
export const TimeBasedCostShape = type({
|
|
21
|
+
offPeakMultiplier: Rate,
|
|
22
|
+
peakWindows: PeakWindow.array(),
|
|
23
|
+
"effectiveRates?": EffectiveRate.array().or("undefined"),
|
|
24
|
+
}).narrow(
|
|
25
|
+
cost =>
|
|
26
|
+
cost.effectiveRates === undefined ||
|
|
27
|
+
new Set(cost.effectiveRates.map(rate => rate.effectiveFrom)).size === cost.effectiveRates.length,
|
|
28
|
+
);
|
|
63
29
|
|
|
64
30
|
/** Validate serialized schedules before admitting cached model rows. */
|
|
65
31
|
export function isTimeBasedCost(value: unknown): value is TimeBasedCost {
|
|
66
|
-
|
|
67
|
-
!isRecord(value) ||
|
|
68
|
-
!nonnegative(value.offPeakMultiplier) ||
|
|
69
|
-
!Array.isArray(value.peakWindows) ||
|
|
70
|
-
!value.peakWindows.every(isPeakWindow)
|
|
71
|
-
) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
if (value.effectiveRates === undefined) return true;
|
|
75
|
-
if (!Array.isArray(value.effectiveRates) || !value.effectiveRates.every(isEffectiveRate)) return false;
|
|
76
|
-
const dates = new Set<number>();
|
|
77
|
-
for (const rate of value.effectiveRates) {
|
|
78
|
-
if (dates.has(rate.effectiveFrom)) return false;
|
|
79
|
-
dates.add(rate.effectiveFrom);
|
|
80
|
-
}
|
|
81
|
-
return true;
|
|
32
|
+
return TimeBasedCostShape.allows(value);
|
|
82
33
|
}
|
|
83
34
|
|
|
84
35
|
function payload(value: unknown, keys: readonly string[], field: string): Record<string, unknown> {
|
|
@@ -148,15 +99,15 @@ export function materializeTimeBasedCost(value: unknown): TimeBasedCost {
|
|
|
148
99
|
}
|
|
149
100
|
|
|
150
101
|
/**
|
|
151
|
-
* The
|
|
152
|
-
*
|
|
102
|
+
* The dated card due at `timestamp`: the one with the latest `effectiveFrom`
|
|
103
|
+
* at or before it, in any order, or undefined before the first card.
|
|
153
104
|
*/
|
|
154
|
-
export function
|
|
155
|
-
|
|
105
|
+
export function dueDatedCard<T extends { effectiveFrom: number }>(
|
|
106
|
+
cards: readonly T[],
|
|
156
107
|
timestamp: number,
|
|
157
|
-
):
|
|
158
|
-
let due:
|
|
159
|
-
for (const candidate of
|
|
108
|
+
): T | undefined {
|
|
109
|
+
let due: T | undefined;
|
|
110
|
+
for (const candidate of cards) {
|
|
160
111
|
if (candidate.effectiveFrom <= timestamp && (due === undefined || candidate.effectiveFrom > due.effectiveFrom)) {
|
|
161
112
|
due = candidate;
|
|
162
113
|
}
|
|
@@ -164,21 +115,38 @@ export function dueEffectiveRate(
|
|
|
164
115
|
return due;
|
|
165
116
|
}
|
|
166
117
|
|
|
118
|
+
/**
|
|
119
|
+
* The latest `effectiveRates` card of a materialized schedule due at
|
|
120
|
+
* `timestamp`, or undefined before the first one (or without a schedule).
|
|
121
|
+
*/
|
|
122
|
+
export function dueEffectiveRate(
|
|
123
|
+
schedule: TimeBasedCost | undefined,
|
|
124
|
+
timestamp: number,
|
|
125
|
+
): EffectiveTokenCost | undefined {
|
|
126
|
+
return dueDatedCard(schedule?.effectiveRates ?? [], timestamp);
|
|
127
|
+
}
|
|
128
|
+
|
|
167
129
|
const TOKEN_COST_LEGS = ["input", "output", "cacheRead", "cacheWrite"] as const;
|
|
168
130
|
const DATED_CARD_KEYS: readonly string[] = ["effectiveFrom", ...TOKEN_COST_LEGS];
|
|
169
131
|
|
|
170
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* A dated `effective-rates` card of a `cost-patch`, `cost-fallback` or
|
|
134
|
+
* `credit-rates` rule: the legs it overwrites from `effectiveFrom` (Unix ms).
|
|
135
|
+
*/
|
|
171
136
|
export interface DatedCostCard extends Partial<TokenCost> {
|
|
172
137
|
effectiveFrom: number;
|
|
173
138
|
}
|
|
174
139
|
|
|
175
140
|
/**
|
|
176
|
-
* Parse the compiled `effective-rates` block of a `cost-patch
|
|
177
|
-
* `cost-fallback` payload into dated cards,
|
|
178
|
-
* malformed card, so a typo in a rule fails the
|
|
179
|
-
* leaving the old price in force.
|
|
141
|
+
* Parse the compiled `effective-rates` block of a `cost-patch`,
|
|
142
|
+
* `cost-fallback` or Factory Droid `credit-rates` payload into dated cards,
|
|
143
|
+
* ascending by date. Throws on a malformed card, so a typo in a rule fails the
|
|
144
|
+
* build instead of silently leaving the old price in force.
|
|
180
145
|
*/
|
|
181
|
-
export function parseDatedCostCards(
|
|
146
|
+
export function parseDatedCostCards(
|
|
147
|
+
costAxis: unknown,
|
|
148
|
+
axis: "cost-patch" | "cost-fallback" | "credit-rates",
|
|
149
|
+
): DatedCostCard[] {
|
|
182
150
|
const effectiveRates = isRecord(costAxis) ? costAxis.effectiveRates : undefined;
|
|
183
151
|
if (effectiveRates === undefined) return [];
|
|
184
152
|
if (!isRecord(effectiveRates)) throw new Error(`Invalid ${axis} effective-rates: expected named objects`);
|
|
@@ -190,7 +158,7 @@ export function parseDatedCostCards(costAxis: unknown, axis: "cost-patch" | "cos
|
|
|
190
158
|
for (const leg of TOKEN_COST_LEGS) {
|
|
191
159
|
const value = entry[leg];
|
|
192
160
|
if (value === undefined) continue;
|
|
193
|
-
if (!
|
|
161
|
+
if (!Rate.allows(value))
|
|
194
162
|
throw new Error(`Invalid ${axis} effective-rate ${leg}: expected a nonnegative number`);
|
|
195
163
|
card[leg] = value;
|
|
196
164
|
}
|
|
@@ -235,10 +203,7 @@ export function datedCost(base: TokenCost, cards: readonly DatedCostCard[], now
|
|
|
235
203
|
* `cost` unchanged before the first card.
|
|
236
204
|
*/
|
|
237
205
|
export function applyDueDatedCostCard(cost: TokenCost, cards: readonly DatedCostCard[], now = Date.now()): void {
|
|
238
|
-
|
|
239
|
-
for (const card of cards) {
|
|
240
|
-
if (card.effectiveFrom <= now) due = card;
|
|
241
|
-
}
|
|
206
|
+
const due = dueDatedCard(cards, now);
|
|
242
207
|
if (due === undefined) return;
|
|
243
208
|
for (const leg of TOKEN_COST_LEGS) {
|
|
244
209
|
const value = due[leg];
|
|
Binary file
|
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
qwenPortalModelManagerOptions,
|
|
62
62
|
sakanaModelManagerOptions,
|
|
63
63
|
sambanovaModelManagerOptions,
|
|
64
|
+
scalewayModelManagerOptions,
|
|
64
65
|
siliconflowCnModelManagerOptions,
|
|
65
66
|
siliconflowModelManagerOptions,
|
|
66
67
|
singularityApiDevModelManagerOptions,
|
|
@@ -150,6 +151,7 @@ const MODEL_MANAGER_FACTORIES: Readonly<Partial<Record<KnownProvider, ModelManag
|
|
|
150
151
|
"qwen-portal": config => qwenPortalModelManagerOptions(config),
|
|
151
152
|
sakana: config => sakanaModelManagerOptions(config),
|
|
152
153
|
sambanova: config => sambanovaModelManagerOptions(config),
|
|
154
|
+
scaleway: config => scalewayModelManagerOptions(config),
|
|
153
155
|
siliconflow: config => siliconflowModelManagerOptions(config),
|
|
154
156
|
"siliconflow-cn": config => siliconflowCnModelManagerOptions(config),
|
|
155
157
|
"singularityapi-dev": config => singularityApiDevModelManagerOptions(config),
|
|
@@ -36,19 +36,6 @@ export interface ModelsDevModel {
|
|
|
36
36
|
int?: number;
|
|
37
37
|
tps?: number;
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Fetches the models.dev catalog via catalog.stencil.so, which serves a
|
|
41
|
-
* field-pruned copy precompressed as a zstd blob (~93 KB vs ~3.3 MB raw).
|
|
42
|
-
* The frame magic is sniffed rather than trusting content-type so plain-JSON
|
|
43
|
-
* responses (test stubs, fallback mirrors) parse identically.
|
|
44
|
-
*
|
|
45
|
-
* Fetched fully once per fetch context: concurrent callers sharing a fetch
|
|
46
|
-
* implementation reuse one transport request, while repeat callers send a
|
|
47
|
-
* conditional GET that the server answers with `304`. Each subscriber may stop
|
|
48
|
-
* waiting independently; the shared transport retains its own hard deadline.
|
|
49
|
-
* Transient failures reuse the last in-memory payload for callers that only
|
|
50
|
-
* need best-effort metadata.
|
|
51
|
-
*/
|
|
52
39
|
export declare function fetchWellKnownModels(fetchImpl?: FetchImpl, signal?: AbortSignal): Promise<unknown>;
|
|
53
40
|
type SimpleProviderDiscoveryHeaders = Record<string, string> | (() => Record<string, string> | undefined);
|
|
54
41
|
type SimpleProviderConfig = {
|
|
@@ -740,3 +727,21 @@ export declare function singularityApiDevModelManagerOptions(config?: Singularit
|
|
|
740
727
|
* reviewed KDL rules own the wire shape, limits patch, and effort ladder.
|
|
741
728
|
*/
|
|
742
729
|
export declare function singularityApiTechModelManagerOptions(config?: SingularityApiModelManagerConfig): ModelManagerOptions<Api>;
|
|
730
|
+
/**
|
|
731
|
+
* Scaleway discovery configuration: the API key plus optional base-URL and
|
|
732
|
+
* fetch overrides. Consumed by {@link scalewayModelManagerOptions}, and
|
|
733
|
+
* exported for extensions and tests that construct the manager directly.
|
|
734
|
+
*/
|
|
735
|
+
export interface ScalewayModelManagerConfig {
|
|
736
|
+
apiKey?: string;
|
|
737
|
+
baseUrl?: string;
|
|
738
|
+
fetch?: FetchImpl;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Scaleway model manager: plain OpenAI-compatible chat completions at
|
|
742
|
+
* `api.scaleway.ai/v1` (fr-par serverless Generative APIs). `/v1/models`
|
|
743
|
+
* returns bare ids, so the authored seed in `providers/scaleway.kdl` is the
|
|
744
|
+
* reference each live row merges names, modalities, prices, and limits from;
|
|
745
|
+
* a successful fetch is the complete roster and prunes retired rows.
|
|
746
|
+
*/
|
|
747
|
+
export declare function scalewayModelManagerOptions(config?: ScalewayModelManagerConfig): ModelManagerOptions<"openai-completions">;
|