Quick Start
Get started with CHMU Hub API in minutes.
1 Step 1: Get Your API Key
Register an account and create your API key from the dashboard.
- Register at CHMU Hub
- Go to API Keys page
- Click Create New Key and save it securely
export CHMUHUB_API_KEY="sk-chmuhub-your-key-here"2 Step 2: Make Your First Chat Request
If you use the OpenAI SDK, just change the base URL — your existing code works as-is.
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="sk-chmuhub-...",
base_url="https://api.chmuhub.com/v1/public" # Only change this line
)
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)JavaScript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-chmuhub-...',
baseURL: 'https://api.chmuhub.com/v1/public',
});
const res = await client.chat.completions.create({
model: 'gpt-5',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(res.choices[0].message.content);cURL
curl https://api.chmuhub.com/v1/public/chat/completions \
-H "Authorization: Bearer sk-chmuhub-..." \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5","messages":[{"role":"user","content":"Hello!"}]}'Response
{
"id": "chatcmpl-abc123",
"choices": [{
"message": { "role": "assistant", "content": "Hello! How can I help?" }
}]
}3 Step 3: Generate Images
Image generation is async. Submit a request, then poll for results.
Full Python example
import time, requests
API_KEY = "sk-chmuhub-..."
BASE = "https://api.chmuhub.com/v1/public"
headers = {"Authorization": f"Bearer {API_KEY}"}
# 1. Submit generation request
res = requests.post(f"{BASE}/images/generations", headers=headers, json={
"model": "gpt-image-2",
"prompt": "A sunset over mountains, oil painting style",
"resolution": "2k"
})
task_id = res.json()["task_id"]
print(f"Task created: {task_id}")
# 2. Poll for completion
while True:
status = requests.get(f"{BASE}/tasks/{task_id}", headers=headers).json()
print(f" Status: {status['status']}")
if status["status"] in ("COMPLETED", "FAILED"):
break
time.sleep(5)
# 3. Get result
if status["status"] == "COMPLETED":
print(f"Image URL: {status['imageUrl']}")4 Step 4: Generate Videos
Video generation follows the same async pattern as images.
Full Python example
import time, requests
API_KEY = "sk-chmuhub-..."
BASE = "https://api.chmuhub.com/v1/public"
headers = {"Authorization": f"Bearer {API_KEY}"}
# 1. Submit generation request
res = requests.post(f"{BASE}/videos/generations", headers=headers, json={
"model": "sora-2",
"prompt": "A golden retriever running in a sunlit field",
"duration": 10
})
task_id = res.json()["task_id"]
print(f"Task created: {task_id}")
# 2. Poll for completion (videos take longer, ~1-3 min)
while True:
status = requests.get(f"{BASE}/tasks/{task_id}", headers=headers).json()
print(f" Status: {status['status']} Progress: {status.get('progress', '-')}%")
if status["status"] in ("COMPLETED", "FAILED"):
break
time.sleep(5)
# 3. Get result
if status["status"] == "COMPLETED":
print(f"Video URL: {status['videoUrl']}")Next Steps
- API Reference -- Full endpoint documentation with all parameters
- Models -- See every available model and its capabilities
- Pricing -- Understand credit costs for each model