Quick start
Get your first AI response in under 5 minutes. ChengQiu AI is fully OpenAI-compatible — if your code works with OpenAI, just change the base URL.
Get your API key
Sign in to the console with your API key. Don't have one? Contact us to get one.
Set your base URL
Point your OpenAI SDK or HTTP client to our API endpoint.
Make your first request
Use curl or any OpenAI SDK:
curl https://api.chengqiukeji.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-your-api-key" \ -d '{ "model": "deepseek-r1:7b", "messages": [{"role": "user", "content": "Hello!"}] }'
That's it!
You'll receive a JSON response in OpenAI format. Try the Playground to test interactively.
Authentication
All API requests require a Bearer token in the Authorization header:
Authorization: Bearer sk-your-api-key
Your API key starts with sk-. Keep it secure — do not expose it in client-side code or public repositories.
Note: Admin tokens start with sk-admin- and have access to key management endpoints. Regular API keys can only make inference requests.
Base URL
All endpoints listed below are relative to this base URL. For example, /chat/completions becomes https://api.chengqiukeji.com/v1/chat/completions.
Chat completions
Creates a model response for the given chat conversation. Fully compatible with OpenAI's chat completions API.
/v1/chat/completions
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID, e.g. deepseek-r1:7b |
| messages | array | Yes | Array of message objects with role and content |
| max_tokens | integer | No | Max tokens to generate (default: 500) |
| temperature | float | No | Sampling temperature 0-2 (default: 0.7) |
| stream | boolean | No | Stream response via SSE (default: false) |
| top_p | float | No | Nucleus sampling parameter (default: 0.9) |
Example response
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"model": "deepseek-r1:7b",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 8,
"total_tokens": 18
}
}
List models
/v1/models
Returns a list of available models.
{
"object": "list",
"data": [
{ "id": "deepseek-r1:7b", "object": "model" }
]
}
Streaming
Set "stream": true to receive Server-Sent Events (SSE). Each chunk is a JSON object ending with data: [DONE].
data: {"choices":[{"delta":{"content":"Hello"},"index":0}]}
data: {"choices":[{"delta":{"content":"!"},"index":0}]}
data: {"choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
data: [DONE]
Code examples
🐍 Python (OpenAI SDK)
from openai import OpenAI client = OpenAI( base_url="https://api.chengqiukeji.com/v1", api_key="sk-your-api-key" ) # Non-streaming response = client.chat.completions.create( model="deepseek-r1:7b", messages=[{"role": "user", "content": "What is the capital of Vietnam?"}], max_tokens=100 ) print(response.choices[0].message.content) # Streaming stream = client.chat.completions.create( model="deepseek-r1:7b", messages=[{"role": "user", "content": "Write a haiku about Singapore"}], stream=True ) for chunk in stream: print(chunk.choices[0].delta.content or "", end="")
🟨 JavaScript (Node.js)
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.chengqiukeji.com/v1", apiKey: process.env.CQ_API_KEY }); const response = await client.chat.completions.create({ model: "deepseek-r1:7b", messages: [{ role: "user", content: "Explain quantum computing simply" }], max_tokens: 200 }); console.log(response.choices[0].message.content);
🐘 PHP (Guzzle)
$client = new GuzzleHttp\Client(); $response = $client->post('https://api.chengqiukeji.com/v1/chat/completions', [ 'headers' => [ 'Authorization' => 'Bearer sk-your-api-key', 'Content-Type' => 'application/json', ], 'json' => [ 'model' => 'deepseek-r1:7b', 'messages' => [['role' => 'user', 'content' => 'Hello!']], ], ]); $data = json_decode($response->getBody(), true); echo $data['choices'][0]['message']['content'];
☕ Java (OkHttp)
OkHttpClient client = new OkHttpClient(); RequestBody body = RequestBody.create( "{\"model\":\"deepseek-r1:7b\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello!\"}]}", MediaType.parse("application/json") ); Request request = new Request.Builder() .url("https://api.chengqiukeji.com/v1/chat/completions") .addHeader("Authorization", "Bearer sk-your-api-key") .post(body) .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());
Error codes
| Status | Meaning | How to fix |
|---|---|---|
| 200 | Success | All good! |
| 401 | Unauthorized | Check your API key is valid |
| 402 | Payment required | Your balance is empty — recharge in console |
| 422 | Validation error | Check request body format |
| 429 | Rate limited | Slow down — check your rate limit |
| 500 | Server error | Retry after a few seconds |
FAQ
Is it really OpenAI-compatible?
Yes. We implement the same /v1/chat/completions and /v1/models endpoints with identical request/response formats. If your code uses the OpenAI SDK, just change base_url and api_key.
How am I billed?
You're billed per 1,000 tokens (prompt + completion combined). The rate is $0.002/1K tokens for the Starter plan. Each request's cost is deducted from your balance in real-time.
Where is the server located?
Our GPU server is in Singapore (Tencent Cloud HAI). Average latency from Southeast Asian cities is under 50ms.
Do you store my data?
No. We log token counts and costs for billing, but we do not store the content of your requests or responses. Your data is processed in memory and immediately discarded.
Can I pay in my local currency?
Billing is in USD. You can settle via bank transfer, Wise, or cryptocurrency. Contact us for local payment options in SGD, MYR, IDR, THB, or VND.
What's the rate limit?
Starter plan: 30 requests/minute. Business plan: 200 requests/minute. Enterprise: unlimited. Rate limits are per API key.
How do I get support?
Email support@chengqiukeji.com or message us on Telegram. Enterprise customers get priority response within 1 hour.
Still have questions? Contact support