@fourier-labs/harbour-contracts 0.11.0 → 0.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/README.md +1 -1
- package/contract-release.json +23 -23
- package/dist/gen-ts/ai-budget-ledger-event.d.ts +4 -0
- package/dist/gen-ts/ai-metering-policy.d.ts +14 -0
- package/dist/gen-ts/ai-policy-snapshot.d.ts +21 -2
- package/dist/gen-ts/ai-pricing-revision.d.ts +1 -1
- package/dist/gen-ts/ai-trace-event-v2.d.ts +6 -1
- package/dist/gen-ts/contract-release.d.ts +7 -7
- package/dist/gen-ts/contract-release.js +7 -7
- package/fixtures/ai/valid-budget-ledger-event.json +4 -0
- package/fixtures/ai/valid-metering-policy.json +5 -0
- package/fixtures/ai/valid-policy-snapshot.json +14 -3
- package/fixtures/ai/valid-pricing-revision.json +5 -2
- package/fixtures/ai/valid-trace-event-v2.json +44 -3
- package/gen-ts/ai-budget-ledger-event.ts +4 -0
- package/gen-ts/ai-metering-policy.ts +14 -0
- package/gen-ts/ai-policy-snapshot.ts +21 -2
- package/gen-ts/ai-pricing-revision.ts +1 -1
- package/gen-ts/ai-trace-event-v2.ts +6 -1
- package/gen-ts/contract-release.ts +7 -7
- package/package.json +1 -1
- package/schema/ai-budget-ledger-event.schema.json +4 -0
- package/schema/ai-metering-policy.schema.json +17 -1
- package/schema/ai-policy-snapshot.schema.json +31 -4
- package/schema/ai-pricing-revision.schema.json +1 -1
- package/schema/ai-trace-event-v2.schema.json +6 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ exist here first.
|
|
|
35
35
|
| `ai-runtime-binding.schema.json` | Platform-neutral workload identity/secret binding | AI governance §5.8 |
|
|
36
36
|
| `binding-classification-subject.schema.json` | Complete value-free binding-name classification before version allocation | AI governance §5.7 / SEC-UP-01 |
|
|
37
37
|
| `sanitized-binding-evidence.schema.json` | Exact-version sanitized runtime-binding allocation receipt | AI governance §5.7 / SEC-UP-02 |
|
|
38
|
-
| `ai-pricing-revision`, `ai-metering-policy`, `ai-budget-ledger-event`, `ai-trace-event-v2` | Additive metering v2 records; v1 records remain readable | AI governance §9 |
|
|
38
|
+
| `ai-pricing-revision`, `ai-metering-policy`, `ai-budget-ledger-event`, `ai-trace-event-v2` | Additive metering v2 records, including media dimensions and P5 trace attribution; v1 records remain readable | AI governance §9 |
|
|
39
39
|
|
|
40
40
|
Two schemas carry logic beyond structural types, generated into helpers:
|
|
41
41
|
|
package/contract-release.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "harbour.contract-release/1.0",
|
|
3
|
-
"repositoryVersion": "0.
|
|
4
|
-
"publishVersion": "0.
|
|
5
|
-
"publishTag": "v0.
|
|
6
|
-
"schemasDigest": "sha256:
|
|
7
|
-
"aiFixturesDigest": "sha256:
|
|
8
|
-
"generatedGoDigest": "sha256:
|
|
9
|
-
"generatedTypeScriptDigest": "sha256:
|
|
3
|
+
"repositoryVersion": "0.12.0.0",
|
|
4
|
+
"publishVersion": "0.12.0",
|
|
5
|
+
"publishTag": "v0.12.0",
|
|
6
|
+
"schemasDigest": "sha256:0e90bbd74c5b1df2e0123ec75d8bec1296e9647b95c4aa88a9e9bb2452872bf4",
|
|
7
|
+
"aiFixturesDigest": "sha256:8c406c269e909c028e35eca1321c18de95457ddd6731db8f3fb4cd90726758a8",
|
|
8
|
+
"generatedGoDigest": "sha256:b42e736e80decef8ac00823a1e9a2e6ffe21dc9de43c5c9e1c53ebf467d34e2c",
|
|
9
|
+
"generatedTypeScriptDigest": "sha256:03ed593ff19141cb265436d6d069b86e0a75f3290d74b76689d48c5b37a52e5b",
|
|
10
10
|
"generatedExclusions": {
|
|
11
11
|
"gen-go/contract_release.go": "contains the generated aggregate digests (self-reference)",
|
|
12
12
|
"gen-ts/contract-release.ts": "contains the generated aggregate digests (self-reference)"
|
|
13
13
|
},
|
|
14
14
|
"schemas": {
|
|
15
|
-
"schema/ai-budget-ledger-event.schema.json": "sha256:
|
|
15
|
+
"schema/ai-budget-ledger-event.schema.json": "sha256:92770bc5358e03a3aae6cd261dad02dfcbbb06a6203566da2c6c7a5e63dd671c",
|
|
16
16
|
"schema/ai-callsite-inventory.schema.json": "sha256:b15899a97cf108e4cd1bfd31ec40c57b341590ddb9c118fdaa904215dbe01859",
|
|
17
17
|
"schema/ai-classification-stamp.schema.json": "sha256:ad7f01dc8bb9a1cd619fce470227914aa3ef2ad57d34bfeaa0c6ef753aa6781d",
|
|
18
18
|
"schema/ai-composite-policy-digest.schema.json": "sha256:3efccc249327e59f67a37fd954b524ee727a3e28a3c557a46d6ec1f15d69b34e",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"schema/ai-gateway-key-lifecycle-event.schema.json": "sha256:ba5cb862abe73227bee714b25247b4cacb34f11fdd1476bb5f920923fd75e2a9",
|
|
21
21
|
"schema/ai-gateway-key-lookup.schema.json": "sha256:e994d4782c9bc4f14d3a1c35c9ac1e7a5ec84284cde5b3af7e3e6022130ddbb3",
|
|
22
22
|
"schema/ai-governance-decision.schema.json": "sha256:4d45c8540908bebb68456c45077c0cd453b416a3b955cc710de270950e090f50",
|
|
23
|
-
"schema/ai-metering-policy.schema.json": "sha256:
|
|
24
|
-
"schema/ai-policy-snapshot.schema.json": "sha256:
|
|
25
|
-
"schema/ai-pricing-revision.schema.json": "sha256:
|
|
23
|
+
"schema/ai-metering-policy.schema.json": "sha256:044115938d254d914feac162219d20ee48f741cd7ad32df4613b45f9c862fe8c",
|
|
24
|
+
"schema/ai-policy-snapshot.schema.json": "sha256:1778de5f1a5f6b034e2e767bd8189ad50daa03194107a05e090efafb5dce0cc1",
|
|
25
|
+
"schema/ai-pricing-revision.schema.json": "sha256:847fc3abf93ace82a188b028b067f3c3c1e7452e02a3c9ebba9bfbf3af749fd6",
|
|
26
26
|
"schema/ai-runtime-binding.schema.json": "sha256:e86cac2f70a474997bdef1577ca15f22982ec0ce866921df3f763c4d7f7fa191",
|
|
27
27
|
"schema/ai-runtime-contract.schema.json": "sha256:694cf8900ebe07a37ba0f12f50d2eed76e6608dc809e2b65969043e548dc4bba",
|
|
28
|
-
"schema/ai-trace-event-v2.schema.json": "sha256:
|
|
28
|
+
"schema/ai-trace-event-v2.schema.json": "sha256:b479199bb6e44ea23a1da53f69943cb8f3886c433914fdb9bf9e9bdbc3dd767d",
|
|
29
29
|
"schema/ai-trace-event.schema.json": "sha256:47c2268c9b8dbcf6e7908aeef43e71210f8a309bf4be4acc02139f9b59e7c717",
|
|
30
30
|
"schema/ai-transform-event.schema.json": "sha256:b845762e653b19afdaf959f7bd1624db490cd10c760daa9aaa61fb83f2a86b6e",
|
|
31
31
|
"schema/ai-transform-result.schema.json": "sha256:244e380a36957ab2dcb526ea22aaecb56b53664ce1fda6934d0021c084c99133",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"fixtures/ai/adversarial-sanitized-binding-relabel.json": "sha256:5deba053e91be027588e0a921bc7fcd75363044587b651b9fbb3f986b3a8bc85",
|
|
60
60
|
"fixtures/ai/valid-binding-classification-subject.json": "sha256:ca40d605f3351d44a4b37b598d033d129861443b65044fc056ca4406f07717c6",
|
|
61
61
|
"fixtures/ai/valid-blocked-trace-event.json": "sha256:c72e753f5ed805d97b47af5cc57ea2fe9034f27b133bf0f5c6565fbc0c6693c1",
|
|
62
|
-
"fixtures/ai/valid-budget-ledger-event.json": "sha256:
|
|
62
|
+
"fixtures/ai/valid-budget-ledger-event.json": "sha256:a2c1aea4f96fb28c61aa522bd5f5dfb2e1321b003f40fbcbac162d5404685760",
|
|
63
63
|
"fixtures/ai/valid-classification-stamp.json": "sha256:bf8256cec5626031b4cf5acfe9ffde73100150ba19259c36b274e1be0820bb73",
|
|
64
64
|
"fixtures/ai/valid-composite-policy-digest.json": "sha256:d13f2d022f9a29230103845b8af42b4f90c0d818ee64e6efaa31f5a547d9eeb7",
|
|
65
65
|
"fixtures/ai/valid-deployment-gate-decision.json": "sha256:cf070be5b6b4b4363d72aba448c1f23c1eef288e930a7f0a2807598a30a7e0af",
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
"fixtures/ai/valid-gateway-key-lookup.json": "sha256:a577cbdd019a7f39631e7efdb12dccb4377e3184d626a79979bfc426d04a50f4",
|
|
69
69
|
"fixtures/ai/valid-governance-decision.json": "sha256:0cd3ffc5244e177af00670c6d839814a93048157cf11ccb738ed13b10d875c55",
|
|
70
70
|
"fixtures/ai/valid-inventory.json": "sha256:3bb29df5525c3a69f6c13c203fbd08bb3d493ae5416fdd2f99125c74bbc11759",
|
|
71
|
-
"fixtures/ai/valid-metering-policy.json": "sha256:
|
|
72
|
-
"fixtures/ai/valid-policy-snapshot.json": "sha256:
|
|
73
|
-
"fixtures/ai/valid-pricing-revision.json": "sha256:
|
|
71
|
+
"fixtures/ai/valid-metering-policy.json": "sha256:73d10929f0232a09d31b263c5bf61f8985c9c629e1e78ea5c867dd919ff95c96",
|
|
72
|
+
"fixtures/ai/valid-policy-snapshot.json": "sha256:5ce6df9c261989f7a279eb772ead47d19e425a3e1df78d3a3eeb9043dee04318",
|
|
73
|
+
"fixtures/ai/valid-pricing-revision.json": "sha256:b8a89816a332397257fa0c40e5142ad9f05c9c6cbb92c37ae700f9b61c31fbce",
|
|
74
74
|
"fixtures/ai/valid-runtime-binding.json": "sha256:df971a518b8e680bb5260e801e7a0b03dd05076aeb11258205ec5ec205719f53",
|
|
75
75
|
"fixtures/ai/valid-runtime-contract.json": "sha256:a6af61297f2612679112675e9d401685966e58b891720014e3a5176426850006",
|
|
76
76
|
"fixtures/ai/valid-sanitized-binding-evidence-byo-source.json": "sha256:77f258fdb6cb7232b78a62fc035e293c6d604bed438ca35c54ab398064bc053a",
|
|
77
77
|
"fixtures/ai/valid-sanitized-binding-evidence.json": "sha256:19a4994b9a562305854945643a588f4f7c098db4bc3653da26df6e4284b00190",
|
|
78
78
|
"fixtures/ai/valid-source-revision-digest.json": "sha256:ec32021dbb636de9a1e47d560bfe59c21451e88f67d647387968aba48691409d",
|
|
79
|
-
"fixtures/ai/valid-trace-event-v2.json": "sha256:
|
|
79
|
+
"fixtures/ai/valid-trace-event-v2.json": "sha256:cdf33ae74b9113f0525fc6702aa3f8070605ce0d6352f82040f5bd354ff3c0f3",
|
|
80
80
|
"fixtures/ai/valid-trace-event.json": "sha256:42451ebfb0dc0c475baf6bc1acc3d1006cc2294df37174764e936519b7d64100",
|
|
81
81
|
"fixtures/ai/valid-transform-event.json": "sha256:6d99d5f34c010b39b194ff49a4c279d88bc7f05c697bacf088791352ca2d6330",
|
|
82
82
|
"fixtures/ai/valid-transform-result.json": "sha256:406f6deae648837f7610fda38f6b4c1a1a73b83b7a96f9f427fcf4e2061dee50",
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
"gen-go/doc.go": "sha256:c17bc2d39ed175ce7105c68305f8ae7152f659eb7cd187ecceee7698eb3a65dd",
|
|
92
92
|
"gen-go/error_category.go": "sha256:e36745796e32f753cf153a76c5f77c4bdf37a6a228e6607abcf95cac6f4a934b",
|
|
93
93
|
"gen-go/schema_documents.go": "sha256:c0399930c719b93d850847b257186f08d69a527f3ac1286ed0c49b66327b315a",
|
|
94
|
-
"gen-go/types.go": "sha256:
|
|
94
|
+
"gen-go/types.go": "sha256:6e5c65527e748482a9fa44ebdcd4c8122dbb503d8c006b58baa0c18c360dfed7",
|
|
95
95
|
"gen-go/version_state.go": "sha256:827f8768359998409b86ea02d9ba1a149981928bae7161e4dc95fe0520ce7410"
|
|
96
96
|
},
|
|
97
97
|
"generatedTypeScript": {
|
|
98
|
-
"gen-ts/ai-budget-ledger-event.ts": "sha256:
|
|
98
|
+
"gen-ts/ai-budget-ledger-event.ts": "sha256:64448d98a394e6eb103927cd35ce8a33e30176c0d5ee5afcdd8444f8aa051809",
|
|
99
99
|
"gen-ts/ai-callsite-inventory.ts": "sha256:2665ffe965056b85a7f03db22071d56ce6d21d306a82a876908d0727ef2315dc",
|
|
100
100
|
"gen-ts/ai-classification-stamp.ts": "sha256:dce78efba03df86a0986a16fd54c52066d322ff515d2463dbc45cafad82ecb44",
|
|
101
101
|
"gen-ts/ai-composite-policy-digest-helper.ts": "sha256:d6c51d0c35599ee4f81d605b71773f4fff41a0bb46499ff0c6185072fedf53ce",
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"gen-ts/ai-gateway-key-lookup.ts": "sha256:e55fc9a2252d5e7e1a383a58c8b92f22d8147ee4862a893a6cfe815b4225fc00",
|
|
106
106
|
"gen-ts/ai-gateway-key-token.ts": "sha256:ff6551ad3332cc665878d7ec93f42ce185c375e637531b2fbc82c697b877e784",
|
|
107
107
|
"gen-ts/ai-governance-decision.ts": "sha256:efc422971a06d741e048c81f299ce258d7fdd4b7f036a2b9dda7aaca0679e950",
|
|
108
|
-
"gen-ts/ai-metering-policy.ts": "sha256:
|
|
109
|
-
"gen-ts/ai-policy-snapshot.ts": "sha256:
|
|
110
|
-
"gen-ts/ai-pricing-revision.ts": "sha256:
|
|
108
|
+
"gen-ts/ai-metering-policy.ts": "sha256:dd261d57646a509cd46efaefac4aad58d018c7f7da98326dd8859e4ce951c56a",
|
|
109
|
+
"gen-ts/ai-policy-snapshot.ts": "sha256:9a8c65936674a957979048a2a0c6d08c887c87f2c4d5e7e8127dcf31d33eccbc",
|
|
110
|
+
"gen-ts/ai-pricing-revision.ts": "sha256:6e09e8354025dc859023295753ecc3674b5bc198b77317413654f1b7d2327a39",
|
|
111
111
|
"gen-ts/ai-runtime-binding.ts": "sha256:176c830d400ce44c508f8d249bb3c9724b2d595b78262615487cdafc4790263e",
|
|
112
112
|
"gen-ts/ai-runtime-contract.ts": "sha256:fc60f5c45edfee7d6f37e99ed9a60e4e5c22bba5793593aa259f028e1c7d0c6e",
|
|
113
|
-
"gen-ts/ai-trace-event-v2.ts": "sha256:
|
|
113
|
+
"gen-ts/ai-trace-event-v2.ts": "sha256:8c994355f290864da1cf42850c3eceb0e4a1567b45ed989de865213430d3ce0e",
|
|
114
114
|
"gen-ts/ai-trace-event.ts": "sha256:1e714996dc4622e94c6ae144a7bdb09147306940db47ae788aafd6f7f8311b0c",
|
|
115
115
|
"gen-ts/ai-transform-event.ts": "sha256:c8b520e01ce12b0e3a5ebe03a3ca63cc83368f26e1eef933de732c4fc1c504f9",
|
|
116
116
|
"gen-ts/ai-transform-result.ts": "sha256:208c66b2aeb425c0cbcc18b7191f6e8989443f2b2c1690648e0e06cc1448ce25",
|
|
@@ -14,6 +14,10 @@ export interface AiBudgetLedgerEvent {
|
|
|
14
14
|
requestId?: AiBudgetIdentifier;
|
|
15
15
|
amountMicroUsd: number;
|
|
16
16
|
committedMicroUsdAfter: number;
|
|
17
|
+
holdMicroUsd?: number;
|
|
18
|
+
actualMicroUsd?: number;
|
|
19
|
+
expiresAt?: string;
|
|
20
|
+
pricingRevision?: AiBudgetIdentifier;
|
|
17
21
|
pricingRevisionDigest?: AiBudgetDigest;
|
|
18
22
|
supersedesEventId?: AiBudgetIdentifier;
|
|
19
23
|
eventDigest: AiBudgetDigest;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export type AiMeteringPolicyDigest = string;
|
|
2
|
+
export type AiDimensionLimit = AiDimensionLimit1 & {
|
|
3
|
+
dimension: AiMeteringIdentifier;
|
|
4
|
+
unit: AiMeteringIdentifier;
|
|
5
|
+
maxPerRequest?: number;
|
|
6
|
+
maxPerMinute?: number;
|
|
7
|
+
};
|
|
8
|
+
export type AiDimensionLimit1 = {
|
|
9
|
+
[k: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type AiMeteringIdentifier = string;
|
|
2
12
|
/**
|
|
3
13
|
* Additive v2 metering-policy binding. It binds a composite policy to immutable pricing revisions without changing the v1 policy snapshot.
|
|
4
14
|
*/
|
|
@@ -11,6 +21,10 @@ export interface AiMeteringPolicy {
|
|
|
11
21
|
*/
|
|
12
22
|
pricingRevisionDigests: AiMeteringPolicyDigest[];
|
|
13
23
|
reservationMode: 'committed_exposure';
|
|
24
|
+
/**
|
|
25
|
+
* @maxItems 64
|
|
26
|
+
*/
|
|
27
|
+
dimensionLimits?: AiDimensionLimit[];
|
|
14
28
|
policyDigestV2: AiMeteringPolicyDigest;
|
|
15
29
|
publishedAt: string;
|
|
16
30
|
}
|
|
@@ -41,6 +41,15 @@ export type AiPolicyEmbeddedJsonSchema = {
|
|
|
41
41
|
minItems?: number;
|
|
42
42
|
maxItems?: number;
|
|
43
43
|
};
|
|
44
|
+
export type AiPolicyDimensionLimit = AiPolicyDimensionLimit1 & {
|
|
45
|
+
dimension: AiPolicyIdentifier;
|
|
46
|
+
unit: AiPolicyIdentifier;
|
|
47
|
+
maxPerRequest?: number;
|
|
48
|
+
maxPerMinute?: number;
|
|
49
|
+
};
|
|
50
|
+
export type AiPolicyDimensionLimit1 = {
|
|
51
|
+
[k: string]: unknown;
|
|
52
|
+
};
|
|
44
53
|
/**
|
|
45
54
|
* Immutable, content-addressed AI policy snapshot consumed by the Harbour AI Gateway. Provider credentials are represented only by Secrets Manager references.
|
|
46
55
|
*/
|
|
@@ -93,19 +102,25 @@ export interface AiPolicyModel {
|
|
|
93
102
|
* @minItems 1
|
|
94
103
|
* @maxItems 2
|
|
95
104
|
*/
|
|
96
|
-
capabilities: ('generation' | 'embeddings')[];
|
|
105
|
+
capabilities: ('generation' | 'embeddings' | 'transcription' | 'translation' | 'speech' | 'image' | 'realtime')[];
|
|
97
106
|
approved: boolean;
|
|
98
107
|
pricing: AiPolicyPricing;
|
|
99
108
|
}
|
|
100
109
|
export interface AiPolicyPricing {
|
|
101
110
|
revision: AiPolicyIdentifier;
|
|
111
|
+
revisionDigest?: AiPolicyDigest;
|
|
102
112
|
inputMicroUsdPerMillion: number;
|
|
103
113
|
outputMicroUsdPerMillion: number;
|
|
114
|
+
mediaMicroUsdPerUnit?: {
|
|
115
|
+
audio_seconds?: number;
|
|
116
|
+
image_count?: number;
|
|
117
|
+
video_seconds?: number;
|
|
118
|
+
};
|
|
104
119
|
}
|
|
105
120
|
export interface AiPolicyRoute {
|
|
106
121
|
alias: AiPolicyIdentifier;
|
|
107
122
|
version: number;
|
|
108
|
-
capability: 'generation' | 'embeddings';
|
|
123
|
+
capability: 'generation' | 'embeddings' | 'transcription' | 'translation' | 'speech' | 'image' | 'realtime';
|
|
109
124
|
/**
|
|
110
125
|
* @minItems 1
|
|
111
126
|
* @maxItems 16
|
|
@@ -154,6 +169,10 @@ export interface AiPolicyLimit {
|
|
|
154
169
|
requestsPerMinute: number;
|
|
155
170
|
tokensPerMinute: number;
|
|
156
171
|
monthlyBudgetMicroUsd: number;
|
|
172
|
+
/**
|
|
173
|
+
* @maxItems 64
|
|
174
|
+
*/
|
|
175
|
+
dimensionLimits?: AiPolicyDimensionLimit[];
|
|
157
176
|
}
|
|
158
177
|
export interface AiPolicyRetention {
|
|
159
178
|
captureMode: 'OFF' | 'BEST_EFFORT' | 'REQUIRED';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type AiPricingIdentifier = string;
|
|
2
2
|
export type AiPricingDigest = string;
|
|
3
3
|
/**
|
|
4
|
-
* Immutable v2 line-item pricing revision. A correction is a new revision; published records are never edited.
|
|
4
|
+
* Immutable v2 line-item pricing revision for token and media dimensions. A correction is a new revision; published records are never edited.
|
|
5
5
|
*/
|
|
6
6
|
export interface AiPricingRevision {
|
|
7
7
|
schema: 'harbour.ai-pricing-revision/2.0';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type AiTraceV2Digest = string;
|
|
2
2
|
export type AiTraceV2Identifier = string;
|
|
3
3
|
/**
|
|
4
|
-
* Additive metering projection linked to a readable v1 trace. It carries dimension-level reported or estimated usage without changing the v1 event.
|
|
4
|
+
* Additive metering projection linked to a readable v1 trace. It carries dimension-level reported or estimated usage (including audio, image and input-video media) without changing the v1 event.
|
|
5
5
|
*/
|
|
6
6
|
export interface AiTraceEventV2 {
|
|
7
7
|
schema: 'harbour.ai-trace-event/2.0';
|
|
@@ -16,6 +16,10 @@ export interface AiTraceEventV2 {
|
|
|
16
16
|
totalCostMicroUsd: number;
|
|
17
17
|
reservationId?: string;
|
|
18
18
|
meteringStatus: 'settled' | 'reserved' | 'unknown' | 'repaired';
|
|
19
|
+
servedModel?: string;
|
|
20
|
+
ingressFormat?: 'openai' | 'gemini';
|
|
21
|
+
identityFastPath?: boolean;
|
|
22
|
+
versionOrdinalVerified?: boolean;
|
|
19
23
|
occurredAt: string;
|
|
20
24
|
}
|
|
21
25
|
export interface UsageLineItem {
|
|
@@ -24,6 +28,7 @@ export interface UsageLineItem {
|
|
|
24
28
|
direction: 'input' | 'output';
|
|
25
29
|
quantity: number;
|
|
26
30
|
unit: AiTraceV2Identifier;
|
|
31
|
+
priceRevision?: AiTraceV2Identifier;
|
|
27
32
|
priceRevisionDigest: AiTraceV2Digest;
|
|
28
33
|
scale: number;
|
|
29
34
|
costMicroUsd: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const ContractRepositoryVersion: "0.
|
|
2
|
-
export declare const ContractPublishVersion: "0.
|
|
3
|
-
export declare const ContractPublishTag: "v0.
|
|
4
|
-
export declare const ContractSchemasDigest: "sha256:
|
|
5
|
-
export declare const ContractAiFixturesDigest: "sha256:
|
|
6
|
-
export declare const ContractGeneratedGoDigest: "sha256:
|
|
7
|
-
export declare const ContractGeneratedTypeScriptDigest: "sha256:
|
|
1
|
+
export declare const ContractRepositoryVersion: "0.12.0.0";
|
|
2
|
+
export declare const ContractPublishVersion: "0.12.0";
|
|
3
|
+
export declare const ContractPublishTag: "v0.12.0";
|
|
4
|
+
export declare const ContractSchemasDigest: "sha256:0e90bbd74c5b1df2e0123ec75d8bec1296e9647b95c4aa88a9e9bb2452872bf4";
|
|
5
|
+
export declare const ContractAiFixturesDigest: "sha256:8c406c269e909c028e35eca1321c18de95457ddd6731db8f3fb4cd90726758a8";
|
|
6
|
+
export declare const ContractGeneratedGoDigest: "sha256:b42e736e80decef8ac00823a1e9a2e6ffe21dc9de43c5c9e1c53ebf467d34e2c";
|
|
7
|
+
export declare const ContractGeneratedTypeScriptDigest: "sha256:03ed593ff19141cb265436d6d069b86e0a75f3290d74b76689d48c5b37a52e5b";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
-
export const ContractRepositoryVersion = "0.
|
|
4
|
-
export const ContractPublishVersion = "0.
|
|
5
|
-
export const ContractPublishTag = "v0.
|
|
6
|
-
export const ContractSchemasDigest = "sha256:
|
|
7
|
-
export const ContractAiFixturesDigest = "sha256:
|
|
8
|
-
export const ContractGeneratedGoDigest = "sha256:
|
|
9
|
-
export const ContractGeneratedTypeScriptDigest = "sha256:
|
|
3
|
+
export const ContractRepositoryVersion = "0.12.0.0";
|
|
4
|
+
export const ContractPublishVersion = "0.12.0";
|
|
5
|
+
export const ContractPublishTag = "v0.12.0";
|
|
6
|
+
export const ContractSchemasDigest = "sha256:0e90bbd74c5b1df2e0123ec75d8bec1296e9647b95c4aa88a9e9bb2452872bf4";
|
|
7
|
+
export const ContractAiFixturesDigest = "sha256:8c406c269e909c028e35eca1321c18de95457ddd6731db8f3fb4cd90726758a8";
|
|
8
|
+
export const ContractGeneratedGoDigest = "sha256:b42e736e80decef8ac00823a1e9a2e6ffe21dc9de43c5c9e1c53ebf467d34e2c";
|
|
9
|
+
export const ContractGeneratedTypeScriptDigest = "sha256:03ed593ff19141cb265436d6d069b86e0a75f3290d74b76689d48c5b37a52e5b";
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"requestId": "req_example123",
|
|
10
10
|
"amountMicroUsd": 500,
|
|
11
11
|
"committedMicroUsdAfter": 10500,
|
|
12
|
+
"holdMicroUsd": 500,
|
|
13
|
+
"actualMicroUsd": 0,
|
|
14
|
+
"expiresAt": "2026-08-10T10:15:00Z",
|
|
15
|
+
"pricingRevision": "gemini-flash-2026-08-10",
|
|
12
16
|
"pricingRevisionDigest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
13
17
|
"eventDigest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
14
18
|
"occurredAt": "2026-08-10T10:00:00Z"
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
"policyDigest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
4
4
|
"pricingRevisionDigests": ["sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"],
|
|
5
5
|
"reservationMode": "committed_exposure",
|
|
6
|
+
"dimensionLimits": [
|
|
7
|
+
{ "dimension": "audio_in", "unit": "seconds", "maxPerRequest": 3600, "maxPerMinute": 7200 },
|
|
8
|
+
{ "dimension": "image_in", "unit": "count", "maxPerRequest": 16 },
|
|
9
|
+
{ "dimension": "video_in", "unit": "seconds", "maxPerRequest": 300 }
|
|
10
|
+
],
|
|
6
11
|
"policyDigestV2": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
|
|
7
12
|
"publishedAt": "2026-08-10T09:00:00Z"
|
|
8
13
|
}
|
|
@@ -28,12 +28,18 @@
|
|
|
28
28
|
"id": "openai-gpt-4.1-mini",
|
|
29
29
|
"providerId": "openai-primary",
|
|
30
30
|
"providerModel": "gpt-4.1-mini",
|
|
31
|
-
"capabilities": ["generation"],
|
|
31
|
+
"capabilities": ["generation", "image"],
|
|
32
32
|
"approved": true,
|
|
33
33
|
"pricing": {
|
|
34
34
|
"revision": "openai-gpt-4.1-mini-2026-08-01",
|
|
35
|
+
"revisionDigest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
35
36
|
"inputMicroUsdPerMillion": 400000,
|
|
36
|
-
"outputMicroUsdPerMillion": 1600000
|
|
37
|
+
"outputMicroUsdPerMillion": 1600000,
|
|
38
|
+
"mediaMicroUsdPerUnit": {
|
|
39
|
+
"audio_seconds": 4,
|
|
40
|
+
"image_count": 40,
|
|
41
|
+
"video_seconds": 5
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
],
|
|
@@ -106,7 +112,12 @@
|
|
|
106
112
|
"scope": "application",
|
|
107
113
|
"requestsPerMinute": 60,
|
|
108
114
|
"tokensPerMinute": 100000,
|
|
109
|
-
"monthlyBudgetMicroUsd": 100000000
|
|
115
|
+
"monthlyBudgetMicroUsd": 100000000,
|
|
116
|
+
"dimensionLimits": [
|
|
117
|
+
{ "dimension": "audio_in", "unit": "seconds", "maxPerRequest": 3600 },
|
|
118
|
+
{ "dimension": "image_in", "unit": "count", "maxPerRequest": 16 },
|
|
119
|
+
{ "dimension": "video_in", "unit": "seconds", "maxPerRequest": 300 }
|
|
120
|
+
]
|
|
110
121
|
}
|
|
111
122
|
],
|
|
112
123
|
"retention": {
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
"providerModel": "gpt-test",
|
|
6
6
|
"currency": "USD",
|
|
7
7
|
"dimensions": [
|
|
8
|
-
{ "dimension": "
|
|
9
|
-
{ "dimension": "
|
|
8
|
+
{ "dimension": "input_tokens", "direction": "input", "unit": "tokens", "scale": 1000000, "microUsdPerScale": 100000 },
|
|
9
|
+
{ "dimension": "output_tokens", "direction": "output", "unit": "tokens", "scale": 1000000, "microUsdPerScale": 200000 },
|
|
10
|
+
{ "dimension": "audio_in", "direction": "input", "unit": "seconds", "scale": 1, "microUsdPerScale": 4 },
|
|
11
|
+
{ "dimension": "image_in", "direction": "input", "unit": "count", "scale": 1, "microUsdPerScale": 40 },
|
|
12
|
+
{ "dimension": "video_in", "direction": "input", "unit": "seconds", "scale": 1, "microUsdPerScale": 5 }
|
|
10
13
|
],
|
|
11
14
|
"revisionDigest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
12
15
|
"effectiveAt": "2026-08-10T00:00:00Z",
|
|
@@ -7,18 +7,59 @@
|
|
|
7
7
|
"usageLineItems": [
|
|
8
8
|
{
|
|
9
9
|
"attempt": 1,
|
|
10
|
-
"dimension": "
|
|
10
|
+
"dimension": "input_tokens",
|
|
11
11
|
"direction": "input",
|
|
12
12
|
"quantity": 120,
|
|
13
|
-
"unit": "
|
|
13
|
+
"unit": "tokens",
|
|
14
|
+
"priceRevision": "gemini-flash-2026-08-10",
|
|
14
15
|
"priceRevisionDigest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
15
16
|
"scale": 1000000,
|
|
16
17
|
"costMicroUsd": 12,
|
|
17
18
|
"provenance": "reported"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"attempt": 1,
|
|
22
|
+
"dimension": "audio_in",
|
|
23
|
+
"direction": "input",
|
|
24
|
+
"quantity": 30,
|
|
25
|
+
"unit": "seconds",
|
|
26
|
+
"priceRevision": "gemini-flash-2026-08-10",
|
|
27
|
+
"priceRevisionDigest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
28
|
+
"scale": 1,
|
|
29
|
+
"costMicroUsd": 120,
|
|
30
|
+
"provenance": "reported"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"attempt": 1,
|
|
34
|
+
"dimension": "image_in",
|
|
35
|
+
"direction": "input",
|
|
36
|
+
"quantity": 2,
|
|
37
|
+
"unit": "count",
|
|
38
|
+
"priceRevision": "gemini-flash-2026-08-10",
|
|
39
|
+
"priceRevisionDigest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
40
|
+
"scale": 1,
|
|
41
|
+
"costMicroUsd": 80,
|
|
42
|
+
"provenance": "reported"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"attempt": 1,
|
|
46
|
+
"dimension": "video_in",
|
|
47
|
+
"direction": "input",
|
|
48
|
+
"quantity": 12,
|
|
49
|
+
"unit": "seconds",
|
|
50
|
+
"priceRevision": "gemini-flash-2026-08-10",
|
|
51
|
+
"priceRevisionDigest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
52
|
+
"scale": 1,
|
|
53
|
+
"costMicroUsd": 60,
|
|
54
|
+
"provenance": "estimated"
|
|
18
55
|
}
|
|
19
56
|
],
|
|
20
|
-
"totalCostMicroUsd":
|
|
57
|
+
"totalCostMicroUsd": 272,
|
|
21
58
|
"reservationId": "req_example123#budget",
|
|
22
59
|
"meteringStatus": "settled",
|
|
60
|
+
"servedModel": "gemini-2.5-flash",
|
|
61
|
+
"ingressFormat": "gemini",
|
|
62
|
+
"identityFastPath": true,
|
|
63
|
+
"versionOrdinalVerified": true,
|
|
23
64
|
"occurredAt": "2026-08-10T10:00:00Z"
|
|
24
65
|
}
|
|
@@ -18,6 +18,10 @@ export interface AiBudgetLedgerEvent {
|
|
|
18
18
|
requestId?: AiBudgetIdentifier;
|
|
19
19
|
amountMicroUsd: number;
|
|
20
20
|
committedMicroUsdAfter: number;
|
|
21
|
+
holdMicroUsd?: number;
|
|
22
|
+
actualMicroUsd?: number;
|
|
23
|
+
expiresAt?: string;
|
|
24
|
+
pricingRevision?: AiBudgetIdentifier;
|
|
21
25
|
pricingRevisionDigest?: AiBudgetDigest;
|
|
22
26
|
supersedesEventId?: AiBudgetIdentifier;
|
|
23
27
|
eventDigest: AiBudgetDigest;
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
3
|
|
|
4
4
|
export type AiMeteringPolicyDigest = string;
|
|
5
|
+
export type AiDimensionLimit = AiDimensionLimit1 & {
|
|
6
|
+
dimension: AiMeteringIdentifier;
|
|
7
|
+
unit: AiMeteringIdentifier;
|
|
8
|
+
maxPerRequest?: number;
|
|
9
|
+
maxPerMinute?: number;
|
|
10
|
+
};
|
|
11
|
+
export type AiDimensionLimit1 = {
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
export type AiMeteringIdentifier = string;
|
|
5
15
|
|
|
6
16
|
/**
|
|
7
17
|
* Additive v2 metering-policy binding. It binds a composite policy to immutable pricing revisions without changing the v1 policy snapshot.
|
|
@@ -15,6 +25,10 @@ export interface AiMeteringPolicy {
|
|
|
15
25
|
*/
|
|
16
26
|
pricingRevisionDigests: AiMeteringPolicyDigest[];
|
|
17
27
|
reservationMode: 'committed_exposure';
|
|
28
|
+
/**
|
|
29
|
+
* @maxItems 64
|
|
30
|
+
*/
|
|
31
|
+
dimensionLimits?: AiDimensionLimit[];
|
|
18
32
|
policyDigestV2: AiMeteringPolicyDigest;
|
|
19
33
|
publishedAt: string;
|
|
20
34
|
}
|
|
@@ -44,6 +44,15 @@ export type AiPolicyEmbeddedJsonSchema = {
|
|
|
44
44
|
minItems?: number;
|
|
45
45
|
maxItems?: number;
|
|
46
46
|
};
|
|
47
|
+
export type AiPolicyDimensionLimit = AiPolicyDimensionLimit1 & {
|
|
48
|
+
dimension: AiPolicyIdentifier;
|
|
49
|
+
unit: AiPolicyIdentifier;
|
|
50
|
+
maxPerRequest?: number;
|
|
51
|
+
maxPerMinute?: number;
|
|
52
|
+
};
|
|
53
|
+
export type AiPolicyDimensionLimit1 = {
|
|
54
|
+
[k: string]: unknown;
|
|
55
|
+
};
|
|
47
56
|
|
|
48
57
|
/**
|
|
49
58
|
* Immutable, content-addressed AI policy snapshot consumed by the Harbour AI Gateway. Provider credentials are represented only by Secrets Manager references.
|
|
@@ -97,19 +106,25 @@ export interface AiPolicyModel {
|
|
|
97
106
|
* @minItems 1
|
|
98
107
|
* @maxItems 2
|
|
99
108
|
*/
|
|
100
|
-
capabilities: ('generation' | 'embeddings')[];
|
|
109
|
+
capabilities: ('generation' | 'embeddings' | 'transcription' | 'translation' | 'speech' | 'image' | 'realtime')[];
|
|
101
110
|
approved: boolean;
|
|
102
111
|
pricing: AiPolicyPricing;
|
|
103
112
|
}
|
|
104
113
|
export interface AiPolicyPricing {
|
|
105
114
|
revision: AiPolicyIdentifier;
|
|
115
|
+
revisionDigest?: AiPolicyDigest;
|
|
106
116
|
inputMicroUsdPerMillion: number;
|
|
107
117
|
outputMicroUsdPerMillion: number;
|
|
118
|
+
mediaMicroUsdPerUnit?: {
|
|
119
|
+
audio_seconds?: number;
|
|
120
|
+
image_count?: number;
|
|
121
|
+
video_seconds?: number;
|
|
122
|
+
};
|
|
108
123
|
}
|
|
109
124
|
export interface AiPolicyRoute {
|
|
110
125
|
alias: AiPolicyIdentifier;
|
|
111
126
|
version: number;
|
|
112
|
-
capability: 'generation' | 'embeddings';
|
|
127
|
+
capability: 'generation' | 'embeddings' | 'transcription' | 'translation' | 'speech' | 'image' | 'realtime';
|
|
113
128
|
/**
|
|
114
129
|
* @minItems 1
|
|
115
130
|
* @maxItems 16
|
|
@@ -158,6 +173,10 @@ export interface AiPolicyLimit {
|
|
|
158
173
|
requestsPerMinute: number;
|
|
159
174
|
tokensPerMinute: number;
|
|
160
175
|
monthlyBudgetMicroUsd: number;
|
|
176
|
+
/**
|
|
177
|
+
* @maxItems 64
|
|
178
|
+
*/
|
|
179
|
+
dimensionLimits?: AiPolicyDimensionLimit[];
|
|
161
180
|
}
|
|
162
181
|
export interface AiPolicyRetention {
|
|
163
182
|
captureMode: 'OFF' | 'BEST_EFFORT' | 'REQUIRED';
|
|
@@ -5,7 +5,7 @@ export type AiPricingIdentifier = string;
|
|
|
5
5
|
export type AiPricingDigest = string;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Immutable v2 line-item pricing revision. A correction is a new revision; published records are never edited.
|
|
8
|
+
* Immutable v2 line-item pricing revision for token and media dimensions. A correction is a new revision; published records are never edited.
|
|
9
9
|
*/
|
|
10
10
|
export interface AiPricingRevision {
|
|
11
11
|
schema: 'harbour.ai-pricing-revision/2.0';
|
|
@@ -5,7 +5,7 @@ export type AiTraceV2Digest = string;
|
|
|
5
5
|
export type AiTraceV2Identifier = string;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Additive metering projection linked to a readable v1 trace. It carries dimension-level reported or estimated usage without changing the v1 event.
|
|
8
|
+
* Additive metering projection linked to a readable v1 trace. It carries dimension-level reported or estimated usage (including audio, image and input-video media) without changing the v1 event.
|
|
9
9
|
*/
|
|
10
10
|
export interface AiTraceEventV2 {
|
|
11
11
|
schema: 'harbour.ai-trace-event/2.0';
|
|
@@ -20,6 +20,10 @@ export interface AiTraceEventV2 {
|
|
|
20
20
|
totalCostMicroUsd: number;
|
|
21
21
|
reservationId?: string;
|
|
22
22
|
meteringStatus: 'settled' | 'reserved' | 'unknown' | 'repaired';
|
|
23
|
+
servedModel?: string;
|
|
24
|
+
ingressFormat?: 'openai' | 'gemini';
|
|
25
|
+
identityFastPath?: boolean;
|
|
26
|
+
versionOrdinalVerified?: boolean;
|
|
23
27
|
occurredAt: string;
|
|
24
28
|
}
|
|
25
29
|
export interface UsageLineItem {
|
|
@@ -28,6 +32,7 @@ export interface UsageLineItem {
|
|
|
28
32
|
direction: 'input' | 'output';
|
|
29
33
|
quantity: number;
|
|
30
34
|
unit: AiTraceV2Identifier;
|
|
35
|
+
priceRevision?: AiTraceV2Identifier;
|
|
31
36
|
priceRevisionDigest: AiTraceV2Digest;
|
|
32
37
|
scale: number;
|
|
33
38
|
costMicroUsd: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
3
|
|
|
4
|
-
export const ContractRepositoryVersion = "0.
|
|
5
|
-
export const ContractPublishVersion = "0.
|
|
6
|
-
export const ContractPublishTag = "v0.
|
|
7
|
-
export const ContractSchemasDigest = "sha256:
|
|
8
|
-
export const ContractAiFixturesDigest = "sha256:
|
|
9
|
-
export const ContractGeneratedGoDigest = "sha256:
|
|
10
|
-
export const ContractGeneratedTypeScriptDigest = "sha256:
|
|
4
|
+
export const ContractRepositoryVersion = "0.12.0.0" as const;
|
|
5
|
+
export const ContractPublishVersion = "0.12.0" as const;
|
|
6
|
+
export const ContractPublishTag = "v0.12.0" as const;
|
|
7
|
+
export const ContractSchemasDigest = "sha256:0e90bbd74c5b1df2e0123ec75d8bec1296e9647b95c4aa88a9e9bb2452872bf4" as const;
|
|
8
|
+
export const ContractAiFixturesDigest = "sha256:8c406c269e909c028e35eca1321c18de95457ddd6731db8f3fb4cd90726758a8" as const;
|
|
9
|
+
export const ContractGeneratedGoDigest = "sha256:b42e736e80decef8ac00823a1e9a2e6ffe21dc9de43c5c9e1c53ebf467d34e2c" as const;
|
|
10
|
+
export const ContractGeneratedTypeScriptDigest = "sha256:03ed593ff19141cb265436d6d069b86e0a75f3290d74b76689d48c5b37a52e5b" as const;
|
package/package.json
CHANGED
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"requestId": { "$ref": "#/definitions/AiBudgetIdentifier" },
|
|
18
18
|
"amountMicroUsd": { "type": "integer" },
|
|
19
19
|
"committedMicroUsdAfter": { "type": "integer", "minimum": 0 },
|
|
20
|
+
"holdMicroUsd": { "type": "integer", "minimum": 0 },
|
|
21
|
+
"actualMicroUsd": { "type": "integer", "minimum": 0 },
|
|
22
|
+
"expiresAt": { "type": "string", "format": "date-time" },
|
|
23
|
+
"pricingRevision": { "$ref": "#/definitions/AiBudgetIdentifier" },
|
|
20
24
|
"pricingRevisionDigest": { "$ref": "#/definitions/AiBudgetDigest" },
|
|
21
25
|
"supersedesEventId": { "$ref": "#/definitions/AiBudgetIdentifier" },
|
|
22
26
|
"eventDigest": { "$ref": "#/definitions/AiBudgetDigest" },
|
|
@@ -11,8 +11,24 @@
|
|
|
11
11
|
"policyDigest": { "$ref": "#/definitions/AiMeteringPolicyDigest" },
|
|
12
12
|
"pricingRevisionDigests": { "type": "array", "minItems": 1, "maxItems": 512, "uniqueItems": true, "items": { "$ref": "#/definitions/AiMeteringPolicyDigest" } },
|
|
13
13
|
"reservationMode": { "type": "string", "const": "committed_exposure" },
|
|
14
|
+
"dimensionLimits": { "type": "array", "maxItems": 64, "items": { "$ref": "#/definitions/AiDimensionLimit" } },
|
|
14
15
|
"policyDigestV2": { "$ref": "#/definitions/AiMeteringPolicyDigest" },
|
|
15
16
|
"publishedAt": { "type": "string", "format": "date-time" }
|
|
16
17
|
},
|
|
17
|
-
"definitions": {
|
|
18
|
+
"definitions": {
|
|
19
|
+
"AiMeteringPolicyDigest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
20
|
+
"AiMeteringIdentifier": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[A-Za-z0-9][A-Za-z0-9_.@/-]*$" },
|
|
21
|
+
"AiDimensionLimit": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"required": ["dimension", "unit"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"dimension": { "$ref": "#/definitions/AiMeteringIdentifier" },
|
|
27
|
+
"unit": { "$ref": "#/definitions/AiMeteringIdentifier" },
|
|
28
|
+
"maxPerRequest": { "type": "integer", "minimum": 0 },
|
|
29
|
+
"maxPerMinute": { "type": "integer", "minimum": 0 }
|
|
30
|
+
},
|
|
31
|
+
"anyOf": [{ "required": ["maxPerRequest"] }, { "required": ["maxPerMinute"] }]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
18
34
|
}
|
|
@@ -124,8 +124,18 @@
|
|
|
124
124
|
"required": ["revision", "inputMicroUsdPerMillion", "outputMicroUsdPerMillion"],
|
|
125
125
|
"properties": {
|
|
126
126
|
"revision": { "$ref": "#/definitions/AiPolicyIdentifier" },
|
|
127
|
+
"revisionDigest": { "$ref": "#/definitions/AiPolicyDigest" },
|
|
127
128
|
"inputMicroUsdPerMillion": { "type": "integer", "minimum": 0 },
|
|
128
|
-
"outputMicroUsdPerMillion": { "type": "integer", "minimum": 0 }
|
|
129
|
+
"outputMicroUsdPerMillion": { "type": "integer", "minimum": 0 },
|
|
130
|
+
"mediaMicroUsdPerUnit": {
|
|
131
|
+
"type": "object",
|
|
132
|
+
"additionalProperties": false,
|
|
133
|
+
"properties": {
|
|
134
|
+
"audio_seconds": { "type": "integer", "minimum": 0 },
|
|
135
|
+
"image_count": { "type": "integer", "minimum": 0 },
|
|
136
|
+
"video_seconds": { "type": "integer", "minimum": 0 }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
129
139
|
}
|
|
130
140
|
},
|
|
131
141
|
"AiPolicyModel": {
|
|
@@ -141,7 +151,7 @@
|
|
|
141
151
|
"minItems": 1,
|
|
142
152
|
"maxItems": 2,
|
|
143
153
|
"uniqueItems": true,
|
|
144
|
-
"items": { "type": "string", "enum": ["generation", "embeddings"] }
|
|
154
|
+
"items": { "type": "string", "enum": ["generation", "embeddings", "transcription", "translation", "speech", "image", "realtime"] }
|
|
145
155
|
},
|
|
146
156
|
"approved": { "type": "boolean" },
|
|
147
157
|
"pricing": { "$ref": "#/definitions/AiPolicyPricing" }
|
|
@@ -164,7 +174,7 @@
|
|
|
164
174
|
"properties": {
|
|
165
175
|
"alias": { "$ref": "#/definitions/AiPolicyIdentifier" },
|
|
166
176
|
"version": { "type": "integer", "minimum": 1 },
|
|
167
|
-
"capability": { "type": "string", "enum": ["generation", "embeddings"] },
|
|
177
|
+
"capability": { "type": "string", "enum": ["generation", "embeddings", "transcription", "translation", "speech", "image", "realtime"] },
|
|
168
178
|
"targets": {
|
|
169
179
|
"type": "array",
|
|
170
180
|
"minItems": 1,
|
|
@@ -318,9 +328,26 @@
|
|
|
318
328
|
"scope": { "type": "string", "enum": ["tenant", "application"] },
|
|
319
329
|
"requestsPerMinute": { "type": "integer", "minimum": 1 },
|
|
320
330
|
"tokensPerMinute": { "type": "integer", "minimum": 1 },
|
|
321
|
-
"monthlyBudgetMicroUsd": { "type": "integer", "minimum": 0 }
|
|
331
|
+
"monthlyBudgetMicroUsd": { "type": "integer", "minimum": 0 },
|
|
332
|
+
"dimensionLimits": {
|
|
333
|
+
"type": "array",
|
|
334
|
+
"maxItems": 64,
|
|
335
|
+
"items": { "$ref": "#/definitions/AiPolicyDimensionLimit" }
|
|
336
|
+
}
|
|
322
337
|
}
|
|
323
338
|
},
|
|
339
|
+
"AiPolicyDimensionLimit": {
|
|
340
|
+
"type": "object",
|
|
341
|
+
"additionalProperties": false,
|
|
342
|
+
"required": ["dimension", "unit"],
|
|
343
|
+
"properties": {
|
|
344
|
+
"dimension": { "$ref": "#/definitions/AiPolicyIdentifier" },
|
|
345
|
+
"unit": { "$ref": "#/definitions/AiPolicyIdentifier" },
|
|
346
|
+
"maxPerRequest": { "type": "integer", "minimum": 0 },
|
|
347
|
+
"maxPerMinute": { "type": "integer", "minimum": 0 }
|
|
348
|
+
},
|
|
349
|
+
"anyOf": [{ "required": ["maxPerRequest"] }, { "required": ["maxPerMinute"] }]
|
|
350
|
+
},
|
|
324
351
|
"AiPolicyRetention": {
|
|
325
352
|
"type": "object",
|
|
326
353
|
"additionalProperties": false,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "https://schemas.harbour.dev/ai-pricing-revision.schema.json",
|
|
4
4
|
"title": "AiPricingRevision",
|
|
5
|
-
"description": "Immutable v2 line-item pricing revision. A correction is a new revision; published records are never edited.",
|
|
5
|
+
"description": "Immutable v2 line-item pricing revision for token and media dimensions. A correction is a new revision; published records are never edited.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["schema", "revisionId", "provider", "providerModel", "currency", "dimensions", "revisionDigest", "effectiveAt", "publishedAt"],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "https://schemas.harbour.dev/ai-trace-event-v2.schema.json",
|
|
4
4
|
"title": "AiTraceEventV2",
|
|
5
|
-
"description": "Additive metering projection linked to a readable v1 trace. It carries dimension-level reported or estimated usage without changing the v1 event.",
|
|
5
|
+
"description": "Additive metering projection linked to a readable v1 trace. It carries dimension-level reported or estimated usage (including audio, image and input-video media) without changing the v1 event.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["schema", "traceId", "requestId", "policyDigest", "outcome", "usageLineItems", "totalCostMicroUsd", "meteringStatus", "occurredAt"],
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"totalCostMicroUsd": { "type": "integer", "minimum": 0 },
|
|
17
17
|
"reservationId": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
18
18
|
"meteringStatus": { "type": "string", "enum": ["settled", "reserved", "unknown", "repaired"] },
|
|
19
|
+
"servedModel": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
20
|
+
"ingressFormat": { "type": "string", "enum": ["openai", "gemini"] },
|
|
21
|
+
"identityFastPath": { "type": "boolean" },
|
|
22
|
+
"versionOrdinalVerified": { "type": "boolean" },
|
|
19
23
|
"occurredAt": { "type": "string", "format": "date-time" }
|
|
20
24
|
},
|
|
21
25
|
"definitions": {
|
|
@@ -31,6 +35,7 @@
|
|
|
31
35
|
"direction": { "type": "string", "enum": ["input", "output"] },
|
|
32
36
|
"quantity": { "type": "integer", "minimum": 0 },
|
|
33
37
|
"unit": { "$ref": "#/definitions/AiTraceV2Identifier" },
|
|
38
|
+
"priceRevision": { "$ref": "#/definitions/AiTraceV2Identifier" },
|
|
34
39
|
"priceRevisionDigest": { "$ref": "#/definitions/AiTraceV2Digest" },
|
|
35
40
|
"scale": { "type": "integer", "minimum": 1 },
|
|
36
41
|
"costMicroUsd": { "type": "integer", "minimum": 0 },
|