You can proxy requests to OpenAI AI models through AI Gateway by creating AI Model Provider and AI Model entities. This reference documents all supported AI capabilities, configuration requirements, and provider-specific details needed for proper integration.
OpenAI provider
Upstream paths
AI Gateway automatically routes requests to the appropriate OpenAI API endpoints. The following table shows the upstream paths used for each capability.
|
Capability |
Path template |
Description |
Upstream path or API |
|---|---|---|---|
| Generate |
/chat/completions, /completions, or /responses
|
Text generation for chat completions and responses |
/v1/chat/completions
|
| Agentic |
/assistants or /responses
|
Agent and assistant-based interactions |
/v1/assistants and /v1/responses
|
| Realtime |
/realtime
|
Bidirectional streaming for real-time applications |
/v1/realtime
|
| Embeddings |
/embeddings
|
Vector embeddings from text input |
/v1/embeddings
|
| Image |
/images/generations or /images/edits
|
Image generation and editing |
/v1/images/generations and /v1/images/edits
|
| Audio speech |
/audio/speech
|
Text-to-speech synthesis |
/v1/audio/speech
|
| Audio transcription |
/audio/transcriptions
|
Speech-to-text conversion |
/v1/audio/transcriptions
|
| Audio translation |
/audio/translations
|
Audio translation between languages |
/v1/audio/translations
|
| Video |
/videos
|
Video generation |
/v1/videos
|
| Batches |
/batches
|
Batch processing of requests |
/v1/batches
|
| Files |
/files
|
File management and storage |
/v1/files
|
Supported capabilities
The following tables show the AI capabilities supported by the OpenAI provider when configuring AI Models.
By default, AI Gateway uses the path templates shown in the tables below (e.g.,
/chat/completions,/embeddings, etc.). To customize these paths, configure theconfig.pathsfield in your AI Model entity. Custom paths take the form{configured_path}/{template_path}— for example, if you set a custom path of/v2, requests to/embeddingswould be routed to/v2/embeddings.
Text generation
Support for OpenAI text generation capabilities:
|
Capability |
Streaming |
Model example |
Path template |
Min version |
|---|---|---|---|---|
| generate | Supported | gpt-4o |
/chat/completions, /completions, or /responses
|
2.0 |
Embeddings
Support for OpenAI embeddings generation:
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| embeddings1 | text-embedding-3-small |
/embeddings
|
2.0 |
1 Use text-embedding-3-small or text-embedding-3-large for dynamic dimensions.
Agentic
Support for OpenAI agent and assistant capabilities:
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| agentic2 | gpt-4o |
/assistants or /responses
|
2.0 |
2 Requires header OpenAI-Beta: assistants=v2
Audio
Support for OpenAI audio capabilities (speech synthesis, transcription, and translation):
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| speech | tts-1 |
/audio/speech
|
2.0 |
| transcription | whisper-1 |
/audio/transcriptions
|
2.0 |
| translation | whisper-1 |
/audio/translations
|
2.0 |
For requests with large payloads, consider increasing
config.max_request_body_sizeon your AI Model entity to three times the raw binary size.Supported audio formats, voices, and parameters vary by model. Refer to your provider’s documentation for available options.
Image
Support for OpenAI image generation and editing capabilities:
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| image | gpt-image-1.5 |
/images/generations or /images/edits
|
2.0 |
For requests with large payloads, consider increasing
config.max_request_body_sizeon your AI Model entity to three times the raw binary size.Supported image sizes and formats vary by model. Refer to your provider’s documentation for allowed dimensions and requirements.
Video
Support for OpenAI video generation capabilities:
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| video | sora-2 |
/videos
|
2.0 |
For requests with large payloads (video generation), consider increasing
config.max_request_body_sizeon your AI Model entity to three times the raw binary size.
Realtime
Support for OpenAI’s bidirectional streaming for realtime applications:
Realtime processing uses WebSocket protocol (ws/wss). This protocol is automatically enabled when you configure your AI Model with the realtime capability.
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| realtime3 | gpt-4o-realtime-preview |
/realtime
|
2.0 |
3 For requests to OpenAI realtime API, include the header OpenAI-Beta: realtime=v1.
Batches
Support for OpenAI batch processing capabilities:
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| batches | n/a |
/batches
|
2.0 |
Batches are configured on a separate AI Model with
type: "api", distinct from regular models that handle synchronous capabilities like generate and embeddings. Create a dedicated AI Model exclusively for batches and files, as each model must be either a regular model or an API model, not both.
Files
Support for OpenAI file management capabilities:
|
Capability |
Model example |
Path template |
Min version |
|---|---|---|---|
| files | n/a |
/files
|
2.0 |
Batches are configured on a separate AI Model with
type: "api", distinct from regular models that handle synchronous capabilities like generate and embeddings. Create a dedicated AI Model exclusively for batches and files, as each model must be either a regular model or an API model, not both.## OpenAI base URL
The base URL is https://api.openai.com:443/{capability_path}. The {capability_path} is determined by the AI capability.
AI Gateway uses this URL automatically. You only need to configure a URL if you’re using a self-hosted or OpenAI-compatible endpoint, in which case set the upstream_url option in your AI Model configuration.
Configure OpenAI
To use OpenAI with AI Gateway, configure a new AI Model Provider. You can then access supported AI Models from OpenAI.
Here’s a minimal configuration for chat completions: