inference-gateway-sdk 0.18.1

Rust SDK for interacting with various language models through the Inference Gateway
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
---
openapi: 3.1.0
info:
  title: Inference Gateway API
  description: |
    The API for interacting with various language models and other AI services.
    OpenAI, Groq, Ollama, and other providers are supported.
    OpenAI compatible API for using with existing clients.
    Unified API for all providers.
  contact:
    name: Inference Gateway
    url: https://inference-gateway.github.io/docs/
  version: 1.0.0
  license:
    name: Apache-2.0
    url: https://github.com/inference-gateway/inference-gateway/blob/main/LICENSE
servers:
  - url: http://localhost:8080
    description: Default server without version prefix for healthcheck and proxy and points
    x-server-tags:
      - Health
      - Proxy
  - url: http://localhost:8080/v1
    description: Default server with version prefix for listing models and chat completions
    x-server-tags:
      - Models
      - Completions
      - Responses
      - Messages
  - url: https://api.inference-gateway.local/v1
    description: Local server with version prefix for listing models and chat completions
    x-server-tags:
      - Models
      - Completions
      - Responses
tags:
  - name: Models
    description: List and describe the various models available in the API.
  - name: Completions
    description: Generate completions from the models.
  - name: Responses
    description: Generate model responses using the OpenAI-compatible Responses API.
  - name: Messages
    description: Generate messages using the Anthropic-compatible Messages API.
  - name: MCP
    description: List and manage MCP tools.
  - name: Proxy
    description: Proxy requests to provider endpoints.
  - name: Metrics
    description: Push metrics to the gateway (OTLP/HTTP).
  - name: Health
    description: Health check
paths:
  /models:
    get:
      operationId: listModels
      tags:
        - Models
      description: |
        Lists the currently available models, and provides basic information
        about each one such as the owner and availability.
      summary:
        Lists the currently available models, and provides basic information
        about each one such as the owner and availability.
      security:
        - bearerAuth: []
      parameters:
        - name: provider
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/Provider'
          description: Specific provider to query (optional)
        - name: include
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum:
                - context_window
                - pricing
          description: |
            Comma-separated list of metadata keys to include in the response.
            Supported values: `pricing`, `context_window`.
            When omitted, the response remains unchanged (backward compatible).
      responses:
        '200':
          description: List of available models
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListModelsResponse'
              examples:
                allProviders:
                  summary: Models from all providers
                  value:
                    object: 'list'
                    data:
                      - id: 'openai/gpt-4o'
                        object: 'model'
                        created: 1686935002
                        owned_by: 'openai'
                        served_by: 'openai'
                      - id: 'openai/llama-3.3-70b-versatile'
                        object: 'model'
                        created: 1723651281
                        owned_by: 'groq'
                        served_by: 'groq'
                      - id: 'cohere/claude-3-opus-20240229'
                        object: 'model'
                        created: 1708905600
                        owned_by: 'anthropic'
                        served_by: 'anthropic'
                      - id: 'cohere/command-r'
                        object: 'model'
                        created: 1707868800
                        owned_by: 'cohere'
                        served_by: 'cohere'
                      - id: 'ollama/phi3:3.8b'
                        object: 'model'
                        created: 1718441600
                        owned_by: 'ollama'
                        served_by: 'ollama'
                      - id: 'ollama_cloud/gpt-oss:20b'
                        object: 'model'
                        created: 1730419200
                        owned_by: 'ollama_cloud'
                        served_by: 'ollama_cloud'
                      - id: 'mistral/mistral-large-latest'
                        object: 'model'
                        created: 1698019200
                        owned_by: 'mistral'
                        served_by: 'mistral'
                singleProvider:
                  summary: Models from a specific provider
                  value:
                    object: 'list'
                    data:
                      - id: 'openai/gpt-4o'
                        object: 'model'
                        created: 1686935002
                        owned_by: 'openai'
                        served_by: 'openai'
                      - id: 'openai/gpt-4-turbo'
                        object: 'model'
                        created: 1687882410
                        owned_by: 'openai'
                        served_by: 'openai'
                      - id: 'openai/gpt-3.5-turbo'
                        object: 'model'
                        created: 1677649963
                        owned_by: 'openai'
                        served_by: 'openai'
                includePricing:
                  summary: Models with pricing metadata
                  value:
                    object: 'list'
                    data:
                      - id: 'openai/gpt-4o'
                        object: 'model'
                        created: 1686935002
                        owned_by: 'openai'
                        served_by: 'openai'
                        pricing:
                          currency: 'USD'
                          input_per_token: '0.0000025'
                          output_per_token: '0.00001'
                          cache_read_per_token: '0.00000125'
                          cache_write_per_token: '0.0000025'
                          source: 'provider'
                          updated_at: '2025-01-01T00:00:00Z'
                      - id: 'openai/gpt-4-turbo'
                        object: 'model'
                        created: 1687882410
                        owned_by: 'openai'
                        served_by: 'openai'
                        pricing:
                          currency: 'USD'
                          input_per_token: '0.00001'
                          output_per_token: '0.00003'
                          source: 'provider'
                          updated_at: '2025-01-01T00:00:00Z'
                includeContextWindow:
                  summary: Models with context window metadata
                  value:
                    object: 'list'
                    data:
                      - id: 'openai/gpt-4o'
                        object: 'model'
                        created: 1686935002
                        owned_by: 'openai'
                        served_by: 'openai'
                        context_window:
                          tokens: 128000
                          source: 'provider'
                      - id: 'openai/gpt-4-turbo'
                        object: 'model'
                        created: 1687882410
                        owned_by: 'openai'
                        served_by: 'openai'
                        context_window:
                          tokens: 128000
                          source: 'provider'
                includePricingContextWindow:
                  summary: Models with pricing and context window metadata
                  value:
                    object: 'list'
                    data:
                      - id: 'openai/gpt-4o'
                        object: 'model'
                        created: 1686935002
                        owned_by: 'openai'
                        served_by: 'openai'
                        pricing:
                          currency: 'USD'
                          input_per_token: '0.0000025'
                          output_per_token: '0.00001'
                          cache_read_per_token: '0.00000125'
                          cache_write_per_token: '0.0000025'
                          source: 'provider'
                          updated_at: '2025-01-01T00:00:00Z'
                        context_window:
                          tokens: 128000
                          source: 'provider'
                      - id: 'openai/gpt-4-turbo'
                        object: 'model'
                        created: 1687882410
                        owned_by: 'openai'
                        served_by: 'openai'
                        pricing:
                          currency: 'USD'
                          input_per_token: '0.00001'
                          output_per_token: '0.00003'
                          source: 'provider'
                          updated_at: '2025-01-01T00:00:00Z'
                        context_window:
                          tokens: 128000
                          source: 'provider'
        '400':
          description: Bad request - unsupported include value
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: "Unsupported include value: 'unsupported'. Supported values: pricing, context_window"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /chat/completions:
    post:
      operationId: createChatCompletion
      tags:
        - Completions
      description: |
        Generates a chat completion based on the provided input.
        The completion can be streamed to the client as it is generated.
      summary: Create a chat completion
      security:
        - bearerAuth: []
      parameters:
        - name: provider
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/Provider'
          description: Specific provider to use (default determined by model)
      requestBody:
        $ref: '#/components/requestBodies/CreateChatCompletionRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChatCompletionResponse'
            text/event-stream:
              schema:
                description: |
                  Server-Sent Events stream. Each frame is an `SSEvent` whose
                  `data` field contains the JSON-serialized payload for that
                  event. For content/message chunk events the payload is a
                  `CreateChatCompletionStreamResponse`. The `oneOf` here makes
                  the streaming payload schemas reachable from this operation
                  so that code generators emit types for them.
                oneOf:
                  - $ref: '#/components/schemas/SSEvent'
                  - $ref: '#/components/schemas/CreateChatCompletionStreamResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /responses:
    post:
      operationId: createResponse
      tags:
        - Responses
      description: |
        Creates a model response using the OpenAI-compatible Responses API.
        The request accepts either a single text input or a list of input
        items (allowing batched, multi-turn input in one request), and the
        result can be streamed to the client as it is generated.

        Not every provider implements the Responses API. Requests routed to a
        provider that does not support it return `400 Bad Request` with an
        explanatory error message; use `/chat/completions` for those providers.
      summary: Create a model response
      security:
        - bearerAuth: []
      parameters:
        - name: provider
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/Provider'
          description: Specific provider to use (default determined by model)
      requestBody:
        $ref: '#/components/requestBodies/CreateResponseRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response'
            text/event-stream:
              schema:
                description: |
                  Server-Sent Events stream. Each frame is an `SSEvent` whose
                  `data` field contains the JSON-serialized payload for that
                  event. For Responses streaming the payload is a
                  `ResponseStreamEvent`. The `oneOf` here makes the streaming
                  payload schemas reachable from this operation so that code
                  generators emit types for them.
                oneOf:
                  - $ref: '#/components/schemas/SSEvent'
                  - $ref: '#/components/schemas/ResponseStreamEvent'
        '400':
          $ref: '#/components/responses/ResponsesNotSupported'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /messages:
    post:
      operationId: createMessage
      tags:
        - Messages
      description: |
        Creates a message using the Anthropic-compatible Messages API.
        The request follows the Anthropic Messages API format with `model`,
        `max_tokens`, `messages`, optional `system`, `tools`, and streaming
        support.

        Not every provider implements the Messages API. Requests routed to a
        provider that does not support it return `400 Bad Request` with an
        explanatory error message; use `/chat/completions` for those providers.
      summary: Create a message
      security:
        - bearerAuth: []
      parameters:
        - name: provider
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/Provider'
          description: Specific provider to use (default determined by model)
      requestBody:
        $ref: '#/components/requestBodies/CreateMessagesRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessagesResponse'
            text/event-stream:
              schema:
                description: |
                  Server-Sent Events stream. Each frame is an `SSEvent` whose
                  `data` field contains the JSON-serialized payload for that
                  event. For Messages streaming the payload is a
                  `MessagesStreamEvent`. The `oneOf` here makes the streaming
                  payload schemas reachable from this operation so that code
                  generators emit types for them.
                oneOf:
                  - $ref: '#/components/schemas/SSEvent'
                  - $ref: '#/components/schemas/MessagesStreamEvent'
        '400':
          $ref: '#/components/responses/MessagesNotSupported'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /mcp/tools:
    get:
      operationId: listTools
      tags:
        - MCP
      description: |
        Lists the currently available MCP tools. Only accessible when EXPOSE_MCP is enabled.
      summary: Lists the currently available MCP tools
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListToolsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/MCPNotExposed'
        '500':
          $ref: '#/components/responses/InternalError'
  /metrics:
    post:
      operationId: pushMetrics
      tags:
        - Metrics
      description: |
        OTLP/HTTP metrics push endpoint. Accepts an OTLP ExportMetricsServiceRequest
        encoded as protobuf or JSON. Only accessible when TELEMETRY_ENABLED and
        TELEMETRY_METRICS_PUSH_ENABLED are enabled.
      summary: Push metrics to the gateway (OTLP/HTTP)
      security:
        - bearerAuth: []
      requestBody:
        required: true
        description: OTLP ExportMetricsServiceRequest payload
        content:
          application/x-protobuf:
            schema:
              type: string
              format: binary
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: OTLP ExportMetricsServiceResponse, possibly with partial success details
          content:
            application/x-protobuf:
              schema:
                type: string
                format: binary
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Metrics push is not enabled
        '413':
          description: Payload too large
        '415':
          description: Unsupported content type
  /proxy/{provider}/{path}:
    parameters:
      - name: provider
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/Provider'
      - name: path
        in: path
        required: true
        style: simple
        explode: false
        schema:
          type: string
        description: The remaining path to proxy to the provider
    get:
      operationId: proxyGet
      tags:
        - Proxy
      description: |
        Proxy GET request to provider
        The request body depends on the specific provider and endpoint being called.
        If you decide to use this approach, please follow the provider-specific documentations.
      summary: Proxy GET request to provider
      responses:
        '200':
          $ref: '#/components/responses/ProviderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
    post:
      operationId: proxyPost
      tags:
        - Proxy
      description: |
        Proxy POST request to provider
        The request body depends on the specific provider and endpoint being called.
        If you decide to use this approach, please follow the provider-specific documentations.
      summary: Proxy POST request to provider
      requestBody:
        $ref: '#/components/requestBodies/ProviderRequest'
      responses:
        '200':
          $ref: '#/components/responses/ProviderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
    put:
      operationId: proxyPut
      tags:
        - Proxy
      description: |
        Proxy PUT request to provider
        The request body depends on the specific provider and endpoint being called.
        If you decide to use this approach, please follow the provider-specific documentations.
      summary: Proxy PUT request to provider
      requestBody:
        $ref: '#/components/requestBodies/ProviderRequest'
      responses:
        '200':
          $ref: '#/components/responses/ProviderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
    delete:
      operationId: proxyDelete
      tags:
        - Proxy
      description: |
        Proxy DELETE request to provider
        The request body depends on the specific provider and endpoint being called.
        If you decide to use this approach, please follow the provider-specific documentations.
      summary: Proxy DELETE request to provider
      responses:
        '200':
          $ref: '#/components/responses/ProviderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
    patch:
      operationId: proxyPatch
      tags:
        - Proxy
      description: |
        Proxy PATCH request to provider
        The request body depends on the specific provider and endpoint being called.
        If you decide to use this approach, please follow the provider-specific documentations.
      summary: Proxy PATCH request to provider
      requestBody:
        $ref: '#/components/requestBodies/ProviderRequest'
      responses:
        '200':
          $ref: '#/components/responses/ProviderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
  /health:
    get:
      operationId: healthCheck
      tags:
        - Health
      description: |
        Health check endpoint
        Returns a 200 status code if the service is healthy
      summary: Health check
      responses:
        '200':
          description: Health check successful
