兩套模型、兩套呼叫方式,互不相干——你只會用到其中一套。
文字用 河蚌V1(OpenAI 相容), 影片用 超級河蚌(一次呼叫拿網址)。
登入 hebangai.com →「點數與儲值」→ 建立金鑰。金鑰以 sk-rly- 開頭,明文只顯示一次,請當場存好。
OpenAI 相容。把 base_url 換成上面那個位址,其餘寫法一個字都不用改。支援 stream 串流:帶 stream: true 即可。計費走上游回傳的實際 usage,和非串流一樣精確。
curl https://hebangai.com/relay/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-rly-你的金鑰" \
-d '{
"model": "河蚌V1",
"messages": [{"role": "user", "content": "你好"}]
}'# 帶 stream: true 就是串流,計費一樣精確
curl https://hebangai.com/relay/v1/chat/completions -H "Authorization: Bearer $MUSSEL_KEY" -H "Content-Type: application/json" -d '{
"model": "河蚌V1",
"messages": [{"role": "user", "content": "寫一句開場白"}],
"stream": true
}'
# → data: {"choices":[{"delta":{"content":"夜"}}]} …
# data: [DONE]
#
# 要拿 token 用量就再帶 stream_options: {"include_usage": true},
# 最後一塊會帶上 usage。沒帶的話我們不會多送那一塊給你。from openai import OpenAI
client = OpenAI(
base_url="https://hebangai.com/relay/v1",
api_key="sk-rly-你的金鑰",
)
r = client.chat.completions.create(
model="河蚌V1",
messages=[{"role": "user", "content": "你好"}],
)
print(r.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://hebangai.com/relay/v1",
apiKey: "sk-rly-你的金鑰",
});
const r = await client.chat.completions.create({
model: "河蚌V1",
messages: [{ role: "user", content: "你好" }],
});
console.log(r.choices[0].message.content);影片是另一個端點:POST /videos/generations。參數就是普通的 JSON 欄位,等待由我們代勞,回應直接給你影片網址。
curl https://hebangai.com/relay/v1/videos/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-rly-你的金鑰" \
--max-time 300 \
-d '{
"model": "超級河蚌",
"prompt": "一隻橘貓在窗台醒來,晨光斜照,鏡頭緩緩推近",
"resolution": "720p",
"duration": 5,
"ratio": "16:9"
}'
# → {"video_url":"https://...","duration":5,"resolution":"720p","model":"超級河蚌"}import requests
r = requests.post(
"https://hebangai.com/relay/v1/videos/generations",
headers={"Authorization": "Bearer sk-rly-你的金鑰"},
json={
"model": "超級河蚌",
"prompt": "一隻橘貓在窗台醒來,晨光斜照,鏡頭緩緩推近",
"resolution": "720p", # 480p | 720p
"duration": 5, # 3 ~ 12 秒
"ratio": "16:9", # 16:9 | 9:16 | 1:1 | 4:3 | 3:4 | 21:9
# 圖生影片就多加這一行:
# "first_frame_url": "https://example.com/first.jpg",
},
timeout=300, # 出片要 30~60 秒,別設太短
)
print(r.json()["video_url"])const r = await fetch("https://hebangai.com/relay/v1/videos/generations", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer sk-rly-你的金鑰",
},
body: JSON.stringify({
model: "超級河蚌",
prompt: "一隻橘貓在窗台醒來,晨光斜照,鏡頭緩緩推近",
resolution: "720p",
duration: 5,
ratio: "16:9",
}),
// Node 預設沒有超時,瀏覽器有;出片要 30~60 秒,別自己設短了
});
const { video_url } = await r.json();
console.log(video_url);參數範圍:解析度 480p / 720p / 1080p;長度最長 12 秒 (最短依機型而定,見下表); 比例 16:9 | 9:16 | 1:1 | 4:3 | 3:4 | 21:9。 圖生影片傳 first_frame_url。
| model | 特點 | 最短 | 多圖參考 |
|---|---|---|---|
超級河蚌 | 穩定的基本款,畫質與運鏡都夠用 | 3 秒 | — |
超級河蚌快速 | 同代的快速版,最便宜,適合試鏡頭 | 3 秒 | — |
超級河蚌1.5 | 介於兩代之間 | 5 秒 | — |
超級河蚌2.0 | 目前最強。吃多張參考圖,可開音畫同步 | 5 秒 | 最多 4 張 |
超級河蚌2.0快速 | 2.0 的快速版 | 5 秒 | 最多 4 張 |
超級河蚌2.5 | 畫質最好,最長 15 秒;但沒有 1080p(只有 480p/720p) | 5 秒 | 最多 4 張 |
傳的秒數低於該機型的下限時,我們會自動抬到下限再送,不會讓你收到一個 莫名其妙的參數錯誤。每個代號也都有純 ASCII 寫法(super-hebang、super-hebang-2…),程式裡不方便放中文時可以用。
reference_images — 字串陣列,最多 4 張。多個角色一起送,模型讓他們同框演; 這是 2.0 最主要的優勢,只傳 first_frame_url 等於當成單圖模型用。generate_audio — 布林,預設 false。開了模型會自己生 對白與環境音、口型對齊。上面那支已經夠用。只有兩種情況需要看這一節:你要自己控制輪詢節奏,或者提交後先斷開、稍後再取結果。介面就是業界通用的「提交 → 輪詢」兩步:POST 拿 task id,GET 查狀態。 你若已經在接別家的非同步影片 API,多半只要改 base_url 與 model 名, 其餘一行不動。
# 1) 提交任務
curl https://hebangai.com/relay/v1/contents/generations/tasks \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-rly-你的金鑰" \
-d '{
"model": "超級河蚌",
"content": [{
"type": "text",
"text": "一隻橘貓在窗台醒來 --resolution 720p --duration 5 --ratio 16:9"
}]
}'
# → {"id":"cgt-xxxx","model":"超級河蚌"}
# 2) 輪詢(約 30~60 秒出片)
curl https://hebangai.com/relay/v1/contents/generations/tasks/cgt-xxxx \
-H "Authorization: Bearer sk-rly-你的金鑰"
# → {"status":"succeeded","content":{"video_url":"https://..."}}
# 這一套的參數寫在提示詞尾巴,不是 JSON 欄位
# 圖生影片:content 再加一項
# {"type":"image_url","image_url":{"url":"https://..."},"role":"first_frame"}兩套共用同一本帳,混著用也不會重複扣費:同一個任務只會結算一次。
一次呼叫直接拿圖,**沒有內容濾網**。比例懶得算就傳 ratio(9:16/16:9/1:1…), 要精確控制就直接傳 size(例如 1024x1024)。
curl https://hebangai.com/relay/v1/images/generations -H "Authorization: Bearer $MUSSEL_KEY" -H "Content-Type: application/json" -d '{
"model": "超級河蚌繪圖",
"prompt": "夜晚的東京街頭,霓虹倒映在濕漉的地面",
"ratio": "9:16"
}'
# → {"model":"超級河蚌繪圖","data":[{"url":"https://..."}],
# "usage":{"generated_images":1,"output_tokens":5184}}import requests
r = requests.post(
"https://hebangai.com/relay/v1/images/generations",
headers={"Authorization": f"Bearer {KEY}"},
json={
"model": "super-hebang-img", # ASCII 代號,免打中文
"prompt": "夜晚的東京街頭,霓虹倒映在濕漉的地面",
"size": "1024x1024",
# 參考圖:一張給字串、多張給陣列,最多 4 張
# "image": "https://example.com/face.jpg",
},
timeout=120,
)
print(r.json()["data"][0]["url"])const r = await fetch("https://hebangai.com/relay/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUSSEL_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "super-hebang-img",
prompt: "夜晚的東京街頭,霓虹倒映在濕漉的地面",
ratio: "9:16",
}),
});
const { data } = await r.json();
console.log(data[0].url);image: 一張給字串、多張給陣列,最多 4 張。同一批人要出現在新畫面裡就靠它。n 大於 1 會直接回 400,不會默默只給你一張還照收錢。GET https://hebangai.com/relay/v1/models(同樣帶 Authorization)。還沒有金鑰?
登入並建立金鑰