Available on all AI Gateway plans.
POST /v1/chat/completions request to OpenAI, Anthropic, Gemini, Bedrock, or any of the 3,000+ 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 3,000+ supported models.Using the OpenAI SDK
Point the OpenAI SDK at the AI Gateway’s base URL and all Chat Completions methods work unchanged: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 AI Gateway Features
Chat Completions works with all AI 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
AI Gateway Chat Completions reference
Universal API
All three API formats
Function Calling Guide
Detailed function calling guide

