@flop-labs/contracts 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,725 @@
1
+ // Generated from services/rest-gateway/openapi.yaml. Run pnpm --filter @flop-labs/contracts generate.
2
+ const definitions = {
3
+ "Model": {
4
+ "type": "object",
5
+ "required": [
6
+ "id",
7
+ "canonical_slug",
8
+ "name",
9
+ "created",
10
+ "context_length",
11
+ "architecture",
12
+ "pricing",
13
+ "top_provider",
14
+ "supported_parameters"
15
+ ],
16
+ "properties": {
17
+ "id": {
18
+ "type": "string"
19
+ },
20
+ "canonical_slug": {
21
+ "type": "string"
22
+ },
23
+ "name": {
24
+ "type": "string"
25
+ },
26
+ "created": {
27
+ "type": "integer"
28
+ },
29
+ "description": {
30
+ "type": "string"
31
+ },
32
+ "context_length": {
33
+ "type": "integer"
34
+ },
35
+ "architecture": {
36
+ "type": "object",
37
+ "required": [
38
+ "input_modalities",
39
+ "output_modalities"
40
+ ],
41
+ "properties": {
42
+ "input_modalities": {
43
+ "type": "array",
44
+ "items": {
45
+ "type": "string"
46
+ }
47
+ },
48
+ "output_modalities": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string"
52
+ }
53
+ },
54
+ "tokenizer": {
55
+ "type": "string"
56
+ },
57
+ "instruct_type": {
58
+ "type": [
59
+ "string",
60
+ "null"
61
+ ]
62
+ }
63
+ }
64
+ },
65
+ "pricing": {
66
+ "type": "object",
67
+ "required": [
68
+ "prompt",
69
+ "completion"
70
+ ],
71
+ "properties": {
72
+ "prompt": {
73
+ "type": "string"
74
+ },
75
+ "completion": {
76
+ "type": "string"
77
+ },
78
+ "request": {
79
+ "type": "string"
80
+ },
81
+ "image": {
82
+ "type": "string"
83
+ },
84
+ "input_cache_read": {
85
+ "type": "string"
86
+ },
87
+ "internal_reasoning": {
88
+ "type": "string"
89
+ }
90
+ }
91
+ },
92
+ "top_provider": {
93
+ "type": "object",
94
+ "required": [
95
+ "context_length",
96
+ "max_completion_tokens",
97
+ "is_moderated"
98
+ ],
99
+ "properties": {
100
+ "context_length": {
101
+ "type": "integer"
102
+ },
103
+ "max_completion_tokens": {
104
+ "type": "integer"
105
+ },
106
+ "is_moderated": {
107
+ "type": "boolean"
108
+ }
109
+ }
110
+ },
111
+ "supported_parameters": {
112
+ "type": "array",
113
+ "items": {
114
+ "type": "string"
115
+ }
116
+ }
117
+ }
118
+ },
119
+ "ModelList": {
120
+ "type": "object",
121
+ "required": [
122
+ "data",
123
+ "total_count",
124
+ "links"
125
+ ],
126
+ "properties": {
127
+ "data": {
128
+ "type": "array",
129
+ "items": {
130
+ "$ref": "#/$defs/Model"
131
+ }
132
+ },
133
+ "total_count": {
134
+ "type": "integer"
135
+ },
136
+ "links": {
137
+ "type": "object",
138
+ "required": [
139
+ "next"
140
+ ],
141
+ "properties": {
142
+ "next": {
143
+ "type": [
144
+ "string",
145
+ "null"
146
+ ]
147
+ }
148
+ }
149
+ }
150
+ }
151
+ },
152
+ "ChatCompletionRequest": {
153
+ "type": "object",
154
+ "dependentRequired": {
155
+ "max_wait_ms": [
156
+ "max_cost_flop"
157
+ ]
158
+ },
159
+ "required": [
160
+ "model",
161
+ "messages"
162
+ ],
163
+ "additionalProperties": false,
164
+ "properties": {
165
+ "model": {
166
+ "type": "string"
167
+ },
168
+ "messages": {
169
+ "type": "array",
170
+ "minItems": 1,
171
+ "items": {
172
+ "type": "object",
173
+ "required": [
174
+ "role",
175
+ "content"
176
+ ],
177
+ "properties": {
178
+ "role": {
179
+ "type": "string",
180
+ "enum": [
181
+ "developer",
182
+ "system",
183
+ "user",
184
+ "assistant",
185
+ "tool"
186
+ ]
187
+ },
188
+ "content": {
189
+ "oneOf": [
190
+ {
191
+ "type": "string"
192
+ },
193
+ {
194
+ "type": "null"
195
+ },
196
+ {
197
+ "type": "array",
198
+ "items": {
199
+ "type": "object"
200
+ }
201
+ }
202
+ ],
203
+ "description": "Structured parts are preserved; modalities are capability-gated."
204
+ }
205
+ }
206
+ }
207
+ },
208
+ "max_tokens": {
209
+ "type": "integer",
210
+ "default": 256
211
+ },
212
+ "temperature": {
213
+ "type": "number",
214
+ "default": 0.7
215
+ },
216
+ "top_p": {
217
+ "type": "number"
218
+ },
219
+ "seed": {
220
+ "type": "integer"
221
+ },
222
+ "stop": {
223
+ "oneOf": [
224
+ {
225
+ "type": "string"
226
+ },
227
+ {
228
+ "type": "array",
229
+ "items": {
230
+ "type": "string"
231
+ }
232
+ }
233
+ ]
234
+ },
235
+ "presence_penalty": {
236
+ "type": "number"
237
+ },
238
+ "frequency_penalty": {
239
+ "type": "number"
240
+ },
241
+ "logit_bias": {
242
+ "type": "object",
243
+ "additionalProperties": {
244
+ "type": "number"
245
+ }
246
+ },
247
+ "tools": {
248
+ "type": "array",
249
+ "items": {
250
+ "type": "object"
251
+ }
252
+ },
253
+ "tool_choice": {},
254
+ "parallel_tool_calls": {
255
+ "type": "boolean"
256
+ },
257
+ "response_format": {
258
+ "type": "object"
259
+ },
260
+ "stream": {
261
+ "type": "boolean",
262
+ "default": false
263
+ },
264
+ "stream_options": {
265
+ "type": "object",
266
+ "properties": {
267
+ "include_usage": {
268
+ "const": true
269
+ }
270
+ },
271
+ "required": [
272
+ "include_usage"
273
+ ],
274
+ "additionalProperties": false
275
+ },
276
+ "max_cost_flop": {
277
+ "type": "number",
278
+ "exclusiveMinimum": 0
279
+ },
280
+ "max_wait_ms": {
281
+ "type": "integer",
282
+ "minimum": 1,
283
+ "maximum": 3600000,
284
+ "description": "Opt-in total wait and execution deadline in milliseconds for public completions. Requires max_cost_flop; no ready worker probe is required."
285
+ }
286
+ }
287
+ },
288
+ "ChatCompletionResponse": {
289
+ "type": "object",
290
+ "required": [
291
+ "id",
292
+ "object",
293
+ "created",
294
+ "model",
295
+ "choices",
296
+ "usage"
297
+ ],
298
+ "properties": {
299
+ "id": {
300
+ "type": "string"
301
+ },
302
+ "object": {
303
+ "type": "string",
304
+ "const": "chat.completion"
305
+ },
306
+ "created": {
307
+ "type": "integer"
308
+ },
309
+ "model": {
310
+ "type": "string"
311
+ },
312
+ "system_fingerprint": {
313
+ "type": [
314
+ "string",
315
+ "null"
316
+ ]
317
+ },
318
+ "choices": {
319
+ "type": "array",
320
+ "items": {
321
+ "type": "object",
322
+ "required": [
323
+ "index",
324
+ "message",
325
+ "finish_reason"
326
+ ],
327
+ "properties": {
328
+ "index": {
329
+ "type": "integer"
330
+ },
331
+ "message": {
332
+ "type": "object",
333
+ "required": [
334
+ "role",
335
+ "content"
336
+ ],
337
+ "properties": {
338
+ "role": {
339
+ "type": "string",
340
+ "const": "assistant"
341
+ },
342
+ "content": {
343
+ "type": [
344
+ "string",
345
+ "null"
346
+ ]
347
+ }
348
+ }
349
+ },
350
+ "finish_reason": {
351
+ "type": "string"
352
+ }
353
+ }
354
+ }
355
+ },
356
+ "usage": {
357
+ "type": "object",
358
+ "required": [
359
+ "prompt_tokens",
360
+ "completion_tokens",
361
+ "total_tokens"
362
+ ],
363
+ "properties": {
364
+ "prompt_tokens": {
365
+ "type": "integer"
366
+ },
367
+ "completion_tokens": {
368
+ "type": "integer"
369
+ },
370
+ "total_tokens": {
371
+ "type": "integer"
372
+ },
373
+ "gflops_used": {
374
+ "type": "number"
375
+ },
376
+ "cost_flop": {
377
+ "type": "number"
378
+ }
379
+ }
380
+ }
381
+ }
382
+ },
383
+ "ChatCompletionChunk": {
384
+ "type": "object",
385
+ "required": [
386
+ "id",
387
+ "object",
388
+ "created",
389
+ "model",
390
+ "choices"
391
+ ],
392
+ "description": "One decoded SSE JSON payload. All chunks share id, model and created.\nThe first delta is role assistant with empty content. Content precedes\ntool calls; the gateway currently emits all calls in one delta after\nsettlement. A finish delta is empty with a non-null finish_reason.\nSuccess always includes one final choices-empty usage/receipt chunk,\nregardless of stream_options, followed by the literal [DONE].\nA finish_reason of error instead requires a stream error then [DONE].\n",
393
+ "properties": {
394
+ "id": {
395
+ "type": "string",
396
+ "pattern": "[\\s\\S]"
397
+ },
398
+ "object": {
399
+ "type": "string",
400
+ "const": "chat.completion.chunk"
401
+ },
402
+ "created": {
403
+ "type": "integer"
404
+ },
405
+ "model": {
406
+ "type": "string",
407
+ "pattern": "[\\s\\S]"
408
+ },
409
+ "choices": {
410
+ "type": "array",
411
+ "maxItems": 1,
412
+ "items": {
413
+ "type": "object",
414
+ "required": [
415
+ "index",
416
+ "delta",
417
+ "finish_reason"
418
+ ],
419
+ "properties": {
420
+ "index": {
421
+ "type": "integer",
422
+ "const": 0
423
+ },
424
+ "delta": {
425
+ "type": "object",
426
+ "additionalProperties": false,
427
+ "properties": {
428
+ "role": {
429
+ "type": "string",
430
+ "const": "assistant"
431
+ },
432
+ "content": {
433
+ "type": "string"
434
+ },
435
+ "tool_calls": {
436
+ "type": "array",
437
+ "minItems": 1,
438
+ "items": {
439
+ "$ref": "#/$defs/ChatCompletionToolCallFragment"
440
+ }
441
+ }
442
+ }
443
+ },
444
+ "finish_reason": {
445
+ "type": [
446
+ "string",
447
+ "null"
448
+ ],
449
+ "pattern": "[\\s\\S]"
450
+ }
451
+ }
452
+ }
453
+ },
454
+ "usage": {
455
+ "$ref": "#/$defs/ChatCompletionStreamUsage"
456
+ },
457
+ "x_flop_receipt": {
458
+ "type": "object",
459
+ "description": "Gateway-reported receipt data, without independent verification."
460
+ }
461
+ },
462
+ "oneOf": [
463
+ {
464
+ "properties": {
465
+ "choices": {
466
+ "type": "array",
467
+ "minItems": 1
468
+ },
469
+ "usage": false,
470
+ "x_flop_receipt": false
471
+ }
472
+ },
473
+ {
474
+ "required": [
475
+ "usage",
476
+ "x_flop_receipt"
477
+ ],
478
+ "properties": {
479
+ "choices": {
480
+ "type": "array",
481
+ "maxItems": 0
482
+ },
483
+ "usage": {
484
+ "$ref": "#/$defs/ChatCompletionStreamUsage"
485
+ },
486
+ "x_flop_receipt": {
487
+ "type": "object"
488
+ }
489
+ }
490
+ }
491
+ ]
492
+ },
493
+ "ChatCompletionToolCallFragment": {
494
+ "type": "object",
495
+ "required": [
496
+ "index"
497
+ ],
498
+ "description": "Index selects a call. Its first fragment supplies id and type function;\nsubsequent id/type values must agree. Concatenate function.name and\nfunction.arguments fragments in arrival order for that index. Completed\ncalls require a nonempty name and an arguments string. The gateway today\nsends complete calls in one frame; clients may also assemble fragments.\n",
499
+ "properties": {
500
+ "index": {
501
+ "type": "integer",
502
+ "minimum": 0
503
+ },
504
+ "id": {
505
+ "type": "string",
506
+ "pattern": "[\\s\\S]"
507
+ },
508
+ "type": {
509
+ "type": "string",
510
+ "const": "function"
511
+ },
512
+ "function": {
513
+ "type": "object",
514
+ "additionalProperties": false,
515
+ "properties": {
516
+ "name": {
517
+ "type": "string"
518
+ },
519
+ "arguments": {
520
+ "type": "string"
521
+ }
522
+ },
523
+ "anyOf": [
524
+ {
525
+ "required": [
526
+ "name"
527
+ ],
528
+ "properties": {
529
+ "name": {}
530
+ }
531
+ },
532
+ {
533
+ "required": [
534
+ "arguments"
535
+ ],
536
+ "properties": {
537
+ "arguments": {}
538
+ }
539
+ }
540
+ ]
541
+ }
542
+ },
543
+ "anyOf": [
544
+ {
545
+ "required": [
546
+ "id"
547
+ ],
548
+ "properties": {
549
+ "id": {}
550
+ }
551
+ },
552
+ {
553
+ "required": [
554
+ "type"
555
+ ],
556
+ "properties": {
557
+ "type": {}
558
+ }
559
+ },
560
+ {
561
+ "required": [
562
+ "function"
563
+ ],
564
+ "properties": {
565
+ "function": {}
566
+ }
567
+ }
568
+ ]
569
+ },
570
+ "ChatCompletionStreamUsage": {
571
+ "type": "object",
572
+ "required": [
573
+ "prompt_tokens",
574
+ "completion_tokens",
575
+ "total_tokens"
576
+ ],
577
+ "properties": {
578
+ "prompt_tokens": {
579
+ "type": "integer",
580
+ "minimum": 0
581
+ },
582
+ "completion_tokens": {
583
+ "type": "integer",
584
+ "minimum": 0
585
+ },
586
+ "total_tokens": {
587
+ "type": "integer",
588
+ "minimum": 0
589
+ }
590
+ }
591
+ },
592
+ "ChatCompletionStreamError": {
593
+ "type": "object",
594
+ "required": [
595
+ "error"
596
+ ],
597
+ "description": "In-band failure following an empty delta with finish_reason error.\nBroker failures carry estimated usage and x_flop_usage_source estimated,\noptionally retry_after (seconds). Expiry/reconciliation at settlement\nmay omit usage. No error frame is a successful usage/receipt outcome.\n",
598
+ "properties": {
599
+ "error": {
600
+ "oneOf": [
601
+ {
602
+ "type": "object",
603
+ "required": [
604
+ "code",
605
+ "message",
606
+ "type"
607
+ ],
608
+ "properties": {
609
+ "code": {
610
+ "type": "string"
611
+ },
612
+ "message": {
613
+ "type": "string"
614
+ },
615
+ "type": {
616
+ "type": "string"
617
+ }
618
+ }
619
+ },
620
+ {
621
+ "type": "string",
622
+ "const": "ephemeral_session_expired"
623
+ }
624
+ ]
625
+ },
626
+ "message": {
627
+ "type": "string"
628
+ },
629
+ "request_id": {
630
+ "type": "string"
631
+ },
632
+ "retry_after": {
633
+ "type": "integer",
634
+ "minimum": 0
635
+ },
636
+ "usage": {
637
+ "$ref": "#/$defs/ChatCompletionStreamUsage"
638
+ },
639
+ "x_flop_usage_source": {
640
+ "type": "string",
641
+ "const": "estimated"
642
+ }
643
+ },
644
+ "dependentRequired": {
645
+ "usage": [
646
+ "x_flop_usage_source"
647
+ ],
648
+ "x_flop_usage_source": [
649
+ "usage"
650
+ ]
651
+ },
652
+ "if": {
653
+ "properties": {
654
+ "error": {
655
+ "type": "string"
656
+ }
657
+ }
658
+ },
659
+ "then": {
660
+ "required": [
661
+ "message"
662
+ ],
663
+ "properties": {
664
+ "message": {}
665
+ }
666
+ }
667
+ },
668
+ "ModelResponse": {
669
+ "type": "object",
670
+ "required": [
671
+ "data"
672
+ ],
673
+ "properties": {
674
+ "data": {
675
+ "$ref": "#/$defs/Model"
676
+ }
677
+ }
678
+ }
679
+ };
680
+ export const ModelSchema = {
681
+ $schema: "https://json-schema.org/draft/2020-12/schema",
682
+ $ref: "#/$defs/Model",
683
+ $defs: definitions,
684
+ };
685
+ export const ModelListSchema = {
686
+ $schema: "https://json-schema.org/draft/2020-12/schema",
687
+ $ref: "#/$defs/ModelList",
688
+ $defs: definitions,
689
+ };
690
+ export const ModelResponseSchema = {
691
+ $schema: "https://json-schema.org/draft/2020-12/schema",
692
+ $ref: "#/$defs/ModelResponse",
693
+ $defs: definitions,
694
+ };
695
+ export const ChatCompletionRequestSchema = {
696
+ $schema: "https://json-schema.org/draft/2020-12/schema",
697
+ $ref: "#/$defs/ChatCompletionRequest",
698
+ $defs: definitions,
699
+ };
700
+ export const ChatCompletionResponseSchema = {
701
+ $schema: "https://json-schema.org/draft/2020-12/schema",
702
+ $ref: "#/$defs/ChatCompletionResponse",
703
+ $defs: definitions,
704
+ };
705
+ export const ChatCompletionChunkSchema = {
706
+ $schema: "https://json-schema.org/draft/2020-12/schema",
707
+ $ref: "#/$defs/ChatCompletionChunk",
708
+ $defs: definitions,
709
+ };
710
+ export const ChatCompletionStreamErrorSchema = {
711
+ $schema: "https://json-schema.org/draft/2020-12/schema",
712
+ $ref: "#/$defs/ChatCompletionStreamError",
713
+ $defs: definitions,
714
+ };
715
+ export const ChatCompletionToolCallFragmentSchema = {
716
+ $schema: "https://json-schema.org/draft/2020-12/schema",
717
+ $ref: "#/$defs/ChatCompletionToolCallFragment",
718
+ $defs: definitions,
719
+ };
720
+ export const ChatCompletionStreamUsageSchema = {
721
+ $schema: "https://json-schema.org/draft/2020-12/schema",
722
+ $ref: "#/$defs/ChatCompletionStreamUsage",
723
+ $defs: definitions,
724
+ };
725
+ //# sourceMappingURL=schemas.js.map