@oxy.so/contracts 4.11.0 → 4.12.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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/index.js +9 -7
- package/dist/cjs/inference/identifiers.js +14 -1
- package/dist/cjs/inference/routingPolicy.js +17 -0
- package/dist/cjs/inference/usage.js +8 -0
- package/dist/cjs/inference/version.js +1 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/inference/identifiers.js +13 -0
- package/dist/esm/inference/routingPolicy.js +18 -1
- package/dist/esm/inference/usage.js +9 -1
- package/dist/esm/inference/version.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/accountSubject.d.ts +4 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/inference/accountBilling.d.ts +2 -2
- package/dist/types/inference/decisions.d.ts +20 -0
- package/dist/types/inference/identifiers.d.ts +14 -0
- package/dist/types/inference/realtime.d.ts +18 -0
- package/dist/types/inference/request.d.ts +54 -0
- package/dist/types/inference/routingPolicy.d.ts +10 -0
- package/dist/types/inference/usage.d.ts +12 -0
- package/dist/types/inference/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -119,7 +119,9 @@ oxyAccountIdSchema, delegatedUserIdSchema, oxyApplicationIdSchema, oxyCredential
|
|
|
119
119
|
// Wire primitives
|
|
120
120
|
inferenceTimestampSchema, inferenceDateSchema, inferenceHttpsUrlSchema, sha256DigestSchema,
|
|
121
121
|
// Catalogue references
|
|
122
|
-
publisherSlugSchema, modelSlugSchema, modelIdSchema, modelRevisionLabelSchema, modelReferenceSchema, routingProfileIdSchema, routingProfileSlugSchema, inferenceProviderSlugSchema, deploymentIdSchema, inferenceRegionSchema,
|
|
122
|
+
publisherSlugSchema, modelSlugSchema, modelIdSchema, modelRevisionLabelSchema, modelReferenceSchema, routingProfileIdSchema, routingProfileSlugSchema, inferenceProviderSlugSchema, deploymentIdSchema, inferenceRegionSchema,
|
|
123
|
+
// The economic tier Oxy bounds a route by and Kaana reports (ADR 0038)
|
|
124
|
+
inferenceFundingTierSchema, RESERVED_ALIA_PUBLISHER, } from './inference/identifiers.js';
|
|
123
125
|
export {
|
|
124
126
|
// Exact money and metered units — never floats, units never money.
|
|
125
127
|
currencyCodeSchema, INFERENCE_MONEY_SCALE, exactDecimalSchema, moneySchema, USAGE_UNITS, usageUnitSchema, USAGE_SOURCES, usageSourceSchema, usageQuantitySchema, unitPriceSchema, } from './inference/money.js';
|
|
@@ -221,3 +221,16 @@ export const inferenceRegionSchema = z
|
|
|
221
221
|
* this constant exists to be checked against.
|
|
222
222
|
*/
|
|
223
223
|
export const RESERVED_ALIA_PUBLISHER = 'alia';
|
|
224
|
+
/**
|
|
225
|
+
* The economic tier of the provider capacity that funds a request, in the
|
|
226
|
+
* order Kaana spends it: `free` (costs nothing), `credit` (a promotional or
|
|
227
|
+
* trial grant, or a prepaid balance), `paid` (ordinary metered spend).
|
|
228
|
+
*
|
|
229
|
+
* Kaana owns provider keys, their economics and which key serves (Oxy ADR
|
|
230
|
+
* 0038, Kaana ADR 0001); Oxy owns what a customer may spend. The tier is the
|
|
231
|
+
* one economic fact the two exchange: Oxy BOUNDS a route by it
|
|
232
|
+
* (`maxFundingTier`), and Kaana REPORTS the tier that served
|
|
233
|
+
* (`normalizedUsageReportSchema.fundingTier`). No key id, label or price
|
|
234
|
+
* travels with it.
|
|
235
|
+
*/
|
|
236
|
+
export const inferenceFundingTierSchema = z.enum(['free', 'credit', 'paid']);
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* docs/adr/0017-authorized-routes-in-the-envelope.md, issue #972 workstream 6.
|
|
33
33
|
*/
|
|
34
34
|
import { z } from "zod";
|
|
35
|
-
import { deploymentIdSchema, inferenceProviderSlugSchema, inferenceRegionSchema, inferenceTimestampSchema, modelReferenceSchema, oxyAccountIdSchema, oxyApplicationIdSchema, routingProfileIdSchema, } from "./identifiers.js";
|
|
35
|
+
import { deploymentIdSchema, inferenceProviderSlugSchema, inferenceFundingTierSchema, inferenceRegionSchema, inferenceTimestampSchema, modelReferenceSchema, oxyAccountIdSchema, oxyApplicationIdSchema, routingProfileIdSchema, } from "./identifiers.js";
|
|
36
36
|
import { kaanaCredentialHandleSchema } from "./providerConnection.js";
|
|
37
37
|
import { exactDecimalSchema, currencyCodeSchema, unitPriceSchema, } from "./money.js";
|
|
38
38
|
/**
|
|
@@ -291,6 +291,16 @@ const authorizedRouteFields = {
|
|
|
291
291
|
modelReference: modelReferenceSchema,
|
|
292
292
|
provider: inferenceProviderSlugSchema,
|
|
293
293
|
regions: z.array(inferenceRegionSchema),
|
|
294
|
+
/**
|
|
295
|
+
* The dearest funding tier the data plane may spend on this route. Absent
|
|
296
|
+
* means no ceiling. Present, the data plane walks only provider keys whose
|
|
297
|
+
* STATED tier is at or below it — a key whose economics nobody stated is
|
|
298
|
+
* never admitted — and refuses the route rather than fall through to a
|
|
299
|
+
* dearer key. It is how Oxy authorizes a route only while credit funds it
|
|
300
|
+
* (Alia Pro and Ultra spend credits only, ADR 0038). Meaningless with a
|
|
301
|
+
* customer credential, which the provider bills to the customer.
|
|
302
|
+
*/
|
|
303
|
+
maxFundingTier: inferenceFundingTierSchema.optional(),
|
|
294
304
|
/**
|
|
295
305
|
* Exact customer credential binding. Absence means a platform credential;
|
|
296
306
|
* presence names the immutable Kaana generation this route may use.
|
|
@@ -345,6 +355,13 @@ export const authorizedRouteSchema = z
|
|
|
345
355
|
.strict(),
|
|
346
356
|
])
|
|
347
357
|
.superRefine((route, ctx) => {
|
|
358
|
+
if (route.maxFundingTier !== undefined && route.customerProviderCredential !== undefined) {
|
|
359
|
+
ctx.addIssue({
|
|
360
|
+
code: z.ZodIssueCode.custom,
|
|
361
|
+
path: ['maxFundingTier'],
|
|
362
|
+
message: 'a funding ceiling bounds platform keys; a customer credential is billed to the customer',
|
|
363
|
+
});
|
|
364
|
+
}
|
|
348
365
|
// Same rule as `modelDeploymentSchema`: a route serves specific weights. An
|
|
349
366
|
// unpinned entry would leave the data plane choosing a revision, which is
|
|
350
367
|
// the one substitution the customer never authorized by naming a model.
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
*/
|
|
31
31
|
import { z } from 'zod';
|
|
32
32
|
import { inferenceAttributionSchema } from './attribution.js';
|
|
33
|
-
import { deploymentIdSchema, generationIdSchema, idempotencyKeySchema, inferenceProviderSlugSchema, inferenceTimestampSchema, modelReferenceSchema, requestIdSchema, } from './identifiers.js';
|
|
33
|
+
import { deploymentIdSchema, generationIdSchema, idempotencyKeySchema, inferenceFundingTierSchema, inferenceProviderSlugSchema, inferenceTimestampSchema, modelReferenceSchema, requestIdSchema, } from './identifiers.js';
|
|
34
34
|
import { currencyCodeSchema, exactDecimalSchema, usageQuantitySchema, usageSourceSchema, } from './money.js';
|
|
35
35
|
import { priceSnapshotSchema } from './priceVersion.js';
|
|
36
36
|
/* -------------------------------------------------------------------------- */
|
|
@@ -170,6 +170,14 @@ export const normalizedUsageReportSchema = z
|
|
|
170
170
|
deploymentId: deploymentIdSchema,
|
|
171
171
|
/** How many allowed route switches occurred while serving this request. */
|
|
172
172
|
routeSwitches: z.number().int().nonnegative().max(100),
|
|
173
|
+
/**
|
|
174
|
+
* The funding tier of the platform key that served the final attempt, as
|
|
175
|
+
* the data plane states it (ADR 0038). Absent when the key's economics
|
|
176
|
+
* were never stated, when a customer credential served, or when nothing
|
|
177
|
+
* was served. Oxy reads it to account for what the request cost the
|
|
178
|
+
* platform; it is never a key identity and never reaches a customer.
|
|
179
|
+
*/
|
|
180
|
+
fundingTier: inferenceFundingTierSchema.optional(),
|
|
173
181
|
startedAt: inferenceTimestampSchema,
|
|
174
182
|
completedAt: inferenceTimestampSchema,
|
|
175
183
|
timeToFirstTokenMs: z.number().int().nonnegative().safe().optional(),
|
|
@@ -99,4 +99,4 @@
|
|
|
99
99
|
* change to, say, the catalogue reject every in-flight inference request; the
|
|
100
100
|
* per-shape `schemaVersion` is what a message is validated against.
|
|
101
101
|
*/
|
|
102
|
-
export const INFERENCE_CONTRACT_VERSION = '3.
|
|
102
|
+
export const INFERENCE_CONTRACT_VERSION = '3.8.0';
|