Skip to main content
The AI Gateway provides a robust and secure gateway to integrate OpenAI’s APIs into your applications, including GPT-4o, o1, DALL·E, Whisper, and more. With the AI Gateway, take advantage of features like fast AI gateway access, observability, prompt management, and more, while securely managing API keys through Model Catalog.

All Models

Full support for GPT-4o, o1, GPT-4, GPT-3.5, and all OpenAI models

All Endpoints

Chat, completions, embeddings, audio, images, and more fully supported

Multi-SDK Support

Use with the OpenAI SDK, REST, or popular frameworks like LangChain

Quick Start

Get OpenAI working in 3 steps:
Tip: You can also send x-portkey-provider: @openai as a header and use just model="gpt-4o" in the request.Legacy support: The virtual_key parameter still works for backwards compatibility.

Add Provider in Model Catalog

  1. Go to Model Catalog → Add Provider
  2. Select OpenAI
  3. Choose existing credentials or create new by entering your OpenAI API key
  4. (Optional) Add your OpenAI Organisation ID and Project ID for better cost tracking
  5. Name your provider (e.g., openai-prod)

Complete Setup Guide →

See all setup options, code examples, and detailed instructions

Basic Usage

Streaming

Stream responses for real-time output in your applications:

Advanced Features

Responses API

OpenAI’s Responses API combines the best of both Chat Completions and Assistants APIs. The AI Gateway fully supports this API.
The Responses API provides a more flexible foundation for building agentic applications with built-in tools that execute automatically.

Remote MCP support on Responses API

The AI Gateway supports Remote MCP support by OpenAI on its Responses API. Learn More

Streaming with Responses API

Realtime API

The AI Gateway supports OpenAI’s Realtime API with a seamless integration. This allows you to use the AI Gateway’s logging, cost tracking, and guardrail features while using the Realtime API.

Realtime API

Using Vision Models

The AI Gateway’s multimodal Gateway fully supports OpenAI vision models as well. See this guide for more info:

Vision with the Responses API

The Responses API also processes images alongside text:

Function Calling

Function calls within your OpenAI SDK operations remain standard. These logs will appear in the AI Gateway, highlighting the utilized functions and their outputs. Additionally, you can define functions within your prompts and call POST /v1/prompts/{promptId}/completions as above.

Function Calling with the Responses API

The Responses API also supports function calling with the same powerful capabilities:

Fine-Tuning

Please refer to our fine-tuning guides to take advantage of the AI Gateway’s advanced continuous fine-tuning capabilities.

Image Generation

The AI Gateway supports multiple modalities for OpenAI. Make image generation requests through AI Gateway the same way as making completion calls.
The AI Gateway’s fast AI gateway captures the information about the request on Strata Cloud Manager. On your logs screen, you’d be able to see this request with the request and response. More information on image generation is available in the API Reference.

Video Generation with Sora

The AI Gateway supports OpenAI’s Sora video generation models through the AI Gateway. Generate videos using the AI Gateway Python SDK:
Pricing for video generation requests will be visible on Strata Cloud Manager, allowing you to track costs alongside your other API usage.

Audio - Transcription, Translation, and Text-to-Speech

The AI Gateway’s multimodal Gateway also supports the audio methods on OpenAI API. Check out the below guides for more info: Check out the below guides for more info:

Integrated Tools with Responses API

Web Search Tool

Web search delivers accurate and clearly-cited answers from the web, using the same tool as search in ChatGPT:
Options for search_context_size:
  • high: Most comprehensive context, higher cost, slower response
  • medium: Balanced context, cost, and latency (default)
  • low: Minimal context, lowest cost, fastest response
Responses include citations for URLs found in search results, with clickable references.

File Search Tool

File search enables quick retrieval from your knowledge base across multiple file types:
This tool requires you to first create a vector store and upload files to it. Supports various file formats including PDFs, DOCXs, TXT, and more. Results include file citations in the response.

Enhanced Reasoning

Control the depth of model reasoning for more comprehensive analysis:

Computer Use Assistant

The AI Gateway also supports the Computer Use Assistant (CUA) tool, which helps agents control computers or virtual machines through screenshots and actions. This feature is available for select developers as a research preview on premium tiers.
Learn More about Computer use tool here

Managing OpenAI Projects & Organisations in the AI Gateway

When integrating OpenAI with the AI Gateway, specify your OpenAI organisation and project IDs along with your API key. This is particularly useful if you belong to multiple organisations or are accessing projects through a legacy user API key. Specifying the organisation and project IDs helps you maintain better control over your access rules, usage, and costs. Add your Org & Project details using:
  1. Adding in Model Catalog (Recommended)
  2. Defining a Gateway Config
  3. Passing Details in a Request
Let’s explore each method in more detail.

Using Model Catalog

When adding OpenAI from the Model Catalog, the AI Gateway automatically displays optional fields for the organisation ID and project ID alongside the API key field. Get your OpenAI API key from here, then add it to the AI Gateway along with your org/project details. The AI Gateway takes budget management a step further than OpenAI. While OpenAI allows setting budget limits per project, the AI Gateway enables you to set budget limits for each provider you create. For more information on budget limits, refer to this documentation:

Using the Gateway Config

You can also specify the organisation and project details in the gateway config, either at the root level or within a specific target.

While Making a Request

You can also pass your organisation and project details directly when making a request using curl or the OpenAI SDK.

Frequently Asked Questions

General FAQs

You can sign up to OpenAI here and grab your scoped API key here.
The OpenAI API can be used by signing up to the OpenAI platform. You can find the pricing info here
You can find your current rate limits imposed by OpenAI here. For more tips, check out this guide.
Last modified on September 15, 2026