Docs.qs_title
Docs.qs_subtitle
1 Docs.qs_step1_title
Docs.qs_step1_desc
- Docs.qs_step1_1
- Docs.qs_step1_2
- Docs.qs_step1_3
export CHMUHUB_API_KEY="sk-chmuhub-your-key-here"2 Docs.qs_step2_title
Docs.qs_step2_desc
Docs.qs_code_python
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)Docs.qs_code_js
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);Docs.qs_code_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!"}]}'Docs.qs_code_response
{
"id": "chatcmpl-abc123",
"choices": [{
"message": { "role": "assistant", "content": "Hello! How can I help?" }
}]
}3 Docs.qs_step3_title
Docs.qs_step3_desc
Docs.qs_code_full_python
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 Docs.qs_step4_title
Docs.qs_step4_desc
Docs.qs_code_full_python
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']}")Docs.qs_next
- Docs.qs_next_api_ref -- Docs.qs_next_api_ref_desc
- Docs.qs_next_models -- Docs.qs_next_models_desc
- Docs.qs_next_pricing -- Docs.qs_next_pricing_desc