Send messages to any LLM provider. Supports text, images, streaming, and tool use. The gateway automatically translates between OpenAI, Anthropic, and Gemini formats.
curl -X POST http://GATEWAY/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer gw-YOUR_KEY" \
-d '{
"model": "openai/gpt-5.4",
"messages": [
{"role": "system", "content": "You are helpful."},
{"role": "user", "content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
]}
],
"max_completion_tokens": 1024,
"stream": true
}'
from openai import OpenAI
client = OpenAI(
base_url="http://GATEWAY/v1",
api_key="gw-YOUR_KEY"
)
response = client.chat.completions.create(
model="openai/gpt-5.4",
messages=[
{"role": "system", "content": "You are helpful."},
{"role": "user", "content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
]}
],
max_completion_tokens=1024,
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")