@miradorlabs/web-grpc 2.60.0 → 2.62.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/package.json +1 -1
- package/proto/gateway/web/v1/github_connector.ts +28 -1
- package/proto/gateway/web/v1/github_connector_pb.js +31 -1
- package/proto/gateway/web/v1/model_gateway.ts +728 -0
- package/proto/gateway/web/v1/model_gateway_grpc_pb.js +85 -0
- package/proto/gateway/web/v1/model_gateway_pb.js +1261 -0
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.12.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: proto/gateway/web/v1/model_gateway.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import type { Metadata } from "@grpc/grpc-js";
|
|
10
|
+
import { Timestamp } from "../../../../google/protobuf/timestamp";
|
|
11
|
+
import { ResponseStatus } from "../../common/v1/status";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "gateway.web.v1";
|
|
14
|
+
|
|
15
|
+
export interface ListModelsRequest {
|
|
16
|
+
organizationId: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ListModelsResponse {
|
|
21
|
+
status: ResponseStatus | undefined;
|
|
22
|
+
models: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ModelPricesRequest {
|
|
26
|
+
organizationId: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
/** Model name (from ListModels). Required. */
|
|
29
|
+
model: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ModelPricesResponse {
|
|
33
|
+
status:
|
|
34
|
+
| ResponseStatus
|
|
35
|
+
| undefined;
|
|
36
|
+
/** One entry per provider, source-collapsed by rank, ordered by provider. */
|
|
37
|
+
prices: ModelPrice[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ModelPrice is one provider's latest list price for a model, in USD per million tokens (0 = free or
|
|
42
|
+
* unpriced along that dimension). source is the scraper catalog the winning row came from.
|
|
43
|
+
*/
|
|
44
|
+
export interface ModelPrice {
|
|
45
|
+
source: string;
|
|
46
|
+
provider: string;
|
|
47
|
+
model: string;
|
|
48
|
+
scrapedAt: Date | undefined;
|
|
49
|
+
inputUsdPerMtok: number;
|
|
50
|
+
outputUsdPerMtok: number;
|
|
51
|
+
cacheReadUsdPerMtok: number;
|
|
52
|
+
cacheWriteUsdPerMtok: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function createBaseListModelsRequest(): ListModelsRequest {
|
|
56
|
+
return { organizationId: "", projectId: "" };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const ListModelsRequest: MessageFns<ListModelsRequest> = {
|
|
60
|
+
encode(message: ListModelsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
61
|
+
if (message.organizationId !== "") {
|
|
62
|
+
writer.uint32(10).string(message.organizationId);
|
|
63
|
+
}
|
|
64
|
+
if (message.projectId !== "") {
|
|
65
|
+
writer.uint32(18).string(message.projectId);
|
|
66
|
+
}
|
|
67
|
+
return writer;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListModelsRequest {
|
|
71
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
72
|
+
const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
|
|
73
|
+
if (previousRecursionDepth >= 100) {
|
|
74
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
75
|
+
}
|
|
76
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
77
|
+
try {
|
|
78
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
79
|
+
const message = createBaseListModelsRequest();
|
|
80
|
+
while (reader.pos < end) {
|
|
81
|
+
const tag = reader.uint32();
|
|
82
|
+
switch (tag >>> 3) {
|
|
83
|
+
case 1: {
|
|
84
|
+
if (tag !== 10) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
message.organizationId = reader.string();
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
case 2: {
|
|
92
|
+
if (tag !== 18) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message.projectId = reader.string();
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
reader.skip(tag & 7);
|
|
104
|
+
}
|
|
105
|
+
return message;
|
|
106
|
+
} finally {
|
|
107
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
fromJSON(object: any): ListModelsRequest {
|
|
112
|
+
return {
|
|
113
|
+
organizationId: isSet(object.organizationId)
|
|
114
|
+
? globalThis.String(object.organizationId)
|
|
115
|
+
: isSet(object.organization_id)
|
|
116
|
+
? globalThis.String(object.organization_id)
|
|
117
|
+
: "",
|
|
118
|
+
projectId: isSet(object.projectId)
|
|
119
|
+
? globalThis.String(object.projectId)
|
|
120
|
+
: isSet(object.project_id)
|
|
121
|
+
? globalThis.String(object.project_id)
|
|
122
|
+
: "",
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
toJSON(message: ListModelsRequest): unknown {
|
|
127
|
+
const obj: any = {};
|
|
128
|
+
if (message.organizationId !== "") {
|
|
129
|
+
obj.organizationId = message.organizationId;
|
|
130
|
+
}
|
|
131
|
+
if (message.projectId !== "") {
|
|
132
|
+
obj.projectId = message.projectId;
|
|
133
|
+
}
|
|
134
|
+
return obj;
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
create<I extends Exact<DeepPartial<ListModelsRequest>, I>>(base?: I): ListModelsRequest {
|
|
138
|
+
return ListModelsRequest.fromPartial(base ?? ({} as any));
|
|
139
|
+
},
|
|
140
|
+
fromPartial<I extends Exact<DeepPartial<ListModelsRequest>, I>>(object: I): ListModelsRequest {
|
|
141
|
+
const message = createBaseListModelsRequest();
|
|
142
|
+
message.organizationId = object.organizationId ?? "";
|
|
143
|
+
message.projectId = object.projectId ?? "";
|
|
144
|
+
return message;
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
function createBaseListModelsResponse(): ListModelsResponse {
|
|
149
|
+
return { status: undefined, models: [] };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export const ListModelsResponse: MessageFns<ListModelsResponse> = {
|
|
153
|
+
encode(message: ListModelsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
154
|
+
if (message.status !== undefined) {
|
|
155
|
+
ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
|
|
156
|
+
}
|
|
157
|
+
for (const v of message.models) {
|
|
158
|
+
writer.uint32(18).string(v!);
|
|
159
|
+
}
|
|
160
|
+
return writer;
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListModelsResponse {
|
|
164
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
165
|
+
const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
|
|
166
|
+
if (previousRecursionDepth >= 100) {
|
|
167
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
168
|
+
}
|
|
169
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
170
|
+
try {
|
|
171
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
172
|
+
const message = createBaseListModelsResponse();
|
|
173
|
+
while (reader.pos < end) {
|
|
174
|
+
const tag = reader.uint32();
|
|
175
|
+
switch (tag >>> 3) {
|
|
176
|
+
case 1: {
|
|
177
|
+
if (tag !== 10) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
message.status = ResponseStatus.decode(reader, reader.uint32());
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
case 2: {
|
|
185
|
+
if (tag !== 18) {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
message.models.push(reader.string());
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
reader.skip(tag & 7);
|
|
197
|
+
}
|
|
198
|
+
return message;
|
|
199
|
+
} finally {
|
|
200
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
fromJSON(object: any): ListModelsResponse {
|
|
205
|
+
return {
|
|
206
|
+
status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
|
|
207
|
+
models: globalThis.Array.isArray(object?.models) ? object.models.map((e: any) => globalThis.String(e)) : [],
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
toJSON(message: ListModelsResponse): unknown {
|
|
212
|
+
const obj: any = {};
|
|
213
|
+
if (message.status !== undefined) {
|
|
214
|
+
obj.status = ResponseStatus.toJSON(message.status);
|
|
215
|
+
}
|
|
216
|
+
if (message.models?.length) {
|
|
217
|
+
obj.models = message.models;
|
|
218
|
+
}
|
|
219
|
+
return obj;
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
create<I extends Exact<DeepPartial<ListModelsResponse>, I>>(base?: I): ListModelsResponse {
|
|
223
|
+
return ListModelsResponse.fromPartial(base ?? ({} as any));
|
|
224
|
+
},
|
|
225
|
+
fromPartial<I extends Exact<DeepPartial<ListModelsResponse>, I>>(object: I): ListModelsResponse {
|
|
226
|
+
const message = createBaseListModelsResponse();
|
|
227
|
+
message.status = (object.status !== undefined && object.status !== null)
|
|
228
|
+
? ResponseStatus.fromPartial(object.status)
|
|
229
|
+
: undefined;
|
|
230
|
+
message.models = object.models?.map((e) => e) || [];
|
|
231
|
+
return message;
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
function createBaseModelPricesRequest(): ModelPricesRequest {
|
|
236
|
+
return { organizationId: "", projectId: "", model: "" };
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export const ModelPricesRequest: MessageFns<ModelPricesRequest> = {
|
|
240
|
+
encode(message: ModelPricesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
241
|
+
if (message.organizationId !== "") {
|
|
242
|
+
writer.uint32(10).string(message.organizationId);
|
|
243
|
+
}
|
|
244
|
+
if (message.projectId !== "") {
|
|
245
|
+
writer.uint32(18).string(message.projectId);
|
|
246
|
+
}
|
|
247
|
+
if (message.model !== "") {
|
|
248
|
+
writer.uint32(26).string(message.model);
|
|
249
|
+
}
|
|
250
|
+
return writer;
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ModelPricesRequest {
|
|
254
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
255
|
+
const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
|
|
256
|
+
if (previousRecursionDepth >= 100) {
|
|
257
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
258
|
+
}
|
|
259
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
260
|
+
try {
|
|
261
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
262
|
+
const message = createBaseModelPricesRequest();
|
|
263
|
+
while (reader.pos < end) {
|
|
264
|
+
const tag = reader.uint32();
|
|
265
|
+
switch (tag >>> 3) {
|
|
266
|
+
case 1: {
|
|
267
|
+
if (tag !== 10) {
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
message.organizationId = reader.string();
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
case 2: {
|
|
275
|
+
if (tag !== 18) {
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
message.projectId = reader.string();
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
case 3: {
|
|
283
|
+
if (tag !== 26) {
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
message.model = reader.string();
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
reader.skip(tag & 7);
|
|
295
|
+
}
|
|
296
|
+
return message;
|
|
297
|
+
} finally {
|
|
298
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
fromJSON(object: any): ModelPricesRequest {
|
|
303
|
+
return {
|
|
304
|
+
organizationId: isSet(object.organizationId)
|
|
305
|
+
? globalThis.String(object.organizationId)
|
|
306
|
+
: isSet(object.organization_id)
|
|
307
|
+
? globalThis.String(object.organization_id)
|
|
308
|
+
: "",
|
|
309
|
+
projectId: isSet(object.projectId)
|
|
310
|
+
? globalThis.String(object.projectId)
|
|
311
|
+
: isSet(object.project_id)
|
|
312
|
+
? globalThis.String(object.project_id)
|
|
313
|
+
: "",
|
|
314
|
+
model: isSet(object.model) ? globalThis.String(object.model) : "",
|
|
315
|
+
};
|
|
316
|
+
},
|
|
317
|
+
|
|
318
|
+
toJSON(message: ModelPricesRequest): unknown {
|
|
319
|
+
const obj: any = {};
|
|
320
|
+
if (message.organizationId !== "") {
|
|
321
|
+
obj.organizationId = message.organizationId;
|
|
322
|
+
}
|
|
323
|
+
if (message.projectId !== "") {
|
|
324
|
+
obj.projectId = message.projectId;
|
|
325
|
+
}
|
|
326
|
+
if (message.model !== "") {
|
|
327
|
+
obj.model = message.model;
|
|
328
|
+
}
|
|
329
|
+
return obj;
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
create<I extends Exact<DeepPartial<ModelPricesRequest>, I>>(base?: I): ModelPricesRequest {
|
|
333
|
+
return ModelPricesRequest.fromPartial(base ?? ({} as any));
|
|
334
|
+
},
|
|
335
|
+
fromPartial<I extends Exact<DeepPartial<ModelPricesRequest>, I>>(object: I): ModelPricesRequest {
|
|
336
|
+
const message = createBaseModelPricesRequest();
|
|
337
|
+
message.organizationId = object.organizationId ?? "";
|
|
338
|
+
message.projectId = object.projectId ?? "";
|
|
339
|
+
message.model = object.model ?? "";
|
|
340
|
+
return message;
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
function createBaseModelPricesResponse(): ModelPricesResponse {
|
|
345
|
+
return { status: undefined, prices: [] };
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export const ModelPricesResponse: MessageFns<ModelPricesResponse> = {
|
|
349
|
+
encode(message: ModelPricesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
350
|
+
if (message.status !== undefined) {
|
|
351
|
+
ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
|
|
352
|
+
}
|
|
353
|
+
for (const v of message.prices) {
|
|
354
|
+
ModelPrice.encode(v!, writer.uint32(18).fork()).join();
|
|
355
|
+
}
|
|
356
|
+
return writer;
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ModelPricesResponse {
|
|
360
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
361
|
+
const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
|
|
362
|
+
if (previousRecursionDepth >= 100) {
|
|
363
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
364
|
+
}
|
|
365
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
366
|
+
try {
|
|
367
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
368
|
+
const message = createBaseModelPricesResponse();
|
|
369
|
+
while (reader.pos < end) {
|
|
370
|
+
const tag = reader.uint32();
|
|
371
|
+
switch (tag >>> 3) {
|
|
372
|
+
case 1: {
|
|
373
|
+
if (tag !== 10) {
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
message.status = ResponseStatus.decode(reader, reader.uint32());
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
case 2: {
|
|
381
|
+
if (tag !== 18) {
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
message.prices.push(ModelPrice.decode(reader, reader.uint32()));
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
reader.skip(tag & 7);
|
|
393
|
+
}
|
|
394
|
+
return message;
|
|
395
|
+
} finally {
|
|
396
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
|
|
400
|
+
fromJSON(object: any): ModelPricesResponse {
|
|
401
|
+
return {
|
|
402
|
+
status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
|
|
403
|
+
prices: globalThis.Array.isArray(object?.prices) ? object.prices.map((e: any) => ModelPrice.fromJSON(e)) : [],
|
|
404
|
+
};
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
toJSON(message: ModelPricesResponse): unknown {
|
|
408
|
+
const obj: any = {};
|
|
409
|
+
if (message.status !== undefined) {
|
|
410
|
+
obj.status = ResponseStatus.toJSON(message.status);
|
|
411
|
+
}
|
|
412
|
+
if (message.prices?.length) {
|
|
413
|
+
obj.prices = message.prices.map((e) => ModelPrice.toJSON(e));
|
|
414
|
+
}
|
|
415
|
+
return obj;
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
create<I extends Exact<DeepPartial<ModelPricesResponse>, I>>(base?: I): ModelPricesResponse {
|
|
419
|
+
return ModelPricesResponse.fromPartial(base ?? ({} as any));
|
|
420
|
+
},
|
|
421
|
+
fromPartial<I extends Exact<DeepPartial<ModelPricesResponse>, I>>(object: I): ModelPricesResponse {
|
|
422
|
+
const message = createBaseModelPricesResponse();
|
|
423
|
+
message.status = (object.status !== undefined && object.status !== null)
|
|
424
|
+
? ResponseStatus.fromPartial(object.status)
|
|
425
|
+
: undefined;
|
|
426
|
+
message.prices = object.prices?.map((e) => ModelPrice.fromPartial(e)) || [];
|
|
427
|
+
return message;
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
function createBaseModelPrice(): ModelPrice {
|
|
432
|
+
return {
|
|
433
|
+
source: "",
|
|
434
|
+
provider: "",
|
|
435
|
+
model: "",
|
|
436
|
+
scrapedAt: undefined,
|
|
437
|
+
inputUsdPerMtok: 0,
|
|
438
|
+
outputUsdPerMtok: 0,
|
|
439
|
+
cacheReadUsdPerMtok: 0,
|
|
440
|
+
cacheWriteUsdPerMtok: 0,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export const ModelPrice: MessageFns<ModelPrice> = {
|
|
445
|
+
encode(message: ModelPrice, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
446
|
+
if (message.source !== "") {
|
|
447
|
+
writer.uint32(10).string(message.source);
|
|
448
|
+
}
|
|
449
|
+
if (message.provider !== "") {
|
|
450
|
+
writer.uint32(18).string(message.provider);
|
|
451
|
+
}
|
|
452
|
+
if (message.model !== "") {
|
|
453
|
+
writer.uint32(26).string(message.model);
|
|
454
|
+
}
|
|
455
|
+
if (message.scrapedAt !== undefined) {
|
|
456
|
+
Timestamp.encode(toTimestamp(message.scrapedAt), writer.uint32(34).fork()).join();
|
|
457
|
+
}
|
|
458
|
+
if (message.inputUsdPerMtok !== 0) {
|
|
459
|
+
writer.uint32(41).double(message.inputUsdPerMtok);
|
|
460
|
+
}
|
|
461
|
+
if (message.outputUsdPerMtok !== 0) {
|
|
462
|
+
writer.uint32(49).double(message.outputUsdPerMtok);
|
|
463
|
+
}
|
|
464
|
+
if (message.cacheReadUsdPerMtok !== 0) {
|
|
465
|
+
writer.uint32(57).double(message.cacheReadUsdPerMtok);
|
|
466
|
+
}
|
|
467
|
+
if (message.cacheWriteUsdPerMtok !== 0) {
|
|
468
|
+
writer.uint32(65).double(message.cacheWriteUsdPerMtok);
|
|
469
|
+
}
|
|
470
|
+
return writer;
|
|
471
|
+
},
|
|
472
|
+
|
|
473
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ModelPrice {
|
|
474
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
475
|
+
const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
|
|
476
|
+
if (previousRecursionDepth >= 100) {
|
|
477
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
478
|
+
}
|
|
479
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
480
|
+
try {
|
|
481
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
482
|
+
const message = createBaseModelPrice();
|
|
483
|
+
while (reader.pos < end) {
|
|
484
|
+
const tag = reader.uint32();
|
|
485
|
+
switch (tag >>> 3) {
|
|
486
|
+
case 1: {
|
|
487
|
+
if (tag !== 10) {
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
message.source = reader.string();
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
case 2: {
|
|
495
|
+
if (tag !== 18) {
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
message.provider = reader.string();
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
case 3: {
|
|
503
|
+
if (tag !== 26) {
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
message.model = reader.string();
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
case 4: {
|
|
511
|
+
if (tag !== 34) {
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
message.scrapedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
case 5: {
|
|
519
|
+
if (tag !== 41) {
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
message.inputUsdPerMtok = reader.double();
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
case 6: {
|
|
527
|
+
if (tag !== 49) {
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
message.outputUsdPerMtok = reader.double();
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
case 7: {
|
|
535
|
+
if (tag !== 57) {
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
message.cacheReadUsdPerMtok = reader.double();
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
case 8: {
|
|
543
|
+
if (tag !== 65) {
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
message.cacheWriteUsdPerMtok = reader.double();
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
reader.skip(tag & 7);
|
|
555
|
+
}
|
|
556
|
+
return message;
|
|
557
|
+
} finally {
|
|
558
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
|
|
562
|
+
fromJSON(object: any): ModelPrice {
|
|
563
|
+
return {
|
|
564
|
+
source: isSet(object.source) ? globalThis.String(object.source) : "",
|
|
565
|
+
provider: isSet(object.provider) ? globalThis.String(object.provider) : "",
|
|
566
|
+
model: isSet(object.model) ? globalThis.String(object.model) : "",
|
|
567
|
+
scrapedAt: isSet(object.scrapedAt)
|
|
568
|
+
? fromJsonTimestamp(object.scrapedAt)
|
|
569
|
+
: isSet(object.scraped_at)
|
|
570
|
+
? fromJsonTimestamp(object.scraped_at)
|
|
571
|
+
: undefined,
|
|
572
|
+
inputUsdPerMtok: isSet(object.inputUsdPerMtok)
|
|
573
|
+
? globalThis.Number(object.inputUsdPerMtok)
|
|
574
|
+
: isSet(object.input_usd_per_mtok)
|
|
575
|
+
? globalThis.Number(object.input_usd_per_mtok)
|
|
576
|
+
: 0,
|
|
577
|
+
outputUsdPerMtok: isSet(object.outputUsdPerMtok)
|
|
578
|
+
? globalThis.Number(object.outputUsdPerMtok)
|
|
579
|
+
: isSet(object.output_usd_per_mtok)
|
|
580
|
+
? globalThis.Number(object.output_usd_per_mtok)
|
|
581
|
+
: 0,
|
|
582
|
+
cacheReadUsdPerMtok: isSet(object.cacheReadUsdPerMtok)
|
|
583
|
+
? globalThis.Number(object.cacheReadUsdPerMtok)
|
|
584
|
+
: isSet(object.cache_read_usd_per_mtok)
|
|
585
|
+
? globalThis.Number(object.cache_read_usd_per_mtok)
|
|
586
|
+
: 0,
|
|
587
|
+
cacheWriteUsdPerMtok: isSet(object.cacheWriteUsdPerMtok)
|
|
588
|
+
? globalThis.Number(object.cacheWriteUsdPerMtok)
|
|
589
|
+
: isSet(object.cache_write_usd_per_mtok)
|
|
590
|
+
? globalThis.Number(object.cache_write_usd_per_mtok)
|
|
591
|
+
: 0,
|
|
592
|
+
};
|
|
593
|
+
},
|
|
594
|
+
|
|
595
|
+
toJSON(message: ModelPrice): unknown {
|
|
596
|
+
const obj: any = {};
|
|
597
|
+
if (message.source !== "") {
|
|
598
|
+
obj.source = message.source;
|
|
599
|
+
}
|
|
600
|
+
if (message.provider !== "") {
|
|
601
|
+
obj.provider = message.provider;
|
|
602
|
+
}
|
|
603
|
+
if (message.model !== "") {
|
|
604
|
+
obj.model = message.model;
|
|
605
|
+
}
|
|
606
|
+
if (message.scrapedAt !== undefined) {
|
|
607
|
+
obj.scrapedAt = message.scrapedAt.toISOString();
|
|
608
|
+
}
|
|
609
|
+
if (message.inputUsdPerMtok !== 0) {
|
|
610
|
+
obj.inputUsdPerMtok = message.inputUsdPerMtok;
|
|
611
|
+
}
|
|
612
|
+
if (message.outputUsdPerMtok !== 0) {
|
|
613
|
+
obj.outputUsdPerMtok = message.outputUsdPerMtok;
|
|
614
|
+
}
|
|
615
|
+
if (message.cacheReadUsdPerMtok !== 0) {
|
|
616
|
+
obj.cacheReadUsdPerMtok = message.cacheReadUsdPerMtok;
|
|
617
|
+
}
|
|
618
|
+
if (message.cacheWriteUsdPerMtok !== 0) {
|
|
619
|
+
obj.cacheWriteUsdPerMtok = message.cacheWriteUsdPerMtok;
|
|
620
|
+
}
|
|
621
|
+
return obj;
|
|
622
|
+
},
|
|
623
|
+
|
|
624
|
+
create<I extends Exact<DeepPartial<ModelPrice>, I>>(base?: I): ModelPrice {
|
|
625
|
+
return ModelPrice.fromPartial(base ?? ({} as any));
|
|
626
|
+
},
|
|
627
|
+
fromPartial<I extends Exact<DeepPartial<ModelPrice>, I>>(object: I): ModelPrice {
|
|
628
|
+
const message = createBaseModelPrice();
|
|
629
|
+
message.source = object.source ?? "";
|
|
630
|
+
message.provider = object.provider ?? "";
|
|
631
|
+
message.model = object.model ?? "";
|
|
632
|
+
message.scrapedAt = object.scrapedAt ?? undefined;
|
|
633
|
+
message.inputUsdPerMtok = object.inputUsdPerMtok ?? 0;
|
|
634
|
+
message.outputUsdPerMtok = object.outputUsdPerMtok ?? 0;
|
|
635
|
+
message.cacheReadUsdPerMtok = object.cacheReadUsdPerMtok ?? 0;
|
|
636
|
+
message.cacheWriteUsdPerMtok = object.cacheWriteUsdPerMtok ?? 0;
|
|
637
|
+
return message;
|
|
638
|
+
},
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* ModelGatewayService is the frontend-facing surface for the AI model catalog + pricing. The dataset is
|
|
643
|
+
* global reference data (scraped list prices), so the caller is authorized but the data is not
|
|
644
|
+
* tenant-filtered. It proxies telemetry.api.v1.AIService's model reads.
|
|
645
|
+
*/
|
|
646
|
+
export interface ModelGatewayService {
|
|
647
|
+
/**
|
|
648
|
+
* ListModels returns a lightweight, deduplicated, sorted list of model names across all price sources.
|
|
649
|
+
* The frontend loads it once and filters the search bar client-side.
|
|
650
|
+
*/
|
|
651
|
+
ListModels(request: ListModelsRequest, metadata?: Metadata): Promise<ListModelsResponse>;
|
|
652
|
+
/** ListModelPrices returns the latest price per provider for one model, source-collapsed on the backend. */
|
|
653
|
+
ListModelPrices(request: ModelPricesRequest, metadata?: Metadata): Promise<ModelPricesResponse>;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export const ModelGatewayServiceServiceName = "gateway.web.v1.ModelGatewayService";
|
|
657
|
+
export class ModelGatewayServiceClientImpl implements ModelGatewayService {
|
|
658
|
+
private readonly rpc: Rpc;
|
|
659
|
+
private readonly service: string;
|
|
660
|
+
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
661
|
+
this.service = opts?.service || ModelGatewayServiceServiceName;
|
|
662
|
+
this.rpc = rpc;
|
|
663
|
+
this.ListModels = this.ListModels.bind(this);
|
|
664
|
+
this.ListModelPrices = this.ListModelPrices.bind(this);
|
|
665
|
+
}
|
|
666
|
+
ListModels(request: ListModelsRequest, metadata?: Metadata): Promise<ListModelsResponse> {
|
|
667
|
+
const data = ListModelsRequest.encode(request).finish();
|
|
668
|
+
const promise = this.rpc.request(this.service, "ListModels", data, metadata);
|
|
669
|
+
return promise.then((data) => ListModelsResponse.decode(new BinaryReader(data)));
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
ListModelPrices(request: ModelPricesRequest, metadata?: Metadata): Promise<ModelPricesResponse> {
|
|
673
|
+
const data = ModelPricesRequest.encode(request).finish();
|
|
674
|
+
const promise = this.rpc.request(this.service, "ListModelPrices", data, metadata);
|
|
675
|
+
return promise.then((data) => ModelPricesResponse.decode(new BinaryReader(data)));
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
interface Rpc {
|
|
680
|
+
request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
684
|
+
|
|
685
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
686
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
687
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
688
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
689
|
+
: Partial<T>;
|
|
690
|
+
|
|
691
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
692
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
693
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
694
|
+
|
|
695
|
+
function toTimestamp(date: Date): Timestamp {
|
|
696
|
+
const seconds = Math.trunc(date.getTime() / 1_000);
|
|
697
|
+
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
698
|
+
return { seconds, nanos };
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function fromTimestamp(t: Timestamp): Date {
|
|
702
|
+
let millis = (t.seconds || 0) * 1_000;
|
|
703
|
+
millis += (t.nanos || 0) / 1_000_000;
|
|
704
|
+
return new globalThis.Date(millis);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function fromJsonTimestamp(o: any): Date {
|
|
708
|
+
if (o instanceof globalThis.Date) {
|
|
709
|
+
return o;
|
|
710
|
+
} else if (typeof o === "string") {
|
|
711
|
+
return new globalThis.Date(o);
|
|
712
|
+
} else {
|
|
713
|
+
return fromTimestamp(Timestamp.fromJSON(o));
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function isSet(value: any): boolean {
|
|
718
|
+
return value !== null && value !== undefined;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export interface MessageFns<T> {
|
|
722
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
723
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
724
|
+
fromJSON(object: any): T;
|
|
725
|
+
toJSON(message: T): unknown;
|
|
726
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
727
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
728
|
+
}
|