For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DashboardSign Up
  • Getting Started
    • Welcome
    • Quick Start
    • Authentication
  • Native Mode
    • Overview
    • OpenAI
    • Anthropic
    • Gemini
  • Unified Mode
    • Overview
    • Python
    • TypeScript
    • cURL
  • Platform
    • Key Management
    • Rate Limits & Budgets
    • Usage & Billing
    • Error Reference
  • API Reference
DashboardSign Up
On this page
  • Basic request
  • Calling Anthropic
  • Calling Gemini
  • Streaming
  • Tool calling
  • Response format
Unified Mode

cURL (Unified Mode)

Raw HTTP examples for the unified endpoint
Was this page helpful?
Edit this page
Previous

Key Management

Create, configure, and manage proxy keys
Next
Built with

The unified endpoint is POST /v1/chat/completions. It accepts an OpenAI-compatible request body and returns an OpenAI-compatible response, regardless of which provider handles the request.

Basic request

$curl -X POST https://api.trygateway.ai/v1/chat/completions \
> -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "openai/gpt-4o",
> "messages": [
> {"role": "user", "content": "Hello!"}
> ]
> }'

Calling Anthropic

$curl -X POST https://api.trygateway.ai/v1/chat/completions \
> -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "anthropic/claude-sonnet-4-6",
> "messages": [
> {"role": "system", "content": "You are a helpful assistant."},
> {"role": "user", "content": "What is quantum computing?"}
> ],
> "max_tokens": 512
> }'

Calling Gemini

$curl -X POST https://api.trygateway.ai/v1/chat/completions \
> -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "google/gemini-2.5-flash",
> "messages": [
> {"role": "user", "content": "Write a haiku about APIs."}
> ]
> }'

Streaming

Add "stream": true to get Server-Sent Events:

$curl -X POST https://api.trygateway.ai/v1/chat/completions \
> -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
> -H "Content-Type: application/json" \
> -N \
> -d '{
> "model": "anthropic/claude-sonnet-4-6",
> "messages": [
> {"role": "user", "content": "Write a short story."}
> ],
> "stream": true
> }'

The response is a stream of data: lines in OpenAI’s SSE format:

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Once"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" upon"},"finish_reason":null}]}
...
data: [DONE]

Tool calling

$curl -X POST https://api.trygateway.ai/v1/chat/completions \
> -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "openai/gpt-4o",
> "messages": [
> {"role": "user", "content": "What is the weather in Tokyo?"}
> ],
> "tools": [
> {
> "type": "function",
> "function": {
> "name": "get_weather",
> "description": "Get weather for a city",
> "parameters": {
> "type": "object",
> "properties": {
> "city": {"type": "string"}
> },
> "required": ["city"]
> }
> }
> }
> ],
> "tool_choice": "auto"
> }'

Response format

All responses follow the OpenAI chat completion format:

1{
2 "id": "chatcmpl-abc123",
3 "object": "chat.completion",
4 "model": "anthropic/claude-sonnet-4-6",
5 "choices": [
6 {
7 "index": 0,
8 "message": {
9 "role": "assistant",
10 "content": "Hello! How can I help you today?"
11 },
12 "finish_reason": "stop"
13 }
14 ],
15 "usage": {
16 "prompt_tokens": 12,
17 "completion_tokens": 9,
18 "total_tokens": 21
19 }
20}

For Anthropic and Gemini, the model field in the response includes the provider prefix (e.g., anthropic/claude-sonnet-4-6). For OpenAI, the response uses the provider’s own model identifier (e.g., gpt-4o).