Skip to navigation
Unified Mode

cURL (Unified Mode)

Raw HTTP examples for the unified endpoint

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.enterpriserouter.com/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.enterpriserouter.com/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.enterpriserouter.com/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.enterpriserouter.com/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.enterpriserouter.com/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:

{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "anthropic/claude-sonnet-4-6",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 9,
"total_tokens": 21
}
}

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).