-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenapi.yaml
More file actions
4253 lines (4237 loc) · 145 KB
/
Copy pathopenapi.yaml
File metadata and controls
4253 lines (4237 loc) · 145 KB
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
---
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
- Images
- 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
- Images
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: Images
description: Generate images using the OpenAI-compatible Images 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
- modalities
- pricing
description: |
Comma-separated list of metadata keys to include in the response.
Supported values: `pricing`, `context_window`, `modalities`.
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'
includeModalities:
summary: Models with modalities metadata
value:
object: 'list'
data:
- id: 'openai/gpt-4o'
object: 'model'
created: 1686935002
owned_by: 'openai'
served_by: 'openai'
modalities:
- text
- image
- id: 'openai/gpt-4-turbo'
object: 'model'
created: 1687882410
owned_by: 'openai'
served_by: 'openai'
modalities:
- text
- image
'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, modalities"
'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: []
/images/generations:
post:
operationId: createImage
tags:
- Images
description: |
Creates an image given a prompt using the OpenAI-compatible Images API.
The request returns one or more generated images as URLs or base64-encoded
JSON data.
Not every provider implements the Images 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 an image
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/CreateImageRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ImagesResponse'
'400':
$ref: '#/components/responses/ImagesNotSupported'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
/images/edits:
post:
operationId: createImageEdit
tags:
- Images
description: |
Creates an edited or extended image given an original image and a prompt
using the OpenAI-compatible Images API. The request is sent as
`multipart/form-data` with the image file as a binary upload.
Not every provider implements the Images 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 an image edit or extension
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/CreateImageEditRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ImagesResponse'
'400':
$ref: '#/components/responses/ImagesNotSupported'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
/images/variations:
post:
operationId: createImageVariation
tags:
- Images
description: |
Creates a variation of a given image using the OpenAI-compatible Images
API. The request is sent as `multipart/form-data` with the image file
as a binary upload.
Not every provider implements the Images 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 an image variation
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/CreateImageVariationRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ImagesResponse'
'400':
$ref: '#/components/responses/ImagesNotSupported'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
/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'
CreateImageRequest:
required: true
description: |
Request payload for the Images API. Mirrors the OpenAI
`POST /v1/images/generations` request body.
content:
application/json:
schema:
$ref: '#/components/schemas/CreateImageRequest'
CreateImageEditRequest:
required: true
description: |
Request payload for the Images Edits API. Mirrors the OpenAI
`POST /v1/images/edits` request body. Sent as `multipart/form-data`
with the image file as a binary upload.
content:
multipart/form-data:
schema:
type: object
properties:
image:
type: string
format: binary
description: The image to edit. For the GPT image models, a `png`, `webp`, or `jpg` file up to 50MB; for `dall-e-2`, a square PNG under 4MB. If `mask` is not provided, the image must have transparency, which will be used as the mask.
prompt:
type: string
description: A text description of the desired image.
mask:
type: string
format: binary
description: An additional image whose fully transparent areas (alpha = 0) indicate where the image should be edited. Must be a valid PNG file with the same dimensions as the image (under 4MB for `dall-e-2`).
model:
type: string
description: Model ID to use for image editing.
n:
type: integer
minimum: 1
maximum: 10
default: 1
description: Number of images to generate.
size:
$ref: '#/components/schemas/ImageSize'
quality:
type: string
enum:
- auto
- standard
- low
- medium
- high
description: |
The quality of the edited image. `auto` selects the best
quality for the model. The GPT image models support `low`,
`medium`, and `high`; `dall-e-2` supports only `standard`.
response_format:
type: string
enum:
- url
- b64_json
default: url
description: The format in which the generated images are returned.
required:
- image
- prompt
CreateImageVariationRequest:
required: true
description: |
Request payload for the Images Variations API. Mirrors the OpenAI
`POST /v1/images/variations` request body. Sent as `multipart/form-data`
with the image file as a binary upload.
content:
multipart/form-data:
schema:
type: object
properties:
image:
type: string
format: binary
description: The image to use as the basis for the variation. For the GPT image models, a `png`, `webp`, or `jpg` file up to 50MB; for `dall-e-2`, a square PNG under 4MB.
model:
type: string
description: Model ID to use for image variation.
n:
type: integer
minimum: 1
maximum: 10
default: 1
description: Number of images to generate.
size:
$ref: '#/components/schemas/ImageSize'
response_format:
type: string
enum:
- url
- b64_json
default: url
description: The format in which the generated images are returned.
required:
- image
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.'
ImagesNotSupported:
description: |
The selected provider does not implement the Images API. The
gateway returns this when a request is routed to a provider without
Images support.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: 'The Images 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':