API
UNIT23 exposes an OpenAI-compatible Chat Completions API. Point any OpenAI SDK at our base URL, swap in your key, and you’re done.
Basics
| Base URL | https://api.unit23api.com/v1 |
|---|---|
| Protocol | HTTPS, TLS 1.2+ |
| Auth | HTTP header Authorization: Bearer <API Key> |
| Format | application/json for both request and response |
| Compatibility | OpenAI Chat Completions API |
Authentication
Every request must include your API key in the Authorization header:
Authorization: Bearer unit23-sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx- Key format:
unit23-sk-followed by 48 hexadecimal characters. - Missing or invalid keys return
401.
Chat completions
POST /v1/chat/completions creates a chat completion. Both streaming and non-streaming responses are supported.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID — see Available models below. |
messages | array | Yes | Chat messages, same format as OpenAI. |
max_tokens | integer | No | Max tokens to generate. Unlimited by default. |
temperature | number | No | Sampling temperature, 0–2. Default 1. |
top_p | number | No | Nucleus sampling probability, 0–1. Default 1. |
stop | string / array | No | Stop sequences, up to 4. |
stream | boolean | No | SSE streaming output. Default false. |
stream_options | object | No | We auto-inject {"include_usage": true}. |
seed | integer | No | Fixed random seed for reproducible output. |
tools | array | No | Tool / function calling definitions. |
tool_choice | string / object | No | Tool selection strategy. Default auto. |
response_format | object | No | Output format. Supports json_object. |
cURL
curl https://api.unit23api.com/v1/chat/completions \
-H "Authorization: Bearer unit23-sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v3",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"max_tokens": 100,
"temperature": 0.7
}'Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.unit23api.com/v1",
api_key="unit23-sk-xxx",
)
response = client.chat.completions.create(
model="deepseek-v3",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
max_tokens=100,
temperature=0.7,
)
print(response.choices[0].message.content)JavaScript / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.unit23api.com/v1",
apiKey: "unit23-sk-xxx",
});
const response = await client.chat.completions.create({
model: "deepseek-v3",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Hello!" },
],
max_tokens: 100,
temperature: 0.7,
});
console.log(response.choices[0].message.content);Non-streaming response
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1713456789,
"model": "default",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 21,
"completion_tokens": 9,
"total_tokens": 30
}
}Some models return default in the model field. This does not affect actual usage.
Streaming
Set stream: true to receive Server-Sent Events.
curl https://api.unit23api.com/v1/chat/completions \
-H "Authorization: Bearer unit23-sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v3",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": true
}'SSE response
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"delta":{"role":"assistant"},"index":0}]}
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hello"},"index":0}]}
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"delta":{"content":"!"},"index":0}]}
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":10,"completion_tokens":5,"total_tokens":15}}
data: [DONE]- The last non-empty data line carries the
usagefield — we automatically injectstream_options.include_usage=true. - With the standard OpenAI SDK, the streaming call looks identical to the official API.
Available models
| Model ID | Type | Notes |
|---|---|---|
deepseek-v3.2 | Reasoning | |
deepseek-v3 | Non-reasoning | Alias deepseek-v3.1; equivalent. |
deepseek-r1 | Reasoning | Alias deepseek-r1-0528; includes <think> tag. |
deepseek-r1-distill-qwen-70b | Distilled reasoning | |
minimax-m2.5 | Reasoning | Supports reasoning_content. |
Unsupported names
The following return 404 Not Found:
- Provider-prefixed forms (e.g.
deepseek/xxx,minimax/xxx). - Official upstream aliases such as
deepseek-chat,deepseek-reasoner. - Any model name not listed above.
Parameter support
| Parameter | Status | Notes |
|---|---|---|
max_tokens | Active | Limits generation length. |
temperature | Active | — |
top_p | Active | — |
stop | Active | — |
seed | Active | Reproducible output for the same input. |
stream | Active | include_usage auto-injected. |
tools / tool_choice | Active | Function calling supported. |
response_format | Active | json_object supported; some models support json_schema. |
logprobs / top_logprobs | Model-dependent | Supported by some models. |
Errors
| Status | Type | Description |
|---|---|---|
| 200 | Success | Normal response. |
| 400 | Request error | Missing parameter or unconfigured model. |
| 401 | Auth error | API key missing or invalid. |
| 429 | Rate limit | Too many requests. |
| 502 | Gateway error | Upstream connection failed. |
| 503 | Unavailable | Service temporarily unavailable. |
| 504 | Timeout | Response timeout (30 seconds). |
Error response
{
"error": {
"message": "Invalid API key",
"type": "invalid_request_error"
}
}Limits & notes
- Request timeout: 30 seconds — returns
504on timeout. - Model name case:
MiniMax-M2.5is case-insensitive;minimax-m2.5works too. - Streaming usage: the last SSE chunk contains
usage; non-streaming responses include it at the root level. - CORS: enabled — callable directly from browsers.
- Content safety: please comply with applicable laws. Generating illegal or harmful content is prohibited.
Support
Questions or trouble? Email hello@unit23.xyz.