You can proxy requests to OpenAI AI models through AI Gateway using the AI Proxy and AI Proxy Advanced plugins. 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 | Upstream path or API |
|---|---|
| Chat completions | /v1/chat/completions |
| Completions | /v1/completions |
| Embeddings | /v1/embeddings |
| Function calling | /v1/chat/completions |
| Files | /v1/files |
| Batches | /v1/batches |
| Assistants | /v1/assistants |
| Responses | /v1/responses |
| Speech | /v1/audio/speech |
| Transcriptions | /v1/audio/transcriptions |
| Translations | /v1/audio/translations |
| Image generations | /v1/images/generations |
| Image edits | /v1/images/edits |
| Video generations | Use the LLM image/generations upstream path |
| Realtime | /v1/realtime |
Supported capabilities
The following tables show the AI capabilities supported by OpenAI provider when used with the AI Proxy or the AI Proxy Advanced plugin.
Set the plugin’s
route_typebased on the capability you want to use. See the tables below for supported route types.
Text generation
Support for OpenAI basic text generation capabilities including chat, completions, and embeddings:
| Capability | Route type | Streaming | Model example | Min version |
|---|---|---|---|---|
| Chat completions | llm/v1/chat |
gpt-4o | 3.6 | |
| Completions | llm/v1/completions |
gpt-4o-mini | 3.6 | |
| Embeddings1 | llm/v1/embeddings |
text-embedding-3-small | 3.11 |
1 Use text-embedding-3-small or text-embedding-3-large for dynamic dimensions.
Advanced text generation
Support for OpenAI function calling to allow OpenAI models to use external tools and APIs:
| Capability | Route type | Model example | Min version |
|---|---|---|---|
| Function calling | llm/v1/chat |
gpt-4o | 3.6 |
Processing
Support for OpenAI file operations, batch operations, assistants, and response handling:
| Capability | Route type | Model example | Min version |
|---|---|---|---|
| Files | llm/v1/files |
n/a | 3.11 |
| Batches | llm/v1/batches |
n/a | 3.11 |
| Assistants2 | llm/v1/assistants |
gpt-4o | 3.11 |
| Responses | llm/v1/responses |
gpt-4o | 3.11 |
2 Requires header OpenAI-Beta: assistants=v2
Audio
Support for OpenAI text-to-speech, transcription, and translation capabilities:
| Capability | Route type | Model example | Min version |
|---|---|---|---|
| Speech | audio/v1/audio/speech |
tts-1 | 3.11 |
| Transcriptions | audio/v1/audio/transcriptions |
whisper-1 | 3.11 |
| Translations | audio/v1/audio/translations |
whisper-1 | 3.11 |
For requests with large payloads, consider increasing
config.max_request_body_sizeto 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 | Route type | Model example | Min version |
|---|---|---|---|
| Generations | image/v1/images/generations |
dall-e-3 | 3.11 |
| Edits | image/v1/images/edits |
dall-e-2 | 3.11 |
For requests with large payloads, consider increasing
config.max_request_body_sizeto 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 | Route type | Model example | Min version |
|---|---|---|---|
| Generations | video/v1/videos/generations |
sora-2 | 3.13 |
For requests with large payloads (video generation), consider increasing
config.max_request_body_sizeto three times the raw binary size.
Realtime
Support for OpenAI’s bidirectional streaming for realtime applications:
Realtime processing requires the AI Proxy Advanced plugin and uses WebSocket protocol.
To use the realtime route, you must configure the protocols
wsand/orwsson both the Service and on the Route where the plugin is associated.
| Capability | Route type | Model example | Min version |
|---|---|---|---|
| Realtime3 | realtime/v1/realtime |
gpt-4o-realtime-preview | 3.11 |
3 For requests to OpenAI realtime API, include include the header OpenAI-Beta: realtime=v1.
OpenAI base URL
The base URL is https://api.openai.com:443/{route_type_path}, where {route_type_path} is determined by the 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 plugin option.
Configure OpenAI with AI Proxy
To use OpenAI with AI Gateway, configure the AI Proxy or AI Proxy Advanced.
Here’s a minimal configuration for chat completions:
For more configuration options and examples, see:
Tutorials
- Control accuracy of LLM models using the AI LLM as judge plugin View →
- Control prompt size with the AI Compressor plugin View →
- Configure dynamic authentication to LLM providers using HashiCorp vault View →
- Filter knowledge base queries with the AI RAG Injector plugin View →
- Get started with AI Gateway View →
- Use AI PII Sanitizer to protect sensitive data in requests View →
- Send asynchronous requests to LLMs View →
- Set up AI Proxy Advanced with OpenAI in Kong Gateway View →
- Set up AI Proxy with OpenAI in Kong Gateway View →
- Validate Gen AI tool calls with Jaeger and OpenTelemetry View →