@flop-labs/contracts 0.0.0-stage → 0.1.2

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,858 @@
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
+ "CredentialReceipt": {
669
+ "type": "object",
670
+ "required": [
671
+ "request_id",
672
+ "correlation_id",
673
+ "model",
674
+ "reserved_spend",
675
+ "settled_spend",
676
+ "settled_spend_raw",
677
+ "terminal_event",
678
+ "channel_id",
679
+ "created_at",
680
+ "state",
681
+ "response_status"
682
+ ],
683
+ "properties": {
684
+ "request_id": {
685
+ "$ref": "#/$defs/CredentialReceiptRequestId"
686
+ },
687
+ "correlation_id": {
688
+ "type": "string",
689
+ "description": "Original task/session correlation ID."
690
+ },
691
+ "model": {
692
+ "type": "string"
693
+ },
694
+ "reserved_spend": {
695
+ "type": "number",
696
+ "description": "Original reservation in FLOP, from the legacy floating-point quota ledger; not an exact raw amount."
697
+ },
698
+ "settled_spend": {
699
+ "type": [
700
+ "number",
701
+ "null"
702
+ ],
703
+ "description": "Reconciled spend in FLOP from the legacy floating-point ledger; null means unknown, including released reservations."
704
+ },
705
+ "settled_spend_raw": {
706
+ "type": [
707
+ "string",
708
+ "null"
709
+ ],
710
+ "pattern": "^[0-9]+$",
711
+ "description": "Exact request allocation in raw FLOP base units (10^18 raw units = 1 FLOP) from terminal channel reconciliation; null means unavailable, never an inferred zero."
712
+ },
713
+ "terminal_event": {
714
+ "type": [
715
+ "string",
716
+ "null"
717
+ ],
718
+ "description": "Available terminal channel event ID; a pooled event may cover multiple requests. Not a per-request payment/burn transaction hash."
719
+ },
720
+ "channel_id": {
721
+ "type": [
722
+ "string",
723
+ "null"
724
+ ],
725
+ "description": "Associated compute channel, or null if not yet known."
726
+ },
727
+ "created_at": {
728
+ "type": "integer",
729
+ "description": "Reservation timestamp in Unix epoch milliseconds."
730
+ },
731
+ "state": {
732
+ "type": "string",
733
+ "enum": [
734
+ "reserved",
735
+ "estimated",
736
+ "settled",
737
+ "released"
738
+ ],
739
+ "description": "reserved holds quota with no completion checkpoint; estimated retains the reservation after completion without reconciled actual spend; settled has reconciled spend; released returned the reservation to quota. State does not rewrite cached completion evidence."
740
+ },
741
+ "response_status": {
742
+ "type": [
743
+ "integer",
744
+ "null"
745
+ ],
746
+ "description": "Original cached HTTP response status, or null if no checkpoint was recorded; independent of settlement state."
747
+ }
748
+ }
749
+ },
750
+ "CredentialReceiptRequestId": {
751
+ "type": "string",
752
+ "pattern": "^[\\x21-\\x7e]{1,128}$",
753
+ "not": {
754
+ "enum": [
755
+ ".",
756
+ ".."
757
+ ]
758
+ },
759
+ "description": "1-128 printable ASCII characters without whitespace; dot path segments are invalid."
760
+ },
761
+ "CredentialReceiptError": {
762
+ "type": "object",
763
+ "required": [
764
+ "error",
765
+ "message"
766
+ ],
767
+ "properties": {
768
+ "error": {
769
+ "type": "string",
770
+ "enum": [
771
+ "invalid_request_id",
772
+ "api_key_required",
773
+ "invalid_api_key",
774
+ "api_key_expired",
775
+ "api_key_revoked",
776
+ "ephemeral_token_revoked",
777
+ "ephemeral_session_expired",
778
+ "receipt_not_found"
779
+ ]
780
+ },
781
+ "message": {
782
+ "type": "string"
783
+ }
784
+ }
785
+ },
786
+ "ModelResponse": {
787
+ "type": "object",
788
+ "required": [
789
+ "data"
790
+ ],
791
+ "properties": {
792
+ "data": {
793
+ "$ref": "#/$defs/Model"
794
+ }
795
+ }
796
+ }
797
+ };
798
+ export const ModelSchema = {
799
+ $schema: "https://json-schema.org/draft/2020-12/schema",
800
+ $ref: "#/$defs/Model",
801
+ $defs: definitions,
802
+ };
803
+ export const ModelListSchema = {
804
+ $schema: "https://json-schema.org/draft/2020-12/schema",
805
+ $ref: "#/$defs/ModelList",
806
+ $defs: definitions,
807
+ };
808
+ export const ModelResponseSchema = {
809
+ $schema: "https://json-schema.org/draft/2020-12/schema",
810
+ $ref: "#/$defs/ModelResponse",
811
+ $defs: definitions,
812
+ };
813
+ export const ChatCompletionRequestSchema = {
814
+ $schema: "https://json-schema.org/draft/2020-12/schema",
815
+ $ref: "#/$defs/ChatCompletionRequest",
816
+ $defs: definitions,
817
+ };
818
+ export const ChatCompletionResponseSchema = {
819
+ $schema: "https://json-schema.org/draft/2020-12/schema",
820
+ $ref: "#/$defs/ChatCompletionResponse",
821
+ $defs: definitions,
822
+ };
823
+ export const ChatCompletionChunkSchema = {
824
+ $schema: "https://json-schema.org/draft/2020-12/schema",
825
+ $ref: "#/$defs/ChatCompletionChunk",
826
+ $defs: definitions,
827
+ };
828
+ export const ChatCompletionStreamErrorSchema = {
829
+ $schema: "https://json-schema.org/draft/2020-12/schema",
830
+ $ref: "#/$defs/ChatCompletionStreamError",
831
+ $defs: definitions,
832
+ };
833
+ export const ChatCompletionToolCallFragmentSchema = {
834
+ $schema: "https://json-schema.org/draft/2020-12/schema",
835
+ $ref: "#/$defs/ChatCompletionToolCallFragment",
836
+ $defs: definitions,
837
+ };
838
+ export const ChatCompletionStreamUsageSchema = {
839
+ $schema: "https://json-schema.org/draft/2020-12/schema",
840
+ $ref: "#/$defs/ChatCompletionStreamUsage",
841
+ $defs: definitions,
842
+ };
843
+ export const CredentialReceiptSchema = {
844
+ $schema: "https://json-schema.org/draft/2020-12/schema",
845
+ $ref: "#/$defs/CredentialReceipt",
846
+ $defs: definitions,
847
+ };
848
+ export const CredentialReceiptErrorSchema = {
849
+ $schema: "https://json-schema.org/draft/2020-12/schema",
850
+ $ref: "#/$defs/CredentialReceiptError",
851
+ $defs: definitions,
852
+ };
853
+ export const CredentialReceiptRequestIdSchema = {
854
+ $schema: "https://json-schema.org/draft/2020-12/schema",
855
+ $ref: "#/$defs/CredentialReceiptRequestId",
856
+ $defs: definitions,
857
+ };
858
+ //# sourceMappingURL=schemas.js.map