Available on all Portkey plans.
POST /v1/chat/completions request to OpenAI, Anthropic, Gemini, Bedrock, or any of the 3000+ supported models.
Quick Start
Switch
model to use any provider — @anthropic-provider/claude-sonnet-4-5-20250514, @google-provider/gemini-2.0-flash, or any of the 3000+ supported models.Using the OpenAI SDK
The Portkey SDK is a superset of the OpenAI SDK, so all Chat Completions methods work identically. The OpenAI SDK also works directly with Portkey’s base URL:System Messages
Set a system prompt using thesystem role in the messages array:
Streaming
Stream responses token-by-token withstream: true.
Function Calling
Define tools with thetools parameter. Works across all providers that support function calling.
Function Call Results
Pass tool results back to continue the conversation:Vision
Send images in thecontent array using the image_url type. Works with all vision-capable models.
url value:
Python
Structured Output
JSON Schema
Force the model to return structured JSON matching a specific schema:JSON Mode
For free-form JSON output without a strict schema:Multi-turn Conversations
Pass the full conversation history in themessages array:
Using with Portkey Features
Chat Completions works with all Portkey gateway features:- Configs — Route, load balance, and set fallbacks
- Caching — Cache responses for faster, cheaper calls
- Guardrails — Add input/output guardrails
- Observability — Full logging and tracing
API Reference
- Chat Completions —
POST /v1/chat/completions
OpenAI Chat API Docs
OpenAI specification
API Reference
Portkey Chat Completions reference
Universal API
All three API formats
Function Calling Guide
Detailed function calling guide