components:
  requestBodies:
    ProviderRequest:
      required: true
      description: |
        ProviderRequest depends on the specific provider and endpoint being called
        If you decide to use this approach, please follow the provider-specific documentations.
      content:
        application/json:
          schema:
            type: object
            properties:
              model:
                type: string
              messages:
                type: array
                items:
                  type: object
                  properties:
                    role:
                      type: string
                    content:
                      type: string
              temperature:
                type: number
                format: float
                default: 0.7
          examples:
            openai:
              summary: OpenAI chat completion request
              value:
                model: 'gpt-3.5-turbo'
                messages:
                  - role: 'user'
                    content: 'Hello! How can I assist you today?'
                temperature: 0.7
            anthropic:
              summary: Anthropic Claude request
              value:
                model: 'claude-3-opus-20240229'
                messages:
                  - role: 'user'
                    content: 'Explain quantum computing'
                temperature: 0.5
            mistral:
              summary: Mistral AI request
              value:
                model: 'mistral-large-latest'
                messages:
                  - role: 'user'
                    content: 'Write a Python function to calculate fibonacci numbers'
                temperature: 0.3
    CreateChatCompletionRequest:
      required: true
      description: |
        ProviderRequest depends on the specific provider and endpoint being called
        If you decide to use this approach, please follow the provider-specific documentations.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateChatCompletionRequest'
    CreateResponseRequest:
      required: true
      description: |
        Request payload for the Responses API. Mirrors the OpenAI
        `POST /v1/responses` request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateResponseRequest'
    CreateMessagesRequest:
      required: true
      description: |
        Request payload for the Messages API. Mirrors the Anthropic
        `POST /v1/messages` request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateMessagesRequest'
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    MCPNotExposed:
      description: MCP tools endpoint is not exposed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'MCP tools endpoint is not exposed. Set EXPOSE_MCP=true to enable.'
    ResponsesNotSupported:
      description: |
        The selected provider does not implement the Responses API. The
        gateway returns this when a request is routed to a provider without
        Responses support.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'The Responses API is not supported by this provider yet.'
    MessagesNotSupported:
      description: |
        The selected provider does not implement the Messages API. The
        gateway returns this when a request is routed to a provider without
        Messages support.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessagesError'
          example:
            type: error
            error:
              type: not_supported_error
              message: 'The Messages API is not supported by this provider yet.'
    ProviderResponse:
      description: |
        ProviderResponse depends on the specific provider and endpoint being called
        If you decide to use this approach, please follow the provider-specific documentations.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProviderSpecificResponse'
          examples:
            openai:
              summary: OpenAI API response
              value:
                {
                  'id': 'chatcmpl-123',
                  'object': 'chat.completion',
                  'created': 1677652288,
                  'model': 'gpt-3.5-turbo',
                  'choices':
                    [
                      {
                        'index': 0,
                        'message':
                          {
                            'role': 'assistant',
                            'content': 'Hello! How can I help you today?',
                          },
                        'finish_reason': 'stop',
                      },
                    ],
                }
            mistral:
              summary: Mistral AI response
              value:
                {
                  'id': 'cmpl-123',
                  'object': 'chat.completion',
                  'created': 1677652288,
                  'model': 'mistral-large-latest',
                  'choices':
                    [
                      {
                        'index': 0,
                        'message':
                          {
                            'role': 'assistant',
                            'content': 'def fibonacci(n):\n    if n <= 1:\n        return n\n    return fibonacci(n-1) + fibonacci(n-2)',
                          },
                        'finish_reason': 'stop',
                      },
                    ],
                }
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Authentication is optional by default.
        To enable authentication, set AUTH_ENABLED to true.
        When enabled, requests must include a valid JWT token in the Authorization header.
  schemas:
    Provider:
      type: string
      enum:
        - ollama
        - ollama_cloud
        - groq
        - llamacpp
        - openai
        - cloudflare
        - cohere
        - anthropic
        - deepseek
        - google
        - mistral
        - minimax
        - moonshot
        - nvidia
        - zai
      x-provider-configs:
        ollama:
          id: 'ollama'
          url: 'http://ollama:8080/v1'
          auth_type: 'none'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        ollama_cloud:
          id: 'ollama_cloud'
          url: 'https://ollama.com/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        anthropic:
          id: 'anthropic'
          url: 'https://api.anthropic.com/v1'
          auth_type: 'xheader'
          supports_vision: true
          extra_headers:
            anthropic-version: '2023-06-01'
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        cohere:
          id: 'cohere'
          url: 'https://api.cohere.ai'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/v1/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/compatibility/v1/chat/completions'
        groq:
          id: 'groq'
          url: 'https://api.groq.com/openai/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        llamacpp:
          id: 'llamacpp'
          url: 'http://llamacpp:8080/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        openai:
          id: 'openai'
          url: 'https://api.openai.com/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
            responses:
              name: 'responses'
              method: 'POST'
              endpoint: '/responses'
        cloudflare:
          id: 'cloudflare'
          url: 'https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai'
          auth_type: 'bearer'
          supports_vision: false
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/finetunes/public?limit=1000'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/v1/chat/completions'
        deepseek:
          id: 'deepseek'
          url: 'https://api.deepseek.com'
          auth_type: 'bearer'
          supports_vision: false
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        google:
          id: 'google'
          url: 'https://generativelanguage.googleapis.com/v1beta/openai'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        mistral:
          id: 'mistral'
          url: 'https://api.mistral.ai/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        minimax:
          id: 'minimax'
          url: 'https://api.minimax.io/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        moonshot:
          id: 'moonshot'
          url: 'https://api.moonshot.ai/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        nvidia:
          id: 'nvidia'
          url: 'https://integrate.api.nvidia.com/v1'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
        zai:
          id: 'zai'
          url: 'https://api.z.ai/api/paas/v4'
          auth_type: 'bearer'
          supports_vision: true
          endpoints:
            models:
              name: 'list_models'
              method: 'GET'
              endpoint: '/models'
            chat:
              name: 'chat_completions'
              method: 'POST'
              endpoint: '/chat/completions'
    ProviderSpecificResponse:
      type: object
      description: |
        Provider-specific response format. Examples:

        OpenAI GET /v1/models?provider=openai response:
        ```json
        {
          "provider": "openai",
          "object": "list",
          "data": [
            {
              "id": "gpt-4",
              "object": "model",
              "created": 1687882410,
              "owned_by": "openai",
              "served_by": "openai"
            }
          ]
        }
        ```

        Anthropic GET /v1/models?provider=anthropic response:
        ```json
        {
          "provider": "anthropic",
          "object": "list",
          "data": [
            {
              "id": "gpt-4",
              "object": "model",
              "created": 1687882410,
              "owned_by": "openai",
              "served_by": "openai"
            }
          ]
        }
        ```
    ProviderAuthType:
      type: string
      description: Authentication type for providers
      enum:
        - bearer
        - xheader
        - query
        - none
    SSEvent:
      type: object
      properties:
        event:
          type: string
          enum:
            - message-start
            - stream-start
            - content-start
            - content-delta
            - content-end
            - message-end
            - stream-end
        data:
          type: string
          format: byte
        retry:
          type: integer
    Endpoints:
      type: object
      properties:
        models:
          type: string
        chat:
          type: string
        responses:
          type: string
      required:
        - models
        - chat
    Error:
      type: object
      properties:
        error:
          type: string
    MessageRole:
      type: string
      description: Role of the message sender
      enum:
        - system
        - user
        - assistant
        - tool
      x-enum-varnames:
        - System
        - User
        - Assistant
        - Tool
    Message:
      type: object
      description: Message structure for provider requests
      properties:
        role:
          $ref: '#/components/schemas/MessageRole'
        content:
          $ref: '#/components/schemas/MessageContent'
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ChatCompletionMessageToolCall'
        tool_call_id:
          type: string
        reasoning_content:
          type: string
          description: The reasoning content of the chunk message.
        reasoning:
          type: string
          description: The reasoning of the chunk message. Same as reasoning_content.
      required:
        - role
        - content
    MessageContent:
      description: Message content - either text or multimodal content parts
      oneOf:
        - type: string
          description: Text content (backward compatibility)
        - type: array
          items:
            $ref: '#/components/schemas/ContentPart'
          description: Array of content parts for multimodal messages
    ContentPart:
      type: object
      description: A content part within a multimodal message
      oneOf:
        - $ref: '#/components/schemas/TextContentPart'
        - $ref: '#/components/schemas/ImageContentPart'
    TextContentPart:
      type: object
      description: Text content part
      properties:
        type:
          type: string
          enum:
            - text
          description: Content type identifier
        text:
          type: string
          description: The text content
      required:
        - type
        - text
    ImageContentPart:
      type: object
      description: Image content part
      properties:
        type:
          type: string
          enum:
            - image_url
          description: Content type identifier
        image_url:
          $ref: '#/components/schemas/ImageURL'
      required:
        - type
        - image_url
    ImageURL:
      type: object
      description: Image URL configuration
      properties:
        url:
          type: string
          description: URL of the image (data URLs supported)
        detail:
          type: string
          enum:
            - auto
            - low
            - high
          x-enum-varnames:
            - ImageURLDetailAuto
            - ImageURLDetailLow
            - ImageURLDetailHigh
          default: auto
          description: Image detail level for vision processing
      required:
        - url
    ContextWindow:
      type: object
      description: Context window information for a model
      properties:
        tokens:
          type: integer
          description: Maximum number of tokens the model can process in a single request
        source:
          type: string
          enum:
            - runtime
            - provider
            - community
          x-enum-varnames:
            - ContextWindowSourceRuntime
            - ContextWindowSourceProvider
            - ContextWindowSourceCommunity
          description: Source of the context window information
      required:
        - tokens
        - source
    Pricing:
      type: object
      description: Pricing information for a model
      properties:
        currency:
          type: string
          description: Currency code for the pricing (e.g. USD)
        input_per_token:
          type: string
          description: Price per input token
        output_per_token:
          type: string
          description: Price per output token
        cache_read_per_token:
          type: string
          description: Price per cached input token read
        cache_write_per_token:
          type: string
          description: Price per cached input token write
        source:
          type: string
          enum:
            - provider
            - community
          x-enum-varnames:
            - PricingSourceProvider
            - PricingSourceCommunity
          description: Source of the pricing information
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the pricing was last updated
        subscription:
          type: boolean
          default: false
          description: Model has no per-token price but is gated behind a paid subscription
      required:
        - currency
        - input_per_token
        - output_per_token
        - source
        - updated_at
    Model:
      type: object
      description: Common model information
      properties:
        id:
          type: string
        object:
          type: string
        created:
          type: integer
          format: int64
        owned_by:
          type: string
        served_by:
          $ref: '#/components/schemas/Provider'
        context_window:
          oneOf:
            - $ref: '#/components/schemas/ContextWindow'
            - type: 'null'
          description: Context window information for the model (included when `include=context_window`)
        pricing:
          oneOf:
            - $ref: '#/components/schemas/Pricing'
            - type: 'null'
          description: Pricing information for the model (included when `include=pricing`)
      required:
        - id
        - object
        - created
        - owned_by
        - served_by
    ListModelsResponse:
      type: object
      description: Response structure for listing models
      properties:
        provider:
          $ref: '#/components/schemas/Provider'
        object:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/Model'
          default: []
      required:
        - object
        - data
    ListToolsResponse:
      type: object
      description: Response structure for listing MCP tools
      properties:
        object:
          type: string
          description: Always "list"
          example: 'list'
        data:
          type: array
          items:
            $ref: '#/components/schemas/MCPTool'
          default: []
          description: Array of available MCP tools
      required:
        - object
        - data
    MCPTool:
      type: object
      description: An MCP tool definition
      properties:
        name:
          type: string
          description: The name of the tool
          example: 'read_file'
        description:
          type: string
          description: A description of what the tool does
          example: 'Read content from a file'
        server:
          type: string
          description: The MCP server that provides this tool
          example: 'http://mcp-filesystem-server:8083/mcp'
        input_schema:
          type: object
          description: JSON schema for the tool's input parameters
          example:
            type: 'object'
            properties:
              file_path:
                type: 'string'
                description: 'Path to the file to read'
            required:
              - file_path
          additionalProperties: true
      required:
        - name
        - description
        - server
    FunctionObject:
      type: object
      properties:
        description:
          type: string
          description:
            A description of what the function does, used by the model to
            choose when and how to call the function.
        name:
          type: string
          description:
            The name of the function to be called. Must be a-z, A-Z, 0-9, or
            contain underscores and dashes, with a maximum length of 64.
        parameters:
          $ref: '#/components/schemas/FunctionParameters'
        strict:
          type: boolean
          default: false
          description:
            Whether to enable strict schema adherence when generating the
            function call. If set to true, the model will follow the exact
            schema defined in the `parameters` field. Only a subset of JSON
            Schema is supported when `strict` is `true`. Learn more about
            Structured Outputs in the [function calling
            guide](docs/guides/function-calling).
      required:
        - name
    ChatCompletionTool:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ChatCompletionToolType'
        function:
          $ref: '#/components/schemas/FunctionObject'
      required:
        - type
        - function
    FunctionParameters:
      type: object
      description: >-
        The parameters the functions accepts, described as a JSON Schema object.
        See the [guide](/docs/guides/function-calling) for examples, and the
        [JSON Schema
        reference](https://json-schema.org/understanding-json-schema/) for
        documentation about the format. 

        Omitting `parameters` defines a function with an empty parameter list.
      additionalProperties: true
    ChatCompletionToolType:
      type: string
      description: The type of the tool. Currently, only `function` is supported.
      enum:
        - function
    CompletionUsage:
      type: object
      description: Usage statistics for the completion request.
      properties:
        completion_tokens:
          type: integer
          default: 0
          format: int64
          description: Number of tokens in the generated completion.
        prompt_tokens:
          type: integer
          default: 0
          format: int64
          description: Number of tokens in the prompt.
        total_tokens:
          type: integer
          default: 0
          format: int64
          description: Total number of tokens used in the request (prompt + completion).
        completion_tokens_details:
          type: object
          description: Breakdown of tokens used in a completion.
          properties:
            accepted_prediction_tokens:
              type: integer
              default: 0
              format: int64
              description: When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
            audio_tokens:
              type: integer
              default: 0
              format: int64
              description: Audio input tokens generated by the model.
            reasoning_tokens:
              type: integer
              default: 0
              format: int64
              description: Tokens generated by the model for reasoning.
            rejected_prediction_tokens:
              type: integer
              default: 0
              format: int64
              description: When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.
        prompt_tokens_details:
          type: object
          description: Breakdown of tokens used in the prompt.
          properties:
            audio_tokens:
              type: integer
              default: 0
              format: int64
              description: Audio input tokens present in the prompt.
            cached_tokens:
              type: integer
              default: 0
              format: int64
              description: Cached tokens present in the prompt.
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
    ChatCompletionStreamOptions:
      description: >
        Options for streaming response. Only set this when you set `stream:
        true`.
      type: object
      properties:
        include_usage:
          type: boolean
          description: >
            If set, an additional chunk will be streamed before the `data:
            [DONE]` message. The `usage` field on this chunk shows the token
            usage statistics for the entire request, and the `choices` field
            will always be an empty array. All other chunks will also include a
            `usage` field, but with a null value.
      required:
        - include_usage
    CreateChatCompletionRequest:
      type: object
      properties:
        model:
          type: string
          description: Model ID to use
        messages:
          description: >
            A list of messages comprising the conversation so far.
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Message'
        max_tokens:
          description: >
            The maximum number of tokens that can be generated in the chat
            completion. This value can be used to control costs for text
            generated via API. This value is now deprecated in favor of
            `max_completion_tokens`, and is not compatible with o-series models.
          type: integer
          deprecated: true
        max_completion_tokens:
          description: >
            An upper bound for the number of tokens that can be generated
            for a completion, including visible output tokens and reasoning tokens.
          type: integer
        temperature:
          description: >
            What sampling temperature to use, between 0 and 2. Higher values
            like 0.8 will make the output more random, while lower values
            like 0.2 will make it more focused and deterministic.
          type: number
          minimum: 0
          maximum: 2
          default: 1
        top_p:
          description: >
            An alternative to sampling with temperature, called nucleus
            sampling, where the model considers the results of the tokens
            with top_p probability mass.
          type: number
          minimum: 0
          maximum: 1
          default: 1
        frequency_penalty:
          description: >
            Number between -2.0 and 2.0. Positive values penalize new tokens
            based on their existing frequency in the text so far, decreasing
            the model's likelihood to repeat the same line verbatim.
          type: number
          minimum: -2
          maximum: 2
          default: 0
        presence_penalty:
          description: >
            Number between -2.0 and 2.0. Positive values penalize new tokens
            based on whether they appear in the text so far, increasing the
            model's likelihood to talk about new topics.
          type: number
          minimum: -2
          maximum: 2
          default: 0
        n:
          description: >
            How many chat completion choices to generate for each input message.
          type: integer
          minimum: 1
          maximum: 128
          default: 1
        stop:
          description: >
            Up to 4 sequences where the API will stop generating further tokens.
          oneOf:
            - type: string
            - type: array
              minItems: 1
              maxItems: 4
              items:
                type: string
        seed:
          description: >
            If specified, our system will make a best effort to sample
            deterministically, such that repeated requests with the same `seed`
            and parameters should return the same result. Determinism is not
            guaranteed, and you should refer to the `system_fingerprint`
            response parameter to monitor changes in the backend.
          type: integer
        logprobs:
          description: >
            Whether to return log probabilities of the output tokens or not. If
            true, returns the log probabilities of each output token returned in
            the `content` of `message`.
          type: boolean
          default: false
        top_logprobs:
          description: >
            An integer between 0 and 20 specifying the number of most likely
            tokens to return at each token position, each with an associated log
            probability. `logprobs` must be set to `true` if this parameter is
            used.
          type: integer
          minimum: 0
          maximum: 20
        response_format:
          description: >
            An object specifying the format that the model must output. Setting
            to `{ "type": "json_schema", "json_schema": {...} }` enables
            Structured Outputs which guarantees the model will match your
            supplied JSON schema. Setting to `{ "type": "json_object" }` enables
            the older JSON mode, which ensures the message the model generates is
            valid JSON.
          oneOf:
            - $ref: '#/components/schemas/ResponseFormatText'
            - $ref: '#/components/schemas/ResponseFormatJsonSchema'
            - $ref: '#/components/schemas/ResponseFormatJsonObject'
        logit_bias:
          description: >
            Modify the likelihood of specified tokens appearing in the
            completion. Accepts a JSON object that maps tokens (specified by
            their token ID in the tokenizer) to an associated bias value from
            -100 to 100. The bias is added to the logits generated by the model
            prior to sampling.
          type: object
          additionalProperties:
            type: integer
        user:
          description: >
            A unique identifier representing your end-user, which can help to
            monitor and detect abuse.
          type: string
        stream:
          description: >
            If set to true, the model response data will be streamed to the
            client as it is generated using [server-sent
            events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
          type: boolean
          default: false
        stream_options:
          $ref: '#/components/schemas/ChatCompletionStreamOptions'
        tools:
          type: array
          description: >
            A list of tools the model may call. Currently, only functions
            are supported as a tool. Use this to provide a list of functions
            the model may generate JSON inputs for. A max of 128 functions
            are supported.
          items:
            $ref: '#/components/schemas/ChatCompletionTool'
        tool_choice:
          $ref: '#/components/schemas/ChatCompletionToolChoiceOption'
        parallel_tool_calls:
          type: boolean
          default: true
          description: >
            Whether to enable parallel function calling during tool use.
        reasoning_format:
          type: string
          description: >
            The format of the reasoning content. Can be `raw` or `parsed`.

            When specified as raw some reasoning models will output <think /> tags.
            When specified as parsed the model will output the reasoning under
            `reasoning` or `reasoning_content` attribute.
        reasoning_effort:
          type: string
          description: >
            Constrains effort on reasoning for reasoning models. Currently
            supported values are `minimal`, `low`, `medium`, and `high`.
            Reducing reasoning effort can result in faster responses and fewer
            tokens used on reasoning in a response.
          x-enum-varnames:
            - Minimal
            - Low
            - Medium
            - High
          enum:
            - minimal
            - low
            - medium
            - high
      required:
        - model
        - messages
    ResponseFormatText:
      type: object
      description: Default response format. Used to generate text responses.
      properties:
        type:
          type: string
          description: The type of response format being defined. Always `text`.
          enum:
            - text
      required:
        - type
    ResponseFormatJsonObject:
      type: object
      description: >
        JSON object response format. An older method of generating JSON
        responses. Using `json_schema` is recommended for models that support
        it. Note that the model will not generate JSON without a system or user
        message instructing it to do so.
      properties:
        type:
          type: string
          description: The type of response format being defined. Always `json_object`.
          enum:
            - json_object
      required:
        - type
    ResponseFormatJsonSchema:
      type: object
      description: >
        JSON Schema response format. Used to generate structured JSON responses.
      properties:
        type:
          type: string
          description: The type of response format being defined. Always `json_schema`.
          enum:
            - json_schema
        json_schema:
          type: object
          description: Structured Outputs configuration options, including a JSON Schema.
          properties:
            description:
              type: string
              description: >
                A description of what the response format is for, used by the
                model to determine how to respond in the format.
            name:
              type: string
              description: >
                The name of the response format. Must be a-z, A-Z, 0-9, or
                contain underscores and dashes, with a maximum length of 64.
            schema:
              $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema'
            strict:
              type: boolean
              default: false
              description: >
                Whether to enable strict schema adherence when generating the
                output. If set to true, the model will always follow the exact
                schema defined in the `schema` field. Only a subset of JSON
                Schema is supported when `strict` is `true`.
          required:
            - name
      required:
        - type
        - json_schema
    ResponseFormatJsonSchemaSchema:
      type: object
      description: >
        The schema for the response format, described as a JSON Schema object.
      additionalProperties: true
    ChatCompletionToolChoiceOption:
      description: >
        Controls which (if any) tool is called by the model. `none` means the
        model will not call any tool and instead generates a message. `auto`
        means the model can pick between generating a message or calling one or
        more tools. `required` means the model must call one or more tools.
        Specifying a particular tool via `{"type": "function", "function":
        {"name": "my_function"}}` forces the model to call that tool.

        `none` is the default when no tools are present. `auto` is the default
        if tools are present.
      oneOf:
        - type: string
          description: >
            `none` means the model will not call any tool and instead generates
            a message. `auto` means the model can pick between generating a
            message or calling one or more tools. `required` means the model
            must call one or more tools.
          enum:
            - none
            - auto
            - required
        - $ref: '#/components/schemas/ChatCompletionNamedToolChoice'
    ChatCompletionNamedToolChoice:
      type: object
      description: >
        Specifies a tool the model should use. Use to force the model to call a
        specific function.
      properties:
        type:
          $ref: '#/components/schemas/ChatCompletionToolType'
        function:
          type: object
          properties:
            name:
              type: string
              description: The name of the function to call.
          required:
            - name
      required:
        - type
        - function
    ChatCompletionMessageToolCallFunction:
      type: object
      description: The function that the model called.
      properties:
        name:
          type: string
          description: The name of the function to call.
        arguments:
          type: string
          description:
            The arguments to call the function with, as generated by the model
            in JSON format. Note that the model does not always generate
            valid JSON, and may hallucinate parameters not defined by your
            function schema. Validate the arguments in your code before
            calling your function.
      required:
        - name
        - arguments
    ChatCompletionMessageToolCall:
      type: object
      properties:
        id:
          type: string
          description: The ID of the tool call.
        type:
          $ref: '#/components/schemas/ChatCompletionToolType'
        function:
          $ref: '#/components/schemas/ChatCompletionMessageToolCallFunction'
        extra_content:
          $ref: '#/components/schemas/ToolCallExtraContent'
      required:
        - id
        - type
        - function
    ChatCompletionChoice:
      type: object
      properties:
        finish_reason:
          $ref: '#/components/schemas/FinishReason'
        index:
          type: integer
          description: The index of the choice in the list of choices.
        message:
          $ref: '#/components/schemas/Message'
        logprobs:
          description: Log probability information for the choice.
          type: object
          nullable: true
          properties:
            content:
              description: A list of message content tokens with log probability information.
              type: array
              items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
            refusal:
              description: A list of message refusal tokens with log probability information.
              type: array
              items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
          required:
            - content
            - refusal
      required:
        - finish_reason
        - index
        - message
    ChatCompletionStreamChoice:
      type: object
      required:
        - delta
        - finish_reason
        - index
      properties:
        delta:
          $ref: '#/components/schemas/ChatCompletionStreamResponseDelta'
        logprobs:
          description: Log probability information for the choice.
          type: object
          properties:
            content:
              description: A list of message content tokens with log probability information.
              type: array
              items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
            refusal:
              description: A list of message refusal tokens with log probability information.
              type: array
              items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
          required:
            - content
            - refusal
        finish_reason:
          $ref: '#/components/schemas/FinishReason'
        index:
          type: integer
          description: The index of the choice in the list of choices.
    CreateChatCompletionResponse:
      type: object
      description:
        Represents a chat completion response returned by model, based on
        the provided input.
      properties:
        id:
          type: string
          description: A unique identifier for the chat completion.
        choices:
          type: array
          description:
            A list of chat completion choices. Can be more than one if `n` is
            greater than 1.
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
        created:
          type: integer
          description:
            The Unix timestamp (in seconds) of when the chat completion was
            created.
        model:
          type: string
          description: The model used for the chat completion.
        object:
          type: string
          description: The object type, which is always `chat.completion`.
          x-stainless-const: true
        usage:
          $ref: '#/components/schemas/CompletionUsage'
      required:
        - choices
        - created
        - id
        - model
        - object
    ChatCompletionStreamResponseDelta:
      type: object
      description: A chat completion delta generated by streamed model responses.
      properties:
        content:
          type: string
          description: The contents of the chunk message.
        reasoning_content:
          type: string
          description: The reasoning content of the chunk message.
        reasoning:
          type: string
          description: The reasoning of the chunk message. Same as reasoning_content.
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ChatCompletionMessageToolCallChunk'
        role:
          $ref: '#/components/schemas/MessageRole'
        refusal:
          type: string
          description: The refusal message generated by the model.
      required:
        - content
        - role
    ChatCompletionMessageToolCallChunk:
      type: object
      properties:
        index:
          type: integer
        id:
          type: string
          description: The ID of the tool call.
        type:
          type: string
          description: The type of the tool. Currently, only `function` is supported.
        function:
          $ref: '#/components/schemas/ChatCompletionMessageToolCallFunction'
        extra_content:
          $ref: '#/components/schemas/ToolCallExtraContent'
      required:
        - index
    ToolCallExtraContent:
      type: object
      description: |
        Provider-specific opaque data attached to a tool call. The contents are
        not interpreted by the gateway, but must be echoed back verbatim on the
        next request that references this tool call. Currently used by Google
        Gemini extended-thinking models to carry the per-call `thought_signature`.
        Other providers may ignore the field.
      properties:
        google:
          type: object
          description: Google Gemini-specific extra content.
          properties:
            thought_signature:
              type: string
              description: |
                Opaque signature returned with reasoning-enabled tool calls.
                Must be echoed back verbatim in the next request that includes
                this tool call, or Google will reject the request.
          additionalProperties: true
    ChatCompletionTokenLogprob:
      type: object
      properties:
        token: &a1
          description: The token.
          type: string
        logprob: &a2
          description:
            The log probability of this token, if it is within the top 20 most
            likely tokens. Otherwise, the value `-9999.0` is used to signify
            that the token is very unlikely.
          type: number
        bytes: &a3
          description:
            A list of integers representing the UTF-8 bytes representation of
            the token. Useful in instances where characters are represented by
            multiple tokens and their byte representations must be combined to
            generate the correct text representation. Can be `null` if there is
            no bytes representation for the token.
          type: array
          items:
            type: integer
        top_logprobs:
          description:
            List of the most likely tokens and their log probability, at this
            token position. In rare cases, there may be fewer than the number of
            requested `top_logprobs` returned.
          type: array
          items:
            type: object
            properties:
              token: *a1
              logprob: *a2
              bytes: *a3
            required:
              - token
              - logprob
              - bytes
      required:
        - token
        - logprob
        - bytes
        - top_logprobs
    FinishReason:
      type: string
      description: >
        The reason the model stopped generating tokens. This will be
        `stop` if the model hit a natural stop point or a provided
        stop sequence,

        `length` if the maximum number of tokens specified in the
        request was reached,

        `content_filter` if content was omitted due to a flag from our
        content filters,

        `tool_calls` if the model called a tool.
      enum:
        - stop
        - length
        - tool_calls
        - content_filter
        - function_call
      x-enum-varnames:
        - Stop
        - Length
        - ToolCalls
        - ContentFilter
        - FunctionCall
    CreateChatCompletionStreamResponse:
      type: object
      description: |
        Represents a streamed chunk of a chat completion response returned
        by the model, based on the provided input.
      properties:
        id:
          type: string
          description:
            A unique identifier for the chat completion. Each chunk has the
            same ID.
        choices:
          type: array
          description: >
            A list of chat completion choices. Can contain more than one
            elements if `n` is greater than 1. Can also be empty for the

            last chunk if you set `stream_options: {"include_usage": true}`.
          items:
            $ref: '#/components/schemas/ChatCompletionStreamChoice'
        created:
          type: integer
          description:
            The Unix timestamp (in seconds) of when the chat completion was
            created. Each chunk has the same timestamp.
        model:
          type: string
          description: The model to generate the completion.
        system_fingerprint:
          type: string
          description: >
            This fingerprint represents the backend configuration that the model
            runs with.

            Can be used in conjunction with the `seed` request parameter to
            understand when backend changes have been made that might impact
            determinism.
        object:
          type: string
          description: The object type, which is always `chat.completion.chunk`.
        usage:
          $ref: '#/components/schemas/CompletionUsage'
        reasoning_format:
          type: string
          description: >
            The format of the reasoning content. Can be `raw` or `parsed`.

            When specified as raw some reasoning models will output <think /> tags.
            When specified as parsed the model will output the reasoning under reasoning_content.
      required:
        - choices
        - created
        - id
        - model
        - object
    CreateResponseRequest:
      type: object
      description: |
        Request body for creating a model response via the Responses API.
      properties:
        model:
          type: string
          description: Model ID used to generate the response.
        input:
          $ref: '#/components/schemas/ResponseInput'
        instructions:
          type: string
          nullable: true
          description: >
            A system (or developer) message inserted into the model's context.
            When used with `previous_response_id`, instructions from previous
            responses are not carried over.
        max_output_tokens:
          type: integer
          nullable: true
          description: >
            An upper bound for the number of tokens that can be generated for a
            response, including visible output tokens and reasoning tokens.
        stream:
          type: boolean
          default: false
          description: >
            If set to true, the model response data is streamed to the client
            as it is generated using
            [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
        temperature:
          type: number
          format: float
          nullable: true
          default: 1
          description: >
            What sampling temperature to use, between 0 and 2. Higher values
            make the output more random; lower values make it more focused.
        top_p:
          type: number
          format: float
          nullable: true
          default: 1
          description: >
            An alternative to sampling with temperature, called nucleus
            sampling, where the model considers the tokens with `top_p`
            probability mass.
        tools:
          type: array
          description: >
            An array of tools the model may call while generating a response.
          items:
            $ref: '#/components/schemas/ResponseTool'
        tool_choice:
          $ref: '#/components/schemas/ResponseToolChoice'
        reasoning:
          $ref: '#/components/schemas/ResponseReasoning'
        text:
          $ref: '#/components/schemas/ResponseTextConfig'
        previous_response_id:
          type: string
          nullable: true
          description: >
            The unique ID of the previous response to the model. Use this to
            create multi-turn conversations.
        store:
          type: boolean
          default: true
          description: >
            Whether to store the generated model response for later retrieval.
        background:
          type: boolean
          default: false
          description: >
            Whether to run the model response in the background. Useful for
            long-running or batched requests.
        parallel_tool_calls:
          type: boolean
          default: true
          description: Whether to allow the model to run tool calls in parallel.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: >
            Set of up to 16 key-value pairs that can be attached to the object
            and returned when retrieving the response.
        user:
          type: string
          description: >
            A stable identifier for your end-users, used to help detect and
            prevent abuse.
      required:
        - model
        - input
    ResponseInput:
      description: >
        Text, image, or file inputs to the model. Either a single text prompt
        or a list of input items representing a (possibly batched) conversation.
      oneOf:
        - type: string
          description: A text input to the model, equivalent to a user message.
        - type: array
          description: A list of input items.
          items:
            $ref: '#/components/schemas/ResponseInputItem'
    ResponseInputItem:
      type: object
      description: >
        A single input item. Most commonly an input message with a role and
        content.
      properties:
        type:
          type: string
          default: message
          description: The type of the input item. Defaults to `message`.
        role:
          $ref: '#/components/schemas/ResponseRole'
        content:
          $ref: '#/components/schemas/ResponseInputMessageContent'
      required:
        - role
        - content
    ResponseRole:
      type: string
      description: The role of the message input.
      enum:
        - user
        - assistant
        - system
        - developer
      x-enum-varnames:
        - ResponseRoleUser
        - ResponseRoleAssistant
        - ResponseRoleSystem
        - ResponseRoleDeveloper
    ResponseInputMessageContent:
      description: >
        Text or multimodal content for an input message. Either a string or a
        list of content parts.
      oneOf:
        - type: string
          description: A text input to the model.
        - type: array
          items:
            $ref: '#/components/schemas/ResponseInputContentPart'
    ResponseInputContentPart:
      type: object
      description: A content part within an input message.
      oneOf:
        - $ref: '#/components/schemas/ResponseInputText'
        - $ref: '#/components/schemas/ResponseInputImage'
    ResponseInputText:
      type: object
      description: A text input to the model.
      properties:
        type:
          type: string
          enum:
            - input_text
          description: The type of the input item. Always `input_text`.
        text:
          type: string
          description: The text input to the model.
      required:
        - type
        - text
    ResponseInputImage:
      type: object
      description: An image input to the model.
      properties:
        type:
          type: string
          enum:
            - input_image
          description: The type of the input item. Always `input_image`.
        image_url:
          type: string
          description: The URL of the image (data URLs supported).
        detail:
          type: string
          enum:
            - auto
            - low
            - high
          x-enum-varnames:
            - ResponseInputImageDetailAuto
            - ResponseInputImageDetailLow
            - ResponseInputImageDetailHigh
          default: auto
          description: The detail level of the image to send to the model.
      required:
        - type
    ResponseTool:
      type: object
      description: >
        A tool the model may call. Only function tools are modeled here. Note
        the Responses API uses a flattened function tool shape (`name`,
        `description`, and `parameters` at the top level) rather than nesting
        them under a `function` object as `/chat/completions` does.
      properties:
        type:
          type: string
          enum:
            - function
          x-enum-varnames:
            - ResponseToolTypeFunction
          description: The type of the tool. Currently only `function`.
        name:
          type: string
          description: The name of the function to call.
        description:
          type: string
          description: >
            A description of the function, used by the model to decide when and
            how to call it.
        parameters:
          $ref: '#/components/schemas/FunctionParameters'
        strict:
          type: boolean
          default: false
          description: Whether to enforce strict parameter validation.
      required:
        - type
        - name
    ResponseToolChoice:
      description: >
        How the model should select which tool (or tools) to use. Either a mode
        string (`none`, `auto`, `required`) or an object forcing a specific
        tool.
      oneOf:
        - type: string
          enum:
            - none
            - auto
            - required
          description: The tool-choice mode.
        - type: object
          description: Forces the model to call a specific function tool.
          properties:
            type:
              type: string
              enum:
                - function
              x-enum-varnames:
                - ResponseToolChoiceTypeFunction
            name:
              type: string
          required:
            - type
            - name
    ResponseReasoning:
      type: object
      description: Configuration options for reasoning models.
      properties:
        effort:
          type: string
          enum:
            - minimal
            - low
            - medium
            - high
          default: medium
          nullable: true
          x-enum-varnames:
            - ResponseReasoningEffortMinimal
            - ResponseReasoningEffortLow
            - ResponseReasoningEffortMedium
            - ResponseReasoningEffortHigh
          description: >
            Constrains the effort on reasoning for reasoning models. Reducing
            effort can result in faster responses and fewer reasoning tokens.
        summary:
          type: string
          enum:
            - auto
            - concise
            - detailed
          nullable: true
          description: >
            A summary of the reasoning performed by the model, useful for
            debugging and understanding the model's reasoning process.
    ResponseTextConfig:
      type: object
      description: >
        Configuration options for a text response from the model. Can be plain
        text or structured JSON data.
      properties:
        format:
          type: object
          description: An object specifying the format that the model must output.
          properties:
            type:
              type: string
              enum:
                - text
                - json_schema
                - json_object
              x-enum-varnames:
                - ResponseTextConfigFormatTypeText
                - ResponseTextConfigFormatTypeJSONSchema
                - ResponseTextConfigFormatTypeJSONObject
              description: The type of response format being defined.
            name:
              type: string
              description: The name of the response format (used with `json_schema`).
            schema:
              $ref: '#/components/schemas/FunctionParameters'
            strict:
              type: boolean
              default: false
              description: Whether to enable strict schema adherence.
          required:
            - type
    Response:
      type: object
      description: Represents a model response returned by the Responses API.
      properties:
        id:
          type: string
          description: Unique identifier for this response.
        object:
          type: string
          description: The object type, which is always `response`.
        created_at:
          type: integer
          format: int64
          description: Unix timestamp (in seconds) of when the response was created.
        status:
          $ref: '#/components/schemas/ResponseStatus'
        model:
          type: string
          description: The model used to generate the response.
        output:
          type: array
          description: An array of content items generated by the model.
          items:
            $ref: '#/components/schemas/ResponseOutputItem'
        error:
          $ref: '#/components/schemas/ResponseError'
        incomplete_details:
          $ref: '#/components/schemas/ResponseIncompleteDetails'
        instructions:
          type: string
          nullable: true
          description: The system/developer message used to generate the response.
        max_output_tokens:
          type: integer
          nullable: true
          description: An upper bound for the number of generated tokens.
        previous_response_id:
          type: string
          nullable: true
          description: The unique ID of the previous response, if any.
        reasoning:
          $ref: '#/components/schemas/ResponseReasoning'
        temperature:
          type: number
          format: float
          nullable: true
        top_p:
          type: number
          format: float
          nullable: true
        tool_choice:
          $ref: '#/components/schemas/ResponseToolChoice'
        tools:
          type: array
          items:
            $ref: '#/components/schemas/ResponseTool'
        text:
          $ref: '#/components/schemas/ResponseTextConfig'
        metadata:
          type: object
          additionalProperties:
            type: string
        usage:
          $ref: '#/components/schemas/ResponseUsage'
      required:
        - id
        - object
        - created_at
        - status
        - model
        - output
    ResponseStatus:
      type: string
      description: The status of the response generation.
      enum:
        - completed
        - failed
        - in_progress
        - cancelled
        - queued
        - incomplete
    ResponseError:
      type: object
      nullable: true
      description: An error object returned when the model fails to generate a response.
      properties:
        code:
          type: string
          description: The error code for the response.
        message:
          type: string
          description: A human-readable description of the error.
      required:
        - code
        - message
    ResponseIncompleteDetails:
      type: object
      nullable: true
      description: Details about why the response is incomplete.
      properties:
        reason:
          type: string
          description: The reason why the response is incomplete.
    ResponseOutputItem:
      type: object
      description: >
        An output item generated by the model: an output message, a function
        tool call, or a reasoning item.
      oneOf:
        - $ref: '#/components/schemas/ResponseOutputMessage'
        - $ref: '#/components/schemas/ResponseFunctionToolCall'
        - $ref: '#/components/schemas/ResponseReasoningItem'
    ResponseOutputMessage:
      type: object
      description: An output message from the model.
      properties:
        type:
          type: string
          enum:
            - message
          description: The type of the output item. Always `message`.
        id:
          type: string
          description: The unique ID of the output message.
        role:
          type: string
          enum:
            - assistant
          x-enum-varnames:
            - ResponseOutputMessageRoleAssistant
          description: The role of the output message. Always `assistant`.
        status:
          type: string
          enum:
            - in_progress
            - completed
            - incomplete
          description: The status of the message.
        content:
          type: array
          items:
            $ref: '#/components/schemas/ResponseOutputContent'
      required:
        - type
        - id
        - role
        - content
    ResponseOutputContent:
      type: object
      description: A content part of an output message.
      oneOf:
        - $ref: '#/components/schemas/ResponseOutputText'
        - $ref: '#/components/schemas/ResponseOutputRefusal'
    ResponseOutputText:
      type: object
      description: A text output from the model.
      properties:
        type:
          type: string
          enum:
            - output_text
          description: The type of the output text. Always `output_text`.
        text:
          type: string
          description: The text output from the model.
      required:
        - type
        - text
    ResponseOutputRefusal:
      type: object
      description: A refusal generated by the model.
      properties:
        type:
          type: string
          enum:
            - refusal
          description: The type of the refusal. Always `refusal`.
        refusal:
          type: string
          description: The refusal explanation from the model.
      required:
        - type
        - refusal
    ResponseFunctionToolCall:
      type: object
      description: A tool call to a function generated by the model.
      properties:
        type:
          type: string
          enum:
            - function_call
          x-enum-varnames:
            - ResponseFunctionToolCallTypeFunctionCall
          description: The type of the output item. Always `function_call`.
        id:
          type: string
          description: The unique ID of the function tool call.
        call_id:
          type: string
          description: >
            The unique ID of the function tool call generated by the model,
            used to associate the call with its output.
        name:
          type: string
          description: The name of the function to run.
        arguments:
          type: string
          description: A JSON string of the arguments to pass to the function.
        status:
          type: string
          enum:
            - in_progress
            - completed
            - incomplete
          description: The status of the function tool call.
      required:
        - type
        - call_id
        - name
        - arguments
    ResponseReasoningItem:
      type: object
      description: A reasoning item describing the model's chain of thought.
      properties:
        type:
          type: string
          enum:
            - reasoning
          description: The type of the output item. Always `reasoning`.
        id:
          type: string
          description: The unique ID of the reasoning item.
        summary:
          type: array
          description: Reasoning summary content.
          items:
            $ref: '#/components/schemas/ResponseReasoningSummaryPart'
        status:
          type: string
          enum:
            - in_progress
            - completed
            - incomplete
          description: The status of the reasoning item.
      required:
        - type
        - id
        - summary
    ResponseReasoningSummaryPart:
      type: object
      description: A summary part of a reasoning item.
      properties:
        type:
          type: string
          enum:
            - summary_text
          description: The type of the summary. Always `summary_text`.
        text:
          type: string
          description: A summary of the reasoning output from the model.
      required:
        - type
        - text
    ResponseUsage:
      type: object
      description: Token usage details for the response.
      properties:
        input_tokens:
          type: integer
          format: int64
          default: 0
          description: The number of input tokens.
        input_tokens_details:
          type: object
          description: A detailed breakdown of the input tokens.
          properties:
            cached_tokens:
              type: integer
              format: int64
              default: 0
              description: The number of tokens retrieved from the cache.
        output_tokens:
          type: integer
          format: int64
          default: 0
          description: The number of output tokens.
        output_tokens_details:
          type: object
          description: A detailed breakdown of the output tokens.
          properties:
            reasoning_tokens:
              type: integer
              format: int64
              default: 0
              description: The number of reasoning tokens.
        total_tokens:
          type: integer
          format: int64
          default: 0
          description: The total number of tokens used (input + output).
      required:
        - input_tokens
        - output_tokens
        - total_tokens
    ResponseStreamEvent:
      type: object
      description: >
        A server-sent event emitted while streaming a response. The Responses
        API emits a sequence of typed events (for example `response.created`,
        `response.output_text.delta`, and `response.completed`). This schema
        models the common event envelope; which fields are populated depends on
        the event `type`.
      properties:
        type:
          type: string
          description: >
            The type of the streamed event, for example
            `response.output_text.delta` or `response.completed`.
        sequence_number:
          type: integer
          description: The sequence number of this event.
        response:
          $ref: '#/components/schemas/Response'
        item_id:
          type: string
          description: The ID of the output item this event relates to.
        output_index:
          type: integer
          description: The index of the output item in the response's output array.
        content_index:
          type: integer
          description: The index of the content part within the output item.
        delta:
          type: string
          description: The incremental text delta for `*.delta` events.
        text:
          type: string
          description: The finalized text for `*.done` events.
      required:
        - type
    MessagesError:
      type: object
      description: |
        An error response in the Anthropic error format.
      properties:
        type:
          type: string
          enum:
            - error
          description: Always `error`.
        error:
          type: object
          description: The error details.
          properties:
            type:
              type: string
              description: The error type (e.g. `invalid_request_error`, `api_error`).
            message:
              type: string
              description: A human-readable error message.
          required:
            - type
            - message
      required:
        - type
        - error
    CacheControl:
      type: object
      description: |
        Cache control settings for prompt caching. Currently only
        `ephemeral` caching is supported.
      properties:
        type:
          type: string
          enum:
            - ephemeral
          description: The cache control type. Currently only `ephemeral`.
      required:
        - type
    MessagesTextBlock:
      type: object
      description: A text content block in a Messages API request or response.
      properties:
        type:
          type: string
          enum:
            - text
          description: Content type identifier. Always `text`.
        text:
          type: string
          description: The text content.
        cache_control:
          $ref: '#/components/schemas/CacheControl'
      required:
        - type
        - text
    MessagesImageSource:
      type: object
      description: |
        The source of an image content block. Can be a base64-encoded
        image or a URL.
      properties:
        type:
          type: string
          enum:
            - base64
            - url
          description: The source type.
        media_type:
          type: string
          description: |
            The media type of the image (e.g. `image/jpeg`, `image/png`,
            `image/gif`, `image/webp`). Required when `type` is `base64`.
        data:
          type: string
          description: |
            Base64-encoded image data. Required when `type` is `base64`.
        url:
          type: string
          description: |
            URL of the image. Required when `type` is `url`.
      required:
        - type
    MessagesImageBlock:
      type: object
      description: An image content block in a Messages API request.
      properties:
        type:
          type: string
          enum:
            - image
          description: Content type identifier. Always `image`.
        source:
          $ref: '#/components/schemas/MessagesImageSource'
        cache_control:
          $ref: '#/components/schemas/CacheControl'
      required:
        - type
        - source
    MessagesDocumentSource:
      type: object
      description: |
        The source of a document content block. Can be a base64-encoded
        document or a URL.
      properties:
        type:
          type: string
          enum:
            - base64
            - url
          description: The source type.
        media_type:
          type: string
          description: |
            The media type of the document (e.g. `application/pdf`).
            Required when `type` is `base64`.
        data:
          type: string
          description: |
            Base64-encoded document data. Required when `type` is `base64`.
        url:
          type: string
          description: |
            URL of the document. Required when `type` is `url`.
      required:
        - type
    MessagesDocumentBlock:
      type: object
      description: A document content block in a Messages API request.
      properties:
        type:
          type: string
          enum:
            - document
          description: Content type identifier. Always `document`.
        source:
          $ref: '#/components/schemas/MessagesDocumentSource'
        cache_control:
          $ref: '#/components/schemas/CacheControl'
      required:
        - type
        - source
    MessagesToolUseBlock:
      type: object
      description: A tool use content block in a Messages API request or response.
      properties:
        type:
          type: string
          enum:
            - tool_use
          description: Content type identifier. Always `tool_use`.
        id:
          type: string
          description: The unique identifier for this tool use block.
        name:
          type: string
          description: The name of the tool being called.
        input:
          type: object
          description: The input parameters for the tool.
          additionalProperties: true
      required:
        - type
        - id
        - name
        - input
    MessagesToolResultBlock:
      type: object
      description: A tool result content block in a Messages API request.
      properties:
        type:
          type: string
          enum:
            - tool_result
          description: Content type identifier. Always `tool_result`.
        tool_use_id:
          type: string
          description: The ID of the tool use this result is for.
        content:
          description: |
            The result content. Can be a string or an array of content blocks.
          oneOf:
            - type: string
              description: Text result content.
            - type: array
              items:
                $ref: '#/components/schemas/MessagesTextBlock'
        is_error:
          type: boolean
          description: Whether the tool execution resulted in an error.
        cache_control:
          $ref: '#/components/schemas/CacheControl'
      required:
        - type
        - tool_use_id
    MessagesThinkingBlock:
      type: object
      description: A thinking content block in a Messages API request or response.
      properties:
        type:
          type: string
          enum:
            - thinking
          description: Content type identifier. Always `thinking`.
        thinking:
          type: string
          description: The thinking content.
        signature:
          type: string
          description: |
            The signature for verifying the thinking content. Must be
            passed back when continuing a conversation with extended thinking.
      required:
        - type
        - thinking
        - signature
    MessagesRedactedThinkingBlock:
      type: object
      description: |
        A redacted thinking content block in a Messages API request or
        response. Emitted when thinking content is encrypted for safety
        reasons; must be passed back unchanged in multi-turn conversations.
      properties:
        type:
          type: string
          enum:
            - redacted_thinking
          description: Content type identifier. Always `redacted_thinking`.
        data:
          type: string
          description: The encrypted thinking content.
      required:
        - type
        - data
    MessagesRequestContentBlock:
      type: object
      description: A content block within a Messages API request message.
      oneOf:
        - $ref: '#/components/schemas/MessagesTextBlock'
        - $ref: '#/components/schemas/MessagesImageBlock'
        - $ref: '#/components/schemas/MessagesToolUseBlock'
        - $ref: '#/components/schemas/MessagesToolResultBlock'
        - $ref: '#/components/schemas/MessagesDocumentBlock'
        - $ref: '#/components/schemas/MessagesThinkingBlock'
        - $ref: '#/components/schemas/MessagesRedactedThinkingBlock'
    MessagesMessage:
      type: object
      description: A message in a Messages API request.
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          x-enum-varnames:
            - MessagesMessageRoleUser
            - MessagesMessageRoleAssistant
          description: The role of the message sender.
        content:
          description: |
            The content of the message. Can be a string or an array of
            content blocks.
          oneOf:
            - type: string
              description: Text content.
            - type: array
              items:
                $ref: '#/components/schemas/MessagesRequestContentBlock'
      required:
        - role
        - content
    MessagesTool:
      type: object
      description: |
        A tool definition in the Messages API format. Uses the same
        function tool shape as the Responses API but with an optional
        `cache_control` field for prompt caching.
      properties:
        name:
          type: string
          description: The name of the tool.
        description:
          type: string
          description: A description of what the tool does.
        input_schema:
          $ref: '#/components/schemas/FunctionParameters'
        cache_control:
          $ref: '#/components/schemas/CacheControl'
      required:
        - name
        - input_schema
    MessagesToolChoice:
      description: |
        Controls which (if any) tool is called by the model. `auto` means
        the model can decide, `any` means the model must use a tool, and
        `tool` forces a specific tool.
      oneOf:
        - type: string
          enum:
            - auto
            - any
          description: The tool choice mode.
        - type: object
          description: Forces the model to use a specific tool.
          properties:
            type:
              type: string
              enum:
                - tool
              x-enum-varnames:
                - MessagesToolChoiceTypeTool
              description: Always `tool`.
            name:
              type: string
              description: The name of the tool to use.
          required:
            - type
            - name
    MessagesMetadata:
      type: object
      description: Metadata for a Messages API request.
      properties:
        user_id:
          type: string
          description: An external identifier for the user.
    CreateMessagesRequest:
      type: object
      description: |
        Request body for creating a message via the Anthropic-compatible
        Messages API.
      properties:
        model:
          type: string
          description: The model to use for generating the message.
        max_tokens:
          type: integer
          description: |
            The maximum number of tokens to generate before stopping.
        system:
          description: |
            The system prompt. Can be a string or an array of system content
            blocks (for prompt caching).
          oneOf:
            - type: string
              description: System prompt as a string.
            - type: array
              items:
                $ref: '#/components/schemas/MessagesTextBlock'
        messages:
          type: array
          description: |
            The messages to generate a response for. Each message has a
            `role` (user or assistant) and `content`.
          items:
            $ref: '#/components/schemas/MessagesMessage'
        tools:
          type: array
          description: |
            Definitions of tools the model may call. Each tool can include
            `cache_control` for prompt caching.
          items:
            $ref: '#/components/schemas/MessagesTool'
        tool_choice:
          $ref: '#/components/schemas/MessagesToolChoice'
        stream:
          type: boolean
          default: false
          description: |
            Whether to stream the response using server-sent events.
        temperature:
          type: number
          format: float
          description: |
            Amount of randomness injected into the response. Ranges from
            0.0 to 1.0. Use closer to 0 for analytical / multiple choice,
            closer to 1 for creative and generative tasks.
        top_p:
          type: number
          format: float
          description: |
            Use nucleus sampling. Only consider the tokens with top_p
            probability mass.
        top_k:
          type: integer
          description: |
            Only sample from the top K options for each subsequent token.
        stop_sequences:
          type: array
          description: |
            Custom text sequences that will cause the model to stop
            generating.
          items:
            type: string
        metadata:
          $ref: '#/components/schemas/MessagesMetadata'
        thinking:
          type: object
          description: |
            Configuration for extended thinking.
          properties:
            type:
              type: string
              enum:
                - enabled
              description: Always `enabled`.
            budget_tokens:
              type: integer
              description: |
                The maximum number of tokens the model is allowed to use
                for thinking.
          required:
            - type
            - budget_tokens
      required:
        - model
        - max_tokens
        - messages
    MessagesResponseContentBlock:
      type: object
      description: A content block within a Messages API response.
      oneOf:
        - $ref: '#/components/schemas/MessagesTextBlock'
        - $ref: '#/components/schemas/MessagesToolUseBlock'
        - $ref: '#/components/schemas/MessagesThinkingBlock'
        - $ref: '#/components/schemas/MessagesRedactedThinkingBlock'
    MessagesUsage:
      type: object
      description: |
        Token usage statistics for a Messages API response, including
        cache metrics.
      properties:
        input_tokens:
          type: integer
          format: int64
          default: 0
          description: The number of input tokens.
        output_tokens:
          type: integer
          format: int64
          default: 0
          description: The number of output tokens.
        cache_creation_input_tokens:
          type: integer
          format: int64
          default: 0
          description: |
            The number of tokens used for cache creation.
        cache_read_input_tokens:
          type: integer
          format: int64
          default: 0
          description: |
            The number of tokens read from the cache.
      required:
        - input_tokens
        - output_tokens
    MessagesResponse:
      type: object
      description: |
        A message response from the Anthropic-compatible Messages API.
      properties:
        id:
          type: string
          description: Unique identifier for this message.
        type:
          type: string
          enum:
            - message
          description: Always `message`.
        role:
          type: string
          enum:
            - assistant
          x-enum-varnames:
            - MessagesResponseRoleAssistant
          description: Always `assistant`.
        content:
          type: array
          description: The content blocks generated by the model.
          items:
            $ref: '#/components/schemas/MessagesResponseContentBlock'
        model:
          type: string
          description: The model used to generate the message.
        stop_reason:
          type: string
          enum:
            - end_turn
            - max_tokens
            - stop_sequence
            - tool_use
            - pause_turn
            - refusal
          description: |
            The reason the model stopped generating.
        stop_sequence:
          type: string
          nullable: true
          description: |
            The stop sequence that caused the model to stop, if any.
        usage:
          $ref: '#/components/schemas/MessagesUsage'
      required:
        - id
        - type
        - role
        - content
        - model
        - stop_reason
        - usage
    MessagesStreamEvent:
      type: object
      description: |
        A server-sent event emitted while streaming a Messages API response.
        The Anthropic Messages API emits a sequence of typed events
        (`message_start`, `content_block_start`, `content_block_delta`,
        `content_block_stop`, `message_delta`, `message_stop`, `ping`).
      properties:
        type:
          type: string
          enum:
            - message_start
            - content_block_start
            - content_block_delta
            - content_block_stop
            - message_delta
            - message_stop
            - ping
            - error
          description: The type of the streamed event.
        message:
          $ref: '#/components/schemas/MessagesResponse'
          description: |
            Present in `message_start` events. Contains the initial message.
        index:
          type: integer
          description: |
            Present in `content_block_*` events. The index of the content
            block.
        content_block:
          $ref: '#/components/schemas/MessagesResponseContentBlock'
          description: |
            Present in `content_block_start` events. Contains the content
            block.
        delta:
          type: object
          description: |
            Present in `content_block_delta` and `message_delta` events.
            Contains the incremental update.
          properties:
            type:
              type: string
              description: |
                The type of delta. For text deltas this is `text_delta`,
                for streamed tool inputs this is `input_json_delta`, for
                thinking deltas this is `thinking_delta`, for thinking
                signatures this is `signature_delta`.
            text:
              type: string
              description: The incremental text (for `text_delta`).
            partial_json:
              type: string
              description: |
                The incremental JSON string of the tool input
                (for `input_json_delta`).
            thinking:
              type: string
              description: The incremental thinking content (for `thinking_delta`).
            signature:
              type: string
              description: The thinking signature (for `signature_delta`).
            stop_reason:
              type: string
              description: The stop reason (for `message_delta`).
            stop_sequence:
              type: string
              nullable: true
              description: The stop sequence (for `message_delta`).
        usage:
          $ref: '#/components/schemas/MessagesUsage'
          description: |
            Present in `message_delta` events as a sibling of `delta`.
            Contains cumulative usage for the message.
        error:
          $ref: '#/components/schemas/MessagesError'
          description: |
            Present in `error` events. Contains the error details.
      required:
        - type
    Config:
      x-config:
        sections:
          - general:
              title: 'General settings'
              settings:
                - name: environment
                  env: 'ENVIRONMENT'
                  type: string
                  default: 'production'
                  description: 'The environment'
                - name: allowed_models
                  env: 'ALLOWED_MODELS'
                  type: string
                  default: ''
                  description: 'Comma-separated list of models to allow. If empty, all models will be available'
                - name: disallowed_models
                  env: 'DISALLOWED_MODELS'
                  type: string
                  default: ''
                  description: 'Comma-separated list of models to disallow. If empty, no models will be blocked. Takes lower precedence than ALLOWED_MODELS'
                - name: enable_vision
                  env: 'ENABLE_VISION'
                  type: bool
                  default: 'false'
                  description: 'Enable vision/multimodal support for all providers. When disabled, image inputs will be rejected even if the provider and model support vision'
                - name: debug_content_truncate_words
                  env: 'DEBUG_CONTENT_TRUNCATE_WORDS'
                  type: int
                  default: '10'
                  description: 'Number of words to truncate per content section in debug logs (development mode only)'
                - name: debug_max_messages
                  env: 'DEBUG_MAX_MESSAGES'
                  type: int
                  default: '100'
                  description: 'Maximum number of messages to show in debug logs (development mode only)'
          - telemetry:
              title: 'Telemetry'
              settings:
                - name: telemetry_enabled
                  env: 'TELEMETRY_ENABLED'
                  type: bool
                  default: 'false'
                  description: 'Enable telemetry'
                - name: telemetry_metrics_push_enabled
                  env: 'TELEMETRY_METRICS_PUSH_ENABLED'
                  type: bool
                  default: 'false'
                  description: 'Enable the OTLP metrics push endpoint (POST /v1/metrics)'
                - name: telemetry_metrics_port
                  env: 'TELEMETRY_METRICS_PORT'
                  type: string
                  default: '9464'
                  description: 'Port for telemetry metrics server'
                - name: telemetry_tracing_enabled
                  env: 'TELEMETRY_TRACING_ENABLED'
                  type: bool
                  default: 'false'
                  description: 'Enable OpenTelemetry tracing spans (requires TELEMETRY_ENABLED)'
                - name: telemetry_tracing_otlp_endpoint
                  env: 'TELEMETRY_TRACING_OTLP_ENDPOINT'
                  type: string
                  default: 'http://localhost:4318'
                  description: 'OTLP HTTP endpoint for trace export'
          - mcp:
              title: 'Model Context Protocol (MCP)'
              settings:
                - name: mcp_enabled
                  env: 'MCP_ENABLED'
                  type: bool
                  default: 'false'
                  description: 'Enable MCP'
                - name: mcp_expose
                  env: 'MCP_EXPOSE'
                  type: bool
                  default: 'false'
                  description: 'Expose MCP tools endpoint'
                - name: mcp_servers
                  env: 'MCP_SERVERS'
                  type: string
                  description: 'List of MCP servers'
                - name: mcp_include_tools
                  env: 'MCP_INCLUDE_TOOLS'
                  type: string
                  description: 'Comma-separated list of MCP tool names to inject. If empty, all tools are injected. Takes precedence over MCP_EXCLUDE_TOOLS'
                - name: mcp_exclude_tools
                  env: 'MCP_EXCLUDE_TOOLS'
                  type: string
                  description: 'Comma-separated list of MCP tool names to skip injecting. If empty, no tools are excluded. Takes lower precedence than MCP_INCLUDE_TOOLS'
                - name: mcp_client_timeout
                  env: 'MCP_CLIENT_TIMEOUT'
                  type: time.Duration
                  default: '5s'
                  description: 'MCP client HTTP timeout'
                - name: mcp_dial_timeout
                  env: 'MCP_DIAL_TIMEOUT'
                  type: time.Duration
                  default: '3s'
                  description: 'MCP client dial timeout'
                - name: mcp_tls_handshake_timeout
                  env: 'MCP_TLS_HANDSHAKE_TIMEOUT'
                  type: time.Duration
                  default: '3s'
                  description: 'MCP client TLS handshake timeout'
                - name: mcp_response_header_timeout
                  env: 'MCP_RESPONSE_HEADER_TIMEOUT'
                  type: time.Duration
                  default: '3s'
                  description: 'MCP client response header timeout'
                - name: mcp_expect_continue_timeout
                  env: 'MCP_EXPECT_CONTINUE_TIMEOUT'
                  type: time.Duration
                  default: '1s'
                  description: 'MCP client expect continue timeout'
                - name: mcp_request_timeout
                  env: 'MCP_REQUEST_TIMEOUT'
                  type: time.Duration
                  default: '5s'
                  description: 'MCP client request timeout for initialize and tool calls'
                - name: mcp_max_retries
                  env: 'MCP_MAX_RETRIES'
                  type: int
                  default: '3'
                  description: 'Maximum number of connection retry attempts'
                - name: mcp_retry_interval
                  env: 'MCP_RETRY_INTERVAL'
                  type: time.Duration
                  default: '5s'
                  description: 'Interval between connection retry attempts'
                - name: mcp_initial_backoff
                  env: 'MCP_INITIAL_BACKOFF'
                  type: time.Duration
                  default: '1s'
                  description: 'Initial backoff duration for exponential backoff retry'
                - name: mcp_enable_reconnect
                  env: 'MCP_ENABLE_RECONNECT'
                  type: bool
                  default: 'true'
                  description: 'Enable automatic reconnection for failed servers'
                - name: mcp_reconnect_interval
                  env: 'MCP_RECONNECT_INTERVAL'
                  type: time.Duration
                  default: '30s'
                  description: 'Interval between reconnection attempts'
                - name: mcp_polling_enabled
                  env: 'MCP_POLLING_ENABLED'
                  type: bool
                  default: 'true'
                  description: 'Enable health check polling'
                - name: mcp_polling_interval
                  env: 'MCP_POLLING_INTERVAL'
                  type: time.Duration
                  default: '30s'
                  description: 'Interval between health check polling requests'
                - name: mcp_polling_timeout
                  env: 'MCP_POLLING_TIMEOUT'
                  type: time.Duration
                  default: '5s'
                  description: 'Timeout for individual health check requests'
                - name: mcp_disable_healthcheck_logs
                  env: 'MCP_DISABLE_HEALTHCHECK_LOGS'
                  type: bool
                  default: 'true'
                  description: 'Disable health check log messages to reduce noise'
          - auth:
              title: 'Authentication'
              settings:
                - name: auth_enabled
                  env: 'AUTH_ENABLED'
                  type: bool
                  default: 'false'
                  description: 'Enable authentication'
                - name: auth_oidc_issuer
                  env: 'AUTH_OIDC_ISSUER'
                  type: string
                  default: 'http://keycloak:8080/realms/inference-gateway-realm'
                  description: 'OIDC issuer URL'
                - name: auth_oidc_client_id
                  env: 'AUTH_OIDC_CLIENT_ID'
                  type: string
                  default: 'inference-gateway-client'
                  description: 'OIDC client ID'
                  secret: true
                - name: auth_oidc_client_secret
                  env: 'AUTH_OIDC_CLIENT_SECRET'
                  type: string
                  description: 'OIDC client secret'
                  secret: true
          - guardrails:
              title: 'Guardrails'
              settings:
                - name: guardrails_enabled
                  env: 'GUARDRAILS_ENABLED'
                  type: bool
                  default: 'false'
                  description: 'Enable gateway guardrails (OPA/Rego policy enforcement)'
                - name: guardrails_policy_dir
                  env: 'GUARDRAILS_POLICY_DIR'
                  type: string
                  description: 'Directory of .rego files compiled at startup'
                - name: guardrails_fail_mode
                  env: 'GUARDRAILS_FAIL_MODE'
                  type: string
                  default: 'closed'
                  description: 'closed or open: behavior on policy/external error or timeout'
                - name: guardrails_external_url
                  env: 'GUARDRAILS_EXTERNAL_URL'
                  type: string
                  description: 'Optional external HTTP guardrail service'
                - name: guardrails_external_timeout
                  env: 'GUARDRAILS_EXTERNAL_TIMEOUT'
                  type: time.Duration
                  default: '5s'
                  description: 'Timeout for the external guardrail service'
          - server:
              title: 'Server settings'
              settings:
                - name: host
                  env: 'SERVER_HOST'
                  type: string
                  default: '0.0.0.0'
                  description: 'Server host'
                - name: port
                  env: 'SERVER_PORT'
                  type: string
                  default: '8080'
                  description: 'Server port'
                - name: read_timeout
                  env: 'SERVER_READ_TIMEOUT'
                  type: time.Duration
                  default: '30s'
                  description: 'Read timeout'
                - name: write_timeout
                  env: 'SERVER_WRITE_TIMEOUT'
                  type: time.Duration
                  default: '30s'
                  description: 'Write timeout'
                - name: idle_timeout
                  env: 'SERVER_IDLE_TIMEOUT'
                  type: time.Duration
                  default: '120s'
                  description: 'Idle timeout'
                - name: max_request_body_size
                  env: 'SERVER_MAX_REQUEST_BODY_SIZE'
                  type: int
                  default: '10485760'
                  description: 'Maximum request body size in bytes (10 MiB)'
                - name: tls_cert_path
                  env: 'SERVER_TLS_CERT_PATH'
                  type: string
                  description: 'TLS certificate path'
                - name: tls_key_path
                  env: 'SERVER_TLS_KEY_PATH'
                  type: string
                  description: 'TLS key path'
          - client:
              title: 'Client settings'
              settings:
                - name: timeout
                  env: 'CLIENT_TIMEOUT'
                  type: time.Duration
                  default: '30s'
                  description: 'Client timeout'
                - name: max_idle_conns
                  env: 'CLIENT_MAX_IDLE_CONNS'
                  type: int
                  default: '20'
                  description: 'Maximum idle connections'
                - name: max_idle_conns_per_host
                  env: 'CLIENT_MAX_IDLE_CONNS_PER_HOST'
                  type: int
                  default: '20'
                  description: 'Maximum idle connections per host'
                - name: idle_conn_timeout
                  env: 'CLIENT_IDLE_CONN_TIMEOUT'
                  type: time.Duration
                  default: '30s'
                  description: 'Idle connection timeout'
                - name: tls_min_version
                  env: 'CLIENT_TLS_MIN_VERSION'
                  type: string
                  default: 'TLS12'
                  description: 'Minimum TLS version'
                - name: disable_compression
                  env: 'CLIENT_DISABLE_COMPRESSION'
                  type: bool
                  default: 'true'
                  description: 'Disable compression for faster streaming'
                - name: response_header_timeout
                  env: 'CLIENT_RESPONSE_HEADER_TIMEOUT'
                  type: time.Duration
                  default: '10s'
                  description: 'Response header timeout'
                - name: expect_continue_timeout
                  env: 'CLIENT_EXPECT_CONTINUE_TIMEOUT'
                  type: time.Duration
                  default: '1s'
                  description: 'Expect continue timeout'
          - providers:
              title: 'Providers'
              settings:
                - name: anthropic_api_url
                  env: 'ANTHROPIC_API_URL'
                  type: string
                  default: 'https://api.anthropic.com/v1'
                  description: 'Anthropic API URL'
                - name: anthropic_api_key
                  env: 'ANTHROPIC_API_KEY'
                  type: string
                  description: 'Anthropic API Key'
                  secret: true
                - name: cloudflare_api_url
                  env: 'CLOUDFLARE_API_URL'
                  type: string
                  default: 'https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai'
                  description: 'Cloudflare API URL'
                - name: cloudflare_api_key
                  env: 'CLOUDFLARE_API_KEY'
                  type: string
                  description: 'Cloudflare API Key'
                  secret: true
                - name: cohere_api_url
                  env: 'COHERE_API_URL'
                  type: string
                  default: 'https://api.cohere.ai'
                  description: 'Cohere API URL'
                - name: cohere_api_key
                  env: 'COHERE_API_KEY'
                  type: string
                  description: 'Cohere API Key'
                  secret: true
                - name: groq_api_url
                  env: 'GROQ_API_URL'
                  type: string
                  default: 'https://api.groq.com/openai/v1'
                  description: 'Groq API URL'
                - name: groq_api_key
                  env: 'GROQ_API_KEY'
                  type: string
                  description: 'Groq API Key'
                  secret: true
                - name: llamacpp_api_url
                  env: 'LLAMACPP_API_URL'
                  type: string
                  default: 'http://llamacpp:8080/v1'
                  description: 'llama.cpp API URL'
                - name: llamacpp_api_key
                  env: 'LLAMACPP_API_KEY'
                  type: string
                  description: 'llama.cpp API Key'
                  secret: true
                - name: ollama_api_url
                  env: 'OLLAMA_API_URL'
                  type: string
                  default: 'http://ollama:8080/v1'
                  description: 'Ollama API URL'
                - name: ollama_api_key
                  env: 'OLLAMA_API_KEY'
                  type: string
                  description: 'Ollama API Key'
                  secret: true
                - name: ollama_cloud_api_url
                  env: 'OLLAMA_CLOUD_API_URL'
                  type: string
                  default: 'https://ollama.com/v1'
                  description: 'Ollama Cloud API URL'
                - name: ollama_cloud_api_key
                  env: 'OLLAMA_CLOUD_API_KEY'
                  type: string
                  description: 'Ollama Cloud API Key'
                  secret: true
                - name: openai_api_url
                  env: 'OPENAI_API_URL'
                  type: string
                  default: 'https://api.openai.com/v1'
                  description: 'OpenAI API URL'
                - name: openai_api_key
                  env: 'OPENAI_API_KEY'
                  type: string
                  description: 'OpenAI API Key'
                  secret: true
                - name: deepseek_api_url
                  env: 'DEEPSEEK_API_URL'
                  type: string
                  default: 'https://api.deepseek.com'
                  description: 'DeepSeek API URL'
                - name: deepseek_api_key
                  env: 'DEEPSEEK_API_KEY'
                  type: string
                  description: 'DeepSeek API Key'
                  secret: true
                - name: google_api_url
                  env: 'GOOGLE_API_URL'
                  type: string
                  default: 'https://generativelanguage.googleapis.com/v1beta/openai'
                  description: 'Google API URL'
                - name: google_api_key
                  env: 'GOOGLE_API_KEY'
                  type: string
                  description: 'Google API Key'
                  secret: true
                - name: mistral_api_url
                  env: 'MISTRAL_API_URL'
                  type: string
                  default: 'https://api.mistral.ai/v1'
                  description: 'Mistral API URL'
                - name: mistral_api_key
                  env: 'MISTRAL_API_KEY'
                  type: string
                  description: 'Mistral API Key'
                  secret: true
                - name: minimax_api_url
                  env: 'MINIMAX_API_URL'
                  type: string
                  default: 'https://api.minimax.io/v1'
                  description: 'MiniMax API URL'
                - name: minimax_api_key
                  env: 'MINIMAX_API_KEY'
                  type: string
                  description: 'MiniMax API Key'
                  secret: true
                - name: moonshot_api_url
                  env: 'MOONSHOT_API_URL'
                  type: string
                  default: 'https://api.moonshot.ai/v1'
                  description: 'Moonshot API URL'
                - name: moonshot_api_key
                  env: 'MOONSHOT_API_KEY'
                  type: string
                  description: 'Moonshot API Key'
                  secret: true
                - name: nvidia_api_url
                  env: 'NVIDIA_API_URL'
                  type: string
                  default: 'https://integrate.api.nvidia.com/v1'
                  description: 'NVIDIA API URL'
                - name: nvidia_api_key
                  env: 'NVIDIA_API_KEY'
                  type: string
                  description: 'NVIDIA API Key'
                  secret: true
                - name: zai_api_url
                  env: 'ZAI_API_URL'
                  type: string
                  default: 'https://api.z.ai/api/paas/v4'
                  description: 'ZAI API URL'
                - name: zai_api_key
                  env: 'ZAI_API_KEY'
                  type: string
                  description: 'ZAI API Key'
                  secret: true
          - routing:
              title: 'Routing'
              settings:
                - name: routing_enabled
                  env: 'ROUTING_ENABLED'
                  type: bool
                  default: 'false'
                  description: 'Enable gateway-native model routing: logical model aliases backed by a pool of upstream provider deployments, selected round-robin per replica. Opt-in; when disabled, direct provider/model routing is unchanged'
                - name: routing_config_path
                  env: 'ROUTING_CONFIG_PATH'
                  type: string
                  default: ''
                  description: 'Path to a YAML file mapping logical model aliases to their upstream deployment pools. Required when ROUTING_ENABLED is true'