@game-infra/ai-schemas 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +149 -0
- package/dist/catalog.d.ts +137 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +209 -0
- package/dist/catalog.js.map +1 -0
- package/dist/contracts.d.ts +1073 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +243 -0
- package/dist/contracts.js.map +1 -0
- package/dist/featuredModels.d.ts +95 -0
- package/dist/featuredModels.d.ts.map +1 -0
- package/dist/featuredModels.js +189 -0
- package/dist/featuredModels.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/inference.d.ts +323 -0
- package/dist/inference.d.ts.map +1 -0
- package/dist/inference.js +162 -0
- package/dist/inference.js.map +1 -0
- package/dist/preference.d.ts +49 -0
- package/dist/preference.d.ts.map +1 -0
- package/dist/preference.js +74 -0
- package/dist/preference.js.map +1 -0
- package/dist/preset.d.ts +422 -0
- package/dist/preset.d.ts.map +1 -0
- package/dist/preset.js +212 -0
- package/dist/preset.js.map +1 -0
- package/dist/provider.d.ts +487 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +224 -0
- package/dist/provider.js.map +1 -0
- package/dist/schemaRegistry.d.ts +71 -0
- package/dist/schemaRegistry.d.ts.map +1 -0
- package/dist/schemaRegistry.js +35 -0
- package/dist/schemaRegistry.js.map +1 -0
- package/dist/service.d.ts +143 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +103 -0
- package/dist/service.js.map +1 -0
- package/dist/subscription.d.ts +275 -0
- package/dist/subscription.d.ts.map +1 -0
- package/dist/subscription.js +198 -0
- package/dist/subscription.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DEFAULT_TIER_PREFERENCE, PROVIDER_TIERS } from "./provider.js";
|
|
2
|
+
/**
|
|
3
|
+
* The two folds that turn a stored preference into the order a request is
|
|
4
|
+
* actually tried in.
|
|
5
|
+
*
|
|
6
|
+
* They live in this package rather than in the service because the console
|
|
7
|
+
* renders the same fold: the preset editor shows the resulting order as the
|
|
8
|
+
* operator drags rows, and a second copy of the rule in Vue is a copy that
|
|
9
|
+
* eventually disagrees with the one the request takes. Getting an order the
|
|
10
|
+
* editor never showed is the worst way to learn a preference was misread.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* A preference REORDERS the tiers; it never filters them.
|
|
14
|
+
*
|
|
15
|
+
* The tiers named come first, in the order given; every other tier follows in
|
|
16
|
+
* the built-in order. That total is deliberate. A preference is a stored
|
|
17
|
+
* document, so one written before a tier existed would otherwise make that tier
|
|
18
|
+
* permanently unreachable for the preset that holds it, with nothing on screen
|
|
19
|
+
* saying so; and an operator dragging a tier off a list means "last", not
|
|
20
|
+
* "never" (a tier they actually want off is switched off at the provider,
|
|
21
|
+
* where the effect is visible).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { orderedTierPreference } from '@game-infra/ai-schemas'
|
|
26
|
+
*
|
|
27
|
+
* orderedTierPreference(['umbrella'])
|
|
28
|
+
* // ['umbrella', 'subscription', 'direct', 'local']
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function orderedTierPreference(preference) {
|
|
32
|
+
const seen = new Set();
|
|
33
|
+
const ordered = [];
|
|
34
|
+
for (const tier of preference ?? []) {
|
|
35
|
+
// A stored tier this build no longer knows is dropped here rather than
|
|
36
|
+
// carried into routing, where it would match no provider and read as a
|
|
37
|
+
// preference that silently does nothing.
|
|
38
|
+
if (!PROVIDER_TIERS.includes(tier) || seen.has(tier))
|
|
39
|
+
continue;
|
|
40
|
+
seen.add(tier);
|
|
41
|
+
ordered.push(tier);
|
|
42
|
+
}
|
|
43
|
+
for (const tier of DEFAULT_TIER_PREFERENCE) {
|
|
44
|
+
if (!seen.has(tier))
|
|
45
|
+
ordered.push(tier);
|
|
46
|
+
}
|
|
47
|
+
return ordered;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Rank providers inside one tier.
|
|
51
|
+
*
|
|
52
|
+
* Named providers come first in the order given. The rest follow sorted by
|
|
53
|
+
* their own id, which matters more than it looks: the alternative is database
|
|
54
|
+
* order, so two deployments configured with the same providers in a different
|
|
55
|
+
* sequence would route differently while both presets read identically.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { orderedProviderPreference } from '@game-infra/ai-schemas'
|
|
60
|
+
*
|
|
61
|
+
* orderedProviderPreference(['openrouter'], ['workers-ai', 'bifrost', 'openrouter'])
|
|
62
|
+
* // ['openrouter', 'bifrost', 'workers-ai']
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export function orderedProviderPreference(preference, available) {
|
|
66
|
+
const pool = new Set(available);
|
|
67
|
+
const ordered = [];
|
|
68
|
+
for (const providerId of preference ?? []) {
|
|
69
|
+
if (pool.delete(providerId))
|
|
70
|
+
ordered.push(providerId);
|
|
71
|
+
}
|
|
72
|
+
return [...ordered, ...[...pool].sort()];
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=preference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preference.js","sourceRoot":"","sources":["../src/preference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AAE3F;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAA+C;IAE/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAgB,CAAC;IACrC,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,UAAU,IAAI,EAAE,EAAE,CAAC;QACpC,uEAAuE;QACvE,uEAAuE;QACvE,yCAAyC;QACzC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAC/D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,uBAAuB,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAyC,EACzC,SAA4B;IAE5B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,UAAU,IAAI,UAAU,IAAI,EAAE,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/preset.d.ts
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { type InferOutput } from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* A preset is a stored answer to "which model, and if that one is not
|
|
4
|
+
* available, then what".
|
|
5
|
+
*
|
|
6
|
+
* Callers name a preset instead of a model, which is what lets a deployment
|
|
7
|
+
* change where its work runs without touching the caller. The preset holds two
|
|
8
|
+
* orderings and they answer different questions: the model list says which
|
|
9
|
+
* models are acceptable and in what order of preference, and the tier and
|
|
10
|
+
* provider preferences say how to reach whichever model is being tried. Keeping
|
|
11
|
+
* them apart is what makes "prefer the subscription, fall back to OpenRouter
|
|
12
|
+
* rather than to Cloudflare" expressible without writing out every combination.
|
|
13
|
+
*/
|
|
14
|
+
/** Lowercase, dash-separated key a request names a preset by. */
|
|
15
|
+
export declare const PresetSlugSchema: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>;
|
|
16
|
+
/**
|
|
17
|
+
* One model in a preset's order of preference.
|
|
18
|
+
*
|
|
19
|
+
* The entry's position in the list is its priority: the first entry whose model
|
|
20
|
+
* some enabled provider can serve wins. Everything else on the entry is a
|
|
21
|
+
* narrowing of how that model may be reached.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PresetModelEntrySchema: import("valibot").ObjectSchema<{
|
|
24
|
+
/** Canonical model id, matched against each provider's route table. */
|
|
25
|
+
readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 160, undefined>]>;
|
|
26
|
+
/**
|
|
27
|
+
* Reach this model only through this provider. A pin turns off fallback for
|
|
28
|
+
* the entry: if the named provider is disabled, uncredentialed or does not
|
|
29
|
+
* serve the model, the entry contributes nothing and routing moves to the
|
|
30
|
+
* next model rather than quietly using a different provider. That is the
|
|
31
|
+
* point of pinning, so it is stated rather than treated as a hint.
|
|
32
|
+
*/
|
|
33
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
34
|
+
/** Tier order for this model only. Absent means the preset's own order. */
|
|
35
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
36
|
+
/** Provider order for this model only. Absent means the preset's own order. */
|
|
37
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
38
|
+
/** Sampling temperature for this model. Absent means the preset default. */
|
|
39
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
40
|
+
/** Output-token cap for this model. Absent means the preset default. */
|
|
41
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
42
|
+
}, undefined>;
|
|
43
|
+
export type PresetModelEntry = InferOutput<typeof PresetModelEntrySchema>;
|
|
44
|
+
/**
|
|
45
|
+
* What a preset does when the only route left is a locked subscription.
|
|
46
|
+
*
|
|
47
|
+
* - `fall-back` — skip it and try the metered routes. The default, because a
|
|
48
|
+
* caller that could not supply a password still wants an answer.
|
|
49
|
+
* - `require` — serve this preset from a subscription or not at all. Every
|
|
50
|
+
* route that is not one is dropped from the plan with
|
|
51
|
+
* `subscription_required`, so a request carrying no password is refused with
|
|
52
|
+
* 428 and one whose subscription is disabled, absent or failing is refused
|
|
53
|
+
* rather than quietly billed. For work whose whole point is that it must not
|
|
54
|
+
* be billed per token, where falling back is the failure rather than the
|
|
55
|
+
* recovery.
|
|
56
|
+
*/
|
|
57
|
+
export declare const LOCKED_SUBSCRIPTION_POLICIES: readonly ["fall-back", "require"];
|
|
58
|
+
export declare const LockedSubscriptionPolicySchema: import("valibot").PicklistSchema<readonly ["fall-back", "require"], undefined>;
|
|
59
|
+
export type LockedSubscriptionPolicy = InferOutput<typeof LockedSubscriptionPolicySchema>;
|
|
60
|
+
/** A stored routing preset. */
|
|
61
|
+
export declare const PresetSchema: import("valibot").ObjectSchema<{
|
|
62
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
63
|
+
readonly slug: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>;
|
|
64
|
+
readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 120, undefined>]>;
|
|
65
|
+
readonly description: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
66
|
+
/** Models in order of preference. A preset with none can route nothing. */
|
|
67
|
+
readonly models: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
68
|
+
/** Canonical model id, matched against each provider's route table. */
|
|
69
|
+
readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 160, undefined>]>;
|
|
70
|
+
/**
|
|
71
|
+
* Reach this model only through this provider. A pin turns off fallback for
|
|
72
|
+
* the entry: if the named provider is disabled, uncredentialed or does not
|
|
73
|
+
* serve the model, the entry contributes nothing and routing moves to the
|
|
74
|
+
* next model rather than quietly using a different provider. That is the
|
|
75
|
+
* point of pinning, so it is stated rather than treated as a hint.
|
|
76
|
+
*/
|
|
77
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
78
|
+
/** Tier order for this model only. Absent means the preset's own order. */
|
|
79
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
80
|
+
/** Provider order for this model only. Absent means the preset's own order. */
|
|
81
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
82
|
+
/** Sampling temperature for this model. Absent means the preset default. */
|
|
83
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
84
|
+
/** Output-token cap for this model. Absent means the preset default. */
|
|
85
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
86
|
+
}, undefined>, undefined>;
|
|
87
|
+
/**
|
|
88
|
+
* Tier order. A preference REORDERS rather than filters: tiers left out are
|
|
89
|
+
* appended in the built-in order, so a preset written before a tier existed
|
|
90
|
+
* keeps working and gains the new tier as a last resort rather than being
|
|
91
|
+
* silently unable to reach it.
|
|
92
|
+
*/
|
|
93
|
+
readonly tierPreference: import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* Provider order inside a tier, which is where "OpenRouter before Cloudflare"
|
|
96
|
+
* is expressed. Providers not named come after the named ones, ordered by
|
|
97
|
+
* their own id so the result is stable rather than dependent on insertion
|
|
98
|
+
* order in the database.
|
|
99
|
+
*/
|
|
100
|
+
readonly providerPreference: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
101
|
+
readonly lockedSubscriptionPolicy: import("valibot").PicklistSchema<readonly ["fall-back", "require"], undefined>;
|
|
102
|
+
/** Sampling temperature applied to any entry that does not set its own. */
|
|
103
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
104
|
+
/** Output-token cap applied to any entry that does not set its own. */
|
|
105
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
106
|
+
/**
|
|
107
|
+
* How many routes a single request may try before giving up. Bounds the tail
|
|
108
|
+
* latency of a request whose preset lists many models across many gateways:
|
|
109
|
+
* without it, one request against a broadly-configured deployment can spend
|
|
110
|
+
* a minute failing through routes nobody is waiting for any more.
|
|
111
|
+
*/
|
|
112
|
+
readonly maxAttempts: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 10, undefined>]>;
|
|
113
|
+
/** Whether callers may name this preset. */
|
|
114
|
+
readonly enabled: import("valibot").BooleanSchema<undefined>;
|
|
115
|
+
readonly createdAt: import("valibot").StringSchema<undefined>;
|
|
116
|
+
readonly updatedAt: import("valibot").StringSchema<undefined>;
|
|
117
|
+
}, undefined>;
|
|
118
|
+
export type Preset = InferOutput<typeof PresetSchema>;
|
|
119
|
+
/** Fields accepted when creating a preset. */
|
|
120
|
+
export declare const CreatePresetRequestSchema: import("valibot").ObjectSchema<{
|
|
121
|
+
readonly slug: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>;
|
|
122
|
+
readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 120, undefined>]>;
|
|
123
|
+
readonly description: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
124
|
+
readonly models: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
125
|
+
/** Canonical model id, matched against each provider's route table. */
|
|
126
|
+
readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 160, undefined>]>;
|
|
127
|
+
/**
|
|
128
|
+
* Reach this model only through this provider. A pin turns off fallback for
|
|
129
|
+
* the entry: if the named provider is disabled, uncredentialed or does not
|
|
130
|
+
* serve the model, the entry contributes nothing and routing moves to the
|
|
131
|
+
* next model rather than quietly using a different provider. That is the
|
|
132
|
+
* point of pinning, so it is stated rather than treated as a hint.
|
|
133
|
+
*/
|
|
134
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
135
|
+
/** Tier order for this model only. Absent means the preset's own order. */
|
|
136
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
137
|
+
/** Provider order for this model only. Absent means the preset's own order. */
|
|
138
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
139
|
+
/** Sampling temperature for this model. Absent means the preset default. */
|
|
140
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
141
|
+
/** Output-token cap for this model. Absent means the preset default. */
|
|
142
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
143
|
+
}, undefined>, undefined>;
|
|
144
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
145
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
146
|
+
readonly lockedSubscriptionPolicy: import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["fall-back", "require"], undefined>, undefined>;
|
|
147
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
148
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
149
|
+
readonly maxAttempts: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 10, undefined>]>, undefined>;
|
|
150
|
+
readonly enabled: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
151
|
+
}, undefined>;
|
|
152
|
+
export type CreatePresetRequest = InferOutput<typeof CreatePresetRequestSchema>;
|
|
153
|
+
/** Fields accepted when updating a preset. Absent means unchanged. */
|
|
154
|
+
export declare const UpdatePresetRequestSchema: import("valibot").ObjectSchema<{
|
|
155
|
+
readonly name: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 120, undefined>]>, undefined>;
|
|
156
|
+
readonly description: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
157
|
+
readonly models: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
158
|
+
/** Canonical model id, matched against each provider's route table. */
|
|
159
|
+
readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 160, undefined>]>;
|
|
160
|
+
/**
|
|
161
|
+
* Reach this model only through this provider. A pin turns off fallback for
|
|
162
|
+
* the entry: if the named provider is disabled, uncredentialed or does not
|
|
163
|
+
* serve the model, the entry contributes nothing and routing moves to the
|
|
164
|
+
* next model rather than quietly using a different provider. That is the
|
|
165
|
+
* point of pinning, so it is stated rather than treated as a hint.
|
|
166
|
+
*/
|
|
167
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
168
|
+
/** Tier order for this model only. Absent means the preset's own order. */
|
|
169
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
170
|
+
/** Provider order for this model only. Absent means the preset's own order. */
|
|
171
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
172
|
+
/** Sampling temperature for this model. Absent means the preset default. */
|
|
173
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
174
|
+
/** Output-token cap for this model. Absent means the preset default. */
|
|
175
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
176
|
+
}, undefined>, undefined>, undefined>;
|
|
177
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
178
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
179
|
+
readonly lockedSubscriptionPolicy: import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["fall-back", "require"], undefined>, undefined>;
|
|
180
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
181
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
182
|
+
readonly maxAttempts: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 10, undefined>]>, undefined>;
|
|
183
|
+
readonly enabled: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
184
|
+
}, undefined>;
|
|
185
|
+
export type UpdatePresetRequest = InferOutput<typeof UpdatePresetRequestSchema>;
|
|
186
|
+
/**
|
|
187
|
+
* One route a request could take, as the planner ordered them.
|
|
188
|
+
*
|
|
189
|
+
* This is the same list the executor walks, exposed so a preset can be checked
|
|
190
|
+
* before anything is spent on it. A preset that reads correctly and routes to
|
|
191
|
+
* nothing is the failure mode worth catching here rather than in production,
|
|
192
|
+
* and it is invisible from the stored preset alone: it depends on which
|
|
193
|
+
* providers are enabled and what they were told they serve.
|
|
194
|
+
*/
|
|
195
|
+
export declare const RouteCandidateSchema: import("valibot").ObjectSchema<{
|
|
196
|
+
/** Position in the plan, zero-based. */
|
|
197
|
+
readonly order: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
198
|
+
/** Canonical model this route serves. */
|
|
199
|
+
readonly model: import("valibot").StringSchema<undefined>;
|
|
200
|
+
/** The id the provider serves it under. */
|
|
201
|
+
readonly providerModelId: import("valibot").StringSchema<undefined>;
|
|
202
|
+
readonly providerId: import("valibot").StringSchema<undefined>;
|
|
203
|
+
readonly providerName: import("valibot").StringSchema<undefined>;
|
|
204
|
+
readonly tier: import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>;
|
|
205
|
+
/**
|
|
206
|
+
* For a subscription route, whether the request as it stands could unlock it.
|
|
207
|
+
* A plan built without a password reports `false` here, which is what tells
|
|
208
|
+
* an operator that their subscription-first preset is quietly running on API
|
|
209
|
+
* keys.
|
|
210
|
+
*/
|
|
211
|
+
readonly unlockable: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
212
|
+
}, undefined>;
|
|
213
|
+
export type RouteCandidate = InferOutput<typeof RouteCandidateSchema>;
|
|
214
|
+
/**
|
|
215
|
+
* Why a configured route was left out of the plan.
|
|
216
|
+
*
|
|
217
|
+
* A dry run that answered only with the routes it kept would be no help with
|
|
218
|
+
* the question people actually ask it, which is why the subscription they
|
|
219
|
+
* configured is not being used. Each reason names one fixable thing.
|
|
220
|
+
*/
|
|
221
|
+
export declare const ROUTE_EXCLUSION_REASONS: readonly [
|
|
222
|
+
/** No enabled provider maps this canonical model at all. */
|
|
223
|
+
"model_not_served",
|
|
224
|
+
/** The provider exists but is switched off. */
|
|
225
|
+
"provider_disabled",
|
|
226
|
+
/** The provider needs a key and none is stored. */
|
|
227
|
+
"credential_missing",
|
|
228
|
+
/** A subscription route with no password on the request to open it. */
|
|
229
|
+
"subscription_locked",
|
|
230
|
+
/** A subscription owned by somebody other than the caller. */
|
|
231
|
+
"subscription_not_owned",
|
|
232
|
+
/**
|
|
233
|
+
* The route is not a subscription and the preset's `lockedSubscriptionPolicy`
|
|
234
|
+
* is `require`, so only subscription routes are eligible.
|
|
235
|
+
*/
|
|
236
|
+
"subscription_required",
|
|
237
|
+
/** The entry pins a provider that does not exist or does not serve the model. */
|
|
238
|
+
"pinned_provider_unavailable",
|
|
239
|
+
/** The request carries images and this route is declared text-only. */
|
|
240
|
+
"model_no_image_input",
|
|
241
|
+
/** The request carries images and nobody has declared whether this route reads them. */
|
|
242
|
+
"unknown_model_image_input",
|
|
243
|
+
/** `/generate/object` against a route declared to have no structured-output path. */
|
|
244
|
+
"structured_output_unsupported",
|
|
245
|
+
/** The route was valid but fell outside the preset's attempt budget. */
|
|
246
|
+
"attempt_budget_exhausted"];
|
|
247
|
+
export declare const RouteExclusionReasonSchema: import("valibot").PicklistSchema<readonly ["model_not_served", "provider_disabled", "credential_missing", "subscription_locked", "subscription_not_owned", "subscription_required", "pinned_provider_unavailable", "model_no_image_input", "unknown_model_image_input", "structured_output_unsupported", "attempt_budget_exhausted"], undefined>;
|
|
248
|
+
export type RouteExclusionReason = InferOutput<typeof RouteExclusionReasonSchema>;
|
|
249
|
+
/** A route that was considered and dropped, with the reason it was dropped. */
|
|
250
|
+
export declare const RouteExclusionSchema: import("valibot").ObjectSchema<{
|
|
251
|
+
readonly model: import("valibot").StringSchema<undefined>;
|
|
252
|
+
readonly providerId: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
253
|
+
readonly tier: import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>;
|
|
254
|
+
readonly reason: import("valibot").PicklistSchema<readonly ["model_not_served", "provider_disabled", "credential_missing", "subscription_locked", "subscription_not_owned", "subscription_required", "pinned_provider_unavailable", "model_no_image_input", "unknown_model_image_input", "structured_output_unsupported", "attempt_budget_exhausted"], undefined>;
|
|
255
|
+
/** Operator-facing wording for {@link reason}, naming this specific route. */
|
|
256
|
+
readonly detail: import("valibot").StringSchema<undefined>;
|
|
257
|
+
}, undefined>;
|
|
258
|
+
export type RouteExclusion = InferOutput<typeof RouteExclusionSchema>;
|
|
259
|
+
/** The plan a preset produces against the current configuration. */
|
|
260
|
+
export declare const RoutePlanResponseSchema: import("valibot").ObjectSchema<{
|
|
261
|
+
readonly success: import("valibot").BooleanSchema<undefined>;
|
|
262
|
+
readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
263
|
+
} & {
|
|
264
|
+
preset: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
265
|
+
candidates: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
266
|
+
/** Position in the plan, zero-based. */
|
|
267
|
+
readonly order: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
268
|
+
/** Canonical model this route serves. */
|
|
269
|
+
readonly model: import("valibot").StringSchema<undefined>;
|
|
270
|
+
/** The id the provider serves it under. */
|
|
271
|
+
readonly providerModelId: import("valibot").StringSchema<undefined>;
|
|
272
|
+
readonly providerId: import("valibot").StringSchema<undefined>;
|
|
273
|
+
readonly providerName: import("valibot").StringSchema<undefined>;
|
|
274
|
+
readonly tier: import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>;
|
|
275
|
+
/**
|
|
276
|
+
* For a subscription route, whether the request as it stands could unlock it.
|
|
277
|
+
* A plan built without a password reports `false` here, which is what tells
|
|
278
|
+
* an operator that their subscription-first preset is quietly running on API
|
|
279
|
+
* keys.
|
|
280
|
+
*/
|
|
281
|
+
readonly unlockable: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
282
|
+
}, undefined>, undefined>, undefined>;
|
|
283
|
+
/** Routes considered and dropped. Empty is a real answer, not a missing one. */
|
|
284
|
+
excluded: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
285
|
+
readonly model: import("valibot").StringSchema<undefined>;
|
|
286
|
+
readonly providerId: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
287
|
+
readonly tier: import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>;
|
|
288
|
+
readonly reason: import("valibot").PicklistSchema<readonly ["model_not_served", "provider_disabled", "credential_missing", "subscription_locked", "subscription_not_owned", "subscription_required", "pinned_provider_unavailable", "model_no_image_input", "unknown_model_image_input", "structured_output_unsupported", "attempt_budget_exhausted"], undefined>;
|
|
289
|
+
/** Operator-facing wording for {@link reason}, naming this specific route. */
|
|
290
|
+
readonly detail: import("valibot").StringSchema<undefined>;
|
|
291
|
+
}, undefined>, undefined>, undefined>;
|
|
292
|
+
}, undefined>;
|
|
293
|
+
export type RoutePlanResponse = InferOutput<typeof RoutePlanResponseSchema>;
|
|
294
|
+
/** One preset. */
|
|
295
|
+
export declare const PresetResponseSchema: import("valibot").ObjectSchema<{
|
|
296
|
+
readonly success: import("valibot").BooleanSchema<undefined>;
|
|
297
|
+
readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
298
|
+
} & {
|
|
299
|
+
preset: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
|
|
300
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
301
|
+
readonly slug: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>;
|
|
302
|
+
readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 120, undefined>]>;
|
|
303
|
+
readonly description: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
304
|
+
/** Models in order of preference. A preset with none can route nothing. */
|
|
305
|
+
readonly models: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
306
|
+
/** Canonical model id, matched against each provider's route table. */
|
|
307
|
+
readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 160, undefined>]>;
|
|
308
|
+
/**
|
|
309
|
+
* Reach this model only through this provider. A pin turns off fallback for
|
|
310
|
+
* the entry: if the named provider is disabled, uncredentialed or does not
|
|
311
|
+
* serve the model, the entry contributes nothing and routing moves to the
|
|
312
|
+
* next model rather than quietly using a different provider. That is the
|
|
313
|
+
* point of pinning, so it is stated rather than treated as a hint.
|
|
314
|
+
*/
|
|
315
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
316
|
+
/** Tier order for this model only. Absent means the preset's own order. */
|
|
317
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
318
|
+
/** Provider order for this model only. Absent means the preset's own order. */
|
|
319
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
320
|
+
/** Sampling temperature for this model. Absent means the preset default. */
|
|
321
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
322
|
+
/** Output-token cap for this model. Absent means the preset default. */
|
|
323
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
324
|
+
}, undefined>, undefined>;
|
|
325
|
+
/**
|
|
326
|
+
* Tier order. A preference REORDERS rather than filters: tiers left out are
|
|
327
|
+
* appended in the built-in order, so a preset written before a tier existed
|
|
328
|
+
* keeps working and gains the new tier as a last resort rather than being
|
|
329
|
+
* silently unable to reach it.
|
|
330
|
+
*/
|
|
331
|
+
readonly tierPreference: import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>;
|
|
332
|
+
/**
|
|
333
|
+
* Provider order inside a tier, which is where "OpenRouter before Cloudflare"
|
|
334
|
+
* is expressed. Providers not named come after the named ones, ordered by
|
|
335
|
+
* their own id so the result is stable rather than dependent on insertion
|
|
336
|
+
* order in the database.
|
|
337
|
+
*/
|
|
338
|
+
readonly providerPreference: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
339
|
+
readonly lockedSubscriptionPolicy: import("valibot").PicklistSchema<readonly ["fall-back", "require"], undefined>;
|
|
340
|
+
/** Sampling temperature applied to any entry that does not set its own. */
|
|
341
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
342
|
+
/** Output-token cap applied to any entry that does not set its own. */
|
|
343
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
344
|
+
/**
|
|
345
|
+
* How many routes a single request may try before giving up. Bounds the tail
|
|
346
|
+
* latency of a request whose preset lists many models across many gateways:
|
|
347
|
+
* without it, one request against a broadly-configured deployment can spend
|
|
348
|
+
* a minute failing through routes nobody is waiting for any more.
|
|
349
|
+
*/
|
|
350
|
+
readonly maxAttempts: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 10, undefined>]>;
|
|
351
|
+
/** Whether callers may name this preset. */
|
|
352
|
+
readonly enabled: import("valibot").BooleanSchema<undefined>;
|
|
353
|
+
readonly createdAt: import("valibot").StringSchema<undefined>;
|
|
354
|
+
readonly updatedAt: import("valibot").StringSchema<undefined>;
|
|
355
|
+
}, undefined>, undefined>;
|
|
356
|
+
}, undefined>;
|
|
357
|
+
export type PresetResponse = InferOutput<typeof PresetResponseSchema>;
|
|
358
|
+
/** Every stored preset. */
|
|
359
|
+
export declare const PresetListResponseSchema: import("valibot").ObjectSchema<{
|
|
360
|
+
readonly success: import("valibot").BooleanSchema<undefined>;
|
|
361
|
+
readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
362
|
+
} & {
|
|
363
|
+
presets: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
364
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
365
|
+
readonly slug: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>;
|
|
366
|
+
readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 120, undefined>]>;
|
|
367
|
+
readonly description: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MaxLengthAction<string, 600, undefined>]>, undefined>;
|
|
368
|
+
/** Models in order of preference. A preset with none can route nothing. */
|
|
369
|
+
readonly models: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
370
|
+
/** Canonical model id, matched against each provider's route table. */
|
|
371
|
+
readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 160, undefined>]>;
|
|
372
|
+
/**
|
|
373
|
+
* Reach this model only through this provider. A pin turns off fallback for
|
|
374
|
+
* the entry: if the named provider is disabled, uncredentialed or does not
|
|
375
|
+
* serve the model, the entry contributes nothing and routing moves to the
|
|
376
|
+
* next model rather than quietly using a different provider. That is the
|
|
377
|
+
* point of pinning, so it is stated rather than treated as a hint.
|
|
378
|
+
*/
|
|
379
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
380
|
+
/** Tier order for this model only. Absent means the preset's own order. */
|
|
381
|
+
readonly tierPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>, undefined>;
|
|
382
|
+
/** Provider order for this model only. Absent means the preset's own order. */
|
|
383
|
+
readonly providerPreference: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>, undefined>;
|
|
384
|
+
/** Sampling temperature for this model. Absent means the preset default. */
|
|
385
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
386
|
+
/** Output-token cap for this model. Absent means the preset default. */
|
|
387
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
388
|
+
}, undefined>, undefined>;
|
|
389
|
+
/**
|
|
390
|
+
* Tier order. A preference REORDERS rather than filters: tiers left out are
|
|
391
|
+
* appended in the built-in order, so a preset written before a tier existed
|
|
392
|
+
* keeps working and gains the new tier as a last resort rather than being
|
|
393
|
+
* silently unable to reach it.
|
|
394
|
+
*/
|
|
395
|
+
readonly tierPreference: import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["subscription", "direct", "local", "umbrella"], undefined>, undefined>;
|
|
396
|
+
/**
|
|
397
|
+
* Provider order inside a tier, which is where "OpenRouter before Cloudflare"
|
|
398
|
+
* is expressed. Providers not named come after the named ones, ordered by
|
|
399
|
+
* their own id so the result is stable rather than dependent on insertion
|
|
400
|
+
* order in the database.
|
|
401
|
+
*/
|
|
402
|
+
readonly providerPreference: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "must be lowercase words separated by single dashes">]>, undefined>;
|
|
403
|
+
readonly lockedSubscriptionPolicy: import("valibot").PicklistSchema<readonly ["fall-back", "require"], undefined>;
|
|
404
|
+
/** Sampling temperature applied to any entry that does not set its own. */
|
|
405
|
+
readonly temperature: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 2, undefined>]>, undefined>;
|
|
406
|
+
/** Output-token cap applied to any entry that does not set its own. */
|
|
407
|
+
readonly maxOutputTokens: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 200000, undefined>]>, undefined>;
|
|
408
|
+
/**
|
|
409
|
+
* How many routes a single request may try before giving up. Bounds the tail
|
|
410
|
+
* latency of a request whose preset lists many models across many gateways:
|
|
411
|
+
* without it, one request against a broadly-configured deployment can spend
|
|
412
|
+
* a minute failing through routes nobody is waiting for any more.
|
|
413
|
+
*/
|
|
414
|
+
readonly maxAttempts: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 10, undefined>]>;
|
|
415
|
+
/** Whether callers may name this preset. */
|
|
416
|
+
readonly enabled: import("valibot").BooleanSchema<undefined>;
|
|
417
|
+
readonly createdAt: import("valibot").StringSchema<undefined>;
|
|
418
|
+
readonly updatedAt: import("valibot").StringSchema<undefined>;
|
|
419
|
+
}, undefined>, undefined>, undefined>;
|
|
420
|
+
}, undefined>;
|
|
421
|
+
export type PresetListResponse = InferOutput<typeof PresetListResponseSchema>;
|
|
422
|
+
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"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"}
|