AI Nexus API Reference
Overview
AI Nexus provides an OpenAI-compatible API for all Chinese AI models. If you've used OpenAI's API, you already know how to use ours. Simply change the base URL and API key.
Base URL
Authentication
Include your API key in the Authorization header:
Authorization: Bearer sk-ai-nexus-xxxxxxxx
Get your API key on the AI Nexus homepage. Pay-as-you-go pricing with no hidden fees.
Supported Models
We support all models listed on our Models page. Use the model ID as the model parameter in your requests.
Chat Completions
Create a chat completion. Identical to the OpenAI chat completions API.
POSTRequest Body
{
"model": "deepseek-v4",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 1024
}
Example Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1718000000,
"model": "deepseek-v4",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 10,
"total_tokens": 35
}
}
Streaming
Set stream: true in your request to receive Server-Sent Events (SSE). Each event contains a delta with partial content.
{
"model": "qwen-max",
"messages": [{"role": "user", "content": "Tell me a story"}],
"stream": true
}
Streaming responses use the same format as OpenAI's streaming API.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | — | required Model ID to use |
messages | array | — | required Array of message objects |
temperature | number | 0.7 | Sampling temperature (0–2) |
max_tokens | integer | 4096 | Maximum tokens in response |
top_p | number | 1.0 | Nucleus sampling parameter |
frequency_penalty | number | 0 | Penalize token frequency (−2 to 2) |
presence_penalty | number | 0 | Penalize token presence (−2 to 2) |
stream | boolean | false | Enable SSE streaming |
stop | string/array | null | Stop sequences |
List Models
GETReturns a list of all available models. Response format is identical to OpenAI's model list.
{
"object": "list",
"data": [
{"id": "deepseek-v4", "object": "model", "created": 1718000000, "owned_by": "ai-nexus"},
{"id": "deepseek-v4-flash", "object": "model", ...},
{"id": "qwen-max", "object": "model", ...}
]
}
Check Balance
GETCheck your account balance and usage statistics.
{
"balance": 42.50,
"currency": "USD",
"total_spent": 157.30,
"last_updated": "2025-06-17T12:00:00Z"
}
Error Codes
| Code | Description |
|---|---|
| 400 | Bad request — invalid parameters |
| 401 | Unauthorized — invalid or missing API key |
| 402 | Insufficient balance — top up your account |
| 404 | Model not found — check the model ID |
| 429 | Rate limit exceeded — slow down requests |
| 500 | Internal server error |
Rate Limits
Rate limits vary by plan. Free tier: 10 RPM. Paid plans scale with usage. Contact us for dedicated throughput.