API Documentation

Dubhe AI provides an OpenAI-compatible API. Use our models with the standard OpenAI SDK — just change the base_url.

Authentication

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".

Available Models

ModelAPI IDContextBest For
Dubhe Fastdubhe-fast128KFast responses, general chat, everyday use
Dubhe Visiondubhe-vision1MImage understanding, multimodal, long context
Dubhe Reasoningdubhe-reasoning128KDeep reasoning, complex problems, advanced analysis
Dubhe Codedubhe-code128KCode generation, programming assistance
Dubhe Agentdubhe-agent1MAgentic tasks, tool use, multi-agent workflows
Dubhe Qwendubhe-qwen128KBalanced performance, general purpose

Capability Matrix

ModelStreamingFunction CallingVision
Dubhe Fast
Dubhe Vision
Dubhe Reasoning
Dubhe Code
Dubhe Agent
Dubhe Qwen

Chat Completions

POST/v1/chat/completions
Full URL: https://dubhehub.com/v1/chat/completions

Send a message to the AI and get a response. This is the primary API endpoint.

Basic Request (curl)

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
  }'

Streaming Request

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
  }'

Python (OpenAI SDK)

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="")

Node.js (OpenAI SDK)

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 || '');
}

Response Format

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:

List Models

GET/v1/models
Full URL: https://dubhehub.com/v1/models

Returns all models available to your account.

curl https://dubhehub.com/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

Pricing Plans

PlanPriceModelsIncluded Tokens
Free$0Dubhe Fast100K
Starter$9/monthFast, Vision1M
Pro$29/monthFast, Vision, Reasoning, Code10M
Ultimate$99/monthAll 6 models50M

Need more tokens? Recharge anytime. See full pricing.

Error Codes

CodeMeaningCommon CauseSolution
400Bad RequestInvalid JSON, missing required fieldsCheck request body format
401UnauthorizedAPI key invalid, missing, or expiredConfirm Authorization: Bearer <key> is correct; regenerate key in Dashboard
402Insufficient BalanceAccount balance or plan quota exhaustedRecharge or upgrade your plan
404Not FoundWrong API path or model nameCheck the endpoint URL and model parameter
422UnprocessableParameter type or value out of rangeAdjust parameters based on error message
429Rate LimitedToo many requests in short timeReduce frequency; add delays between batch requests
500Server ErrorUpstream model service exceptionRetry later; contact support if persistent
502Bad GatewayUpstream model service unreachableCheck network or retry later
503Service UnavailableModel under maintenanceCheck 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 (Coming Soon)

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}'

Need Help?

Click the chat button (bottom-right corner) on our homepage to talk to us directly.