Dubhe AI provides an OpenAI-compatible API. Use our models with the standard OpenAI SDK — just change the base_url.
Every request requires your API key in the Authorization header:
Authorization: Bearer sk-your-api-key-here
Get your API key from the Dashboard after signing up.
Getting a Key: Register and log into the Dashboard, then generate a key under "API Keys".
| Model | API ID | Context | Best For |
|---|---|---|---|
| Dubhe Fast | dubhe-fast | 128K | Fast responses, general chat, everyday use |
| Dubhe Vision | dubhe-vision | 1M | Image understanding, multimodal, long context |
| Dubhe Reasoning | dubhe-reasoning | 128K | Deep reasoning, complex problems, advanced analysis |
| Dubhe Code | dubhe-code | 128K | Code generation, programming assistance |
| Dubhe Agent | dubhe-agent | 1M | Agentic tasks, tool use, multi-agent workflows |
| Dubhe Qwen | dubhe-qwen | 128K | Balanced performance, general purpose |
| Model | Streaming | Function Calling | Vision |
|---|---|---|---|
| Dubhe Fast | ✓ | ✓ | ✗ |
| Dubhe Vision | ✓ | ✓ | ✓ |
| Dubhe Reasoning | ✓ | ✓ | ✗ |
| Dubhe Code | ✓ | ✓ | ✗ |
| Dubhe Agent | ✓ | ✓ | ✗ |
| Dubhe Qwen | ✓ | ✓ | ✗ |
Send a message to the AI and get a response. This is the primary API endpoint.
curl https://dubhehub.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "dubhe-fast",
"messages": [{"role": "user", "content": "Hello!"}],
"max_tokens": 100
}'
curl https://dubhehub.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "dubhe-fast",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": true
}'
from openai import OpenAI
client = OpenAI(
base_url="https://dubhehub.com/v1",
api_key="YOUR_API_KEY"
)
# Non-streaming
response = client.chat.completions.create(
model="dubhe-fast",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="dubhe-fast",
messages=[{"role": "user", "content": "Hello!"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://dubhehub.com/v1',
apiKey: 'YOUR_API_KEY'
});
// Non-streaming
const response = await client.chat.completions.create({
model: 'dubhe-fast',
messages: [{ role: 'user', content: 'Hello!' }]
});
console.log(response.choices[0].message.content);
// Streaming
const stream = await client.chat.completions.create({
model: 'dubhe-fast',
messages: [{ role: 'user', content: 'Hello!' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
Non-streaming: choices[].message contains the full response.
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "dubhe-fast",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 15,
"total_tokens": 25
}
}
Streaming: choices[].delta contains incremental content:
delta.content — text fragment, concatenate for full replydelta.role — only appears in the first chunkchoices[].finish_reason is not null, streaming is completeReturns all models available to your account.
curl https://dubhehub.com/v1/models \ -H "Authorization: Bearer YOUR_API_KEY"
| Plan | Price | Models | Included Tokens |
|---|---|---|---|
| Free | $0 | Dubhe Fast | 100K |
| Starter | $9/month | Fast, Vision | 1M |
| Pro | $29/month | Fast, Vision, Reasoning, Code | 10M |
| Ultimate | $99/month | All 6 models | 50M |
Need more tokens? Recharge anytime. See full pricing.
| Code | Meaning | Common Cause | Solution |
|---|---|---|---|
| 400 | Bad Request | Invalid JSON, missing required fields | Check request body format |
| 401 | Unauthorized | API key invalid, missing, or expired | Confirm Authorization: Bearer <key> is correct; regenerate key in Dashboard |
| 402 | Insufficient Balance | Account balance or plan quota exhausted | Recharge or upgrade your plan |
| 404 | Not Found | Wrong API path or model name | Check the endpoint URL and model parameter |
| 422 | Unprocessable | Parameter type or value out of range | Adjust parameters based on error message |
| 429 | Rate Limited | Too many requests in short time | Reduce frequency; add delays between batch requests |
| 500 | Server Error | Upstream model service exception | Retry later; contact support if persistent |
| 502 | Bad Gateway | Upstream model service unreachable | Check network or retry later |
| 503 | Service Unavailable | Model under maintenance | Check announcements or retry later |
Retry strategy: For 429 and 5xx errors, use exponential backoff — start with a 1-second wait, then double each time.
WebSocket support is on the roadmap for real-time streaming conversations.
Expected endpoint: wss://dubhehub.com/v1/ws/chat
In the meantime, use HTTP Streaming:
curl https://dubhehub.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"model": "dubhe-fast", "messages": [{"role": "user", "content": "Hello!"}], "stream": true}'
Click the chat button (bottom-right corner) on our homepage to talk to us directly.