mixgateway.io Gateway · Quickstart
Overview
mixgateway.io exposes an OpenAI-compatible HTTP API so you can reach multiple model providers (DeepSeek, OpenAI, and others) through a single entrypoint.
- Base URL:
https://api.mixgateway.io/v1 - Chat Completions:
POST /chat/completions - Auth:
Authorization: Bearer {api_key} - Protocol: Largely compatible with OpenAI
chat/completions
Getting an API Key
- Sign up and sign in on the [console](/dashboard).
- Open API Key Management and create a new key.
- Copy the generated
sk-...string (or your gateway’s key format). - Send it on every request:
Authorization: Bearer {api_key}.
Security: Do not hardcode keys in frontend bundles or public repositories. Use server-side config or secrets management.
Non-streaming request example
curl https://api.mixgateway.io/v1/chat/completions \
-H "Authorization: Bearer sk-xxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek:deepseek-chat",
"messages": [
{"role": "user", "content": "Hi, just reply with \"Hi\""}
],
"temperature": 0.7,
"max_tokens": 128,
"stream": false
}'
Sample response
{
"id": "1a9f9f27-ef53-4b0e-8849-465bf8270314",
"object": "chat.completion",
"created": 1772183892,
"model": "deepseek:deepseek-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hi"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 1,
"total_tokens": 9
}
}
In requests, the
modelfield often usesprovider:modelId(for exampledeepseek:deepseek-chat). The gateway routes to the correct upstream based on that value. Exact available models are listed in your console or provider docs.
Streaming request example
curl https://api.mixgateway.io/v1/chat/completions \
-H "Authorization: Bearer sk-xxxx" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "deepseek:deepseek-chat",
"messages": [
{"role": "user", "content": "Introduce yourself in one sentence"}
],
"temperature": 0.7,
"max_tokens": 256,
"stream": true
}'
Typical SSE lines look like:
data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hi"}}], ...}
data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{"content":", I'm a gateway assistant."}}], ...}
data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{"content":""},"finish_reason":"stop"}], "usage":{"prompt_tokens":13,"completion_tokens":10,"total_tokens":23}}
The final chunk may include a usage object for billing and analytics.
Language SDK examples
JavaScript (Node.js, fetch)
const resp = await fetch("https://api.mixgateway.io/v1/chat/completions", {
method: "POST",
headers: {
Authorization: "Bearer sk-xxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "deepseek:deepseek-chat",
messages: [{ role: "user", content: "Hi" }],
stream: false,
}),
});
const data = await resp.json();
console.log(data.choices[0].message.content);
Python (requests)
import requests
url = "https://api.mixgateway.io/v1/chat/completions"
headers = {
"Authorization": "Bearer sk-xxxx",
"Content-Type": "application/json",
}
json_data = {
"model": "deepseek:deepseek-chat",
"messages": [{"role": "user", "content": "Hi"}],
"stream": False,
}
resp = requests.post(url, headers=headers, json=json_data, timeout=30)
data = resp.json()
print(data["choices"][0]["message"]["content"])
Error format
Errors generally follow an OpenAI-style envelope, for example:
{
"error": {
"message": "Incorrect API key provided. For details",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
},
"request_id": "9f6b3bb8-9328-91ad-a5b7-1feed430211b"
}
Common codes you may see:
invalid_api_key— Key missing, revoked, or not accepted.model_not_found— Themodelvalue is not available on this gateway.insufficient_quotaor balance errors — Account quota or prepaid balance insufficient.
Next steps
- Models & Routing —
provider:modelIdconvention and migration tips. - Billing & Usage — Tokens, streaming usage, and viewing bills.
- API Overview — Endpoints and conventions.
- Authentication — Key handling and best practices.