Whether you’re integrating directly with OpenAI, using a framework like Langchain or LlamaIndex, or building standalone applications, the AI Gateway offers a flexible, secure, and efficient way to manage and deploy AI-powered features.
2 Ways to Integrate
The AI Gateway can be accessed through two primary methods, each catering to different use cases and integration requirements:
1. OpenAI SDK through the AI Gateway
Ideal for: Python, Node.js, or any other application that already uses an OpenAI-compatible client. By changing the base URL and adding gateway-specific headers, you can integrate the AI Gateway’s features into your existing setup. This is also how frameworks like Langchain and LlamaIndex connect to the gateway.
Installing the SDK
Choose the SDK that matches your development environment:
Usage
Point the client at https://aigw.portkey.ai/v1, authenticate with your AI Gateway API key, and prefix the model name with your provider slug.
Learn more here.
2. REST API
Ideal for: applications that prefer RESTful services. The base URL for all REST API requests is https://aigw.portkey.ai/v1, with an authentication header.
Learn more here. Last modified on September 15, 2026