快速接入 HelpAPIGet started with HelpAPI
使用 OpenAI SDK 和 HelpAPI 令牌调用模型。对话、图像和视频各有对应的接口,请在模型广场查看支持的请求方式。 Use the OpenAI SDK with your HelpAPI key. Check the model marketplace for supported chat, image and video endpoints.
https://helpapi.ai
OpenAI 兼容端点前缀为 /v1(例如 https://helpapi.ai/v1/chat/completions)。
OpenAI-compatible endpoints live under /v1 (e.g. https://helpapi.ai/v1/chat/completions).
1. 获取 API 令牌1. Get your API key
- 登录后进入 控制台 → API 令牌。 Sign in and open Console → API Keys.
- 点击「新建令牌」,设置名称、额度与可用分组,创建后复制以
sk-开头的密钥。 Click “Create”, set a name / quota / group, then copy the key starting withsk-. - 令牌列表默认遮盖密钥。需要时可在有权限的账户内复制完整密钥,请仅在服务端使用。 Keys are masked in the list. If your account has permission, you can copy the full key there. Use it only on your server.
HELPAPI_API_KEY。下方示例会读取这个变量,并通过 Authorization 请求头发送令牌。Set the HELPAPI_API_KEY environment variable to your key. The examples read it and send the key in the Authorization header.2. 第一次对话调用2. Your first call (chat)
POST https://helpapi.ai/v1/chat/completions
选择一种写法。示例使用 deepseek-v4-flash;如果你的令牌分组未开放该模型,请换成自己令牌可用的对话模型 ID。Choose one example. It uses deepseek-v4-flash. If your key’s group does not offer this model, substitute a chat model available to your key.
curl https://helpapi.ai/v1/chat/completions \
-H "Authorization: Bearer ${HELPAPI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
}'# pip install openai
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["HELPAPI_API_KEY"],
base_url="https://helpapi.ai/v1",
)
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
print(resp.choices[0].message.content)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.HELPAPI_API_KEY,
baseURL: "https://helpapi.ai/v1",
});
const resp = await client.chat.completions.create({
model: "deepseek-v4-flash",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Hello!" },
],
});
console.log(resp.choices[0].message.content);3. 流式输出3. Streaming
加上 "stream": true 即可逐字返回(SSE)。
Add "stream": true to receive tokens incrementally via SSE.
curl https://helpapi.ai/v1/chat/completions \
-H "Authorization: Bearer ${HELPAPI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"stream": true,
"messages": [{"role": "user", "content": "Write a haiku about the sea."}]
}'import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["HELPAPI_API_KEY"], base_url="https://helpapi.ai/v1")
stream = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Write a haiku about the sea."}],
stream=True,
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True)4. 用 Seedance 生成视频4. Generate a video with Seedance
POST https://helpapi.ai/v1/videos
下面以 doubao-seedance-2-5-260628 为例。先确认令牌可使用该视频模型,再提交一个任务。保存响应中的 id,后续用它查询进度和下载视频。The examples use doubao-seedance-2-5-260628. Confirm your key has access, then submit one task. Save the id from the response to check progress and download the video.
Seedance 2.0、2.0 Fast 和 2.0 Mini 使用 Seedance 令牌分组,按 HelpAPI 标准价的 75% 计费。Seedance 2.5 使用 Standard 分组。视频按实际 token 用量结算,当前价格请查看模型定价。
Use the Seedance key group for Seedance 2.0, 2.0 Fast and 2.0 Mini at 75% of HelpAPI standard rates. Seedance 2.5 uses the Standard group. Videos are billed by actual token usage; see model pricing for current rates.
curl https://helpapi.ai/v1/videos \
-H "Authorization: Bearer ${HELPAPI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-5-260628",
"prompt": "A cinematic shot of a red sports car driving through neon rain at night",
"seconds": 5,
"metadata": {
"resolution": "720p",
"ratio": "16:9"
}
}'curl https://helpapi.ai/v1/videos \
-H "Authorization: Bearer ${HELPAPI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-5-260628",
"prompt": "Animate this product photo with a slow orbit camera move",
"images": ["https://example.com/input-image.png"],
"seconds": 5,
"metadata": {
"resolution": "1080p",
"ratio": "16:9"
}
}'curl --fail-with-body "https://helpapi.ai/v1/videos/${VIDEO_ID}" \
-H "Authorization: Bearer ${HELPAPI_API_KEY}"curl --fail --location "https://helpapi.ai/v1/videos/${VIDEO_ID}/content" \
-H "Authorization: Bearer ${HELPAPI_API_KEY}" \
--output video.mp4| 字段Field | 说明Description |
|---|---|
prompt |
文生视频的画面描述。Describe the scene to generate. |
seconds |
输出时长(秒)。按模型支持范围填写,例如 5。Output duration in seconds, for example 5. Use a value supported by the model. |
images |
图生视频时,将示例中的占位地址换成上游可读取的图片 URL。For image-to-video, replace the placeholder URL in the example with a publicly accessible image URL. |
metadata.resolution |
输出分辨率。支持的档位和价格取决于模型,详见模型广场。Output resolution. Supported tiers and rates vary by model. See the model marketplace. |
metadata.ratio |
画面比例,例如 16:9、9:16 或 1:1。Aspect ratio, such as 16:9, 9:16, or 1:1. |
id 设置环境变量 VIDEO_ID。间隔几秒查询一次;status 为 completed 时下载成片,为 failed 时停止轮询并查看错误信息。Set VIDEO_ID to the id returned on submission. Poll every few seconds. When status is completed, download the video. If it is failed, stop polling and inspect the error.
5. 查询可用模型5. List available models
携带令牌请求下列接口,在响应中查看 data[].id。模型会动态调整,公开目录和计价规则见 模型广场。
Use your key with the endpoint below and read data[].id from the response. For the current catalog and rates, browse the model marketplace.
curl https://helpapi.ai/v1/models \
-H "Authorization: Bearer ${HELPAPI_API_KEY}"6. 常见错误6. Common errors
| HTTP | 含义Meaning | 怎么办What to do |
|---|---|---|
401 |
令牌缺失或无效Missing or invalid key | 检查 Authorization 是否正确,令牌是否被禁用Check the Authorization header and that the key is enabled |
403 |
额度不足或无权访问该模型/分组Insufficient quota, or no access to the model/group | 核对钱包余额、令牌额度、分组和模型限制Check your wallet balance, key quota, group and model restrictions |
404 |
请求路径或任务 ID 不存在Endpoint or task ID not found | 核对请求路径和任务 ID,查询任务时使用提交任务的账户Check the path and task ID. Query the task with the submitting account. |
429 |
触发限流Rate limited | 降低并发并按指数退避重试Lower concurrency and retry with exponential backoff |
5xx |
服务暂不可用或当前模型无可用渠道Service unavailable or no route for the model | 先核对模型和分组。视频提交超时时请先检查任务记录,以免重复生成。Check the model and group. If a video submission timed out, check the task log before submitting again. |
计费与支持Billing & support
- HelpAPI 采用预付费 API 调用额度。充值后额度进入账户余额,API 请求按实际模型用量扣费;各模型单价见 模型广场。 HelpAPI uses prepaid API usage credits. Top-ups add balance to your account, and API requests are billed by actual model usage; per-model pricing is on the marketplace.
- 新用户注册可得 5 美元 API 额度。通过邀请链接注册另得 2 美元,合计 7 美元,邀请人得 1 美元。 New users get $5 in API credits. A referral link adds $2 for the new user ($7 total) and gives the referrer $1.
- 钱包快捷充值金额:$5、$20、$100、$500。以上均为一次性充值,不是订阅;也可在钱包页输入自定义金额。 Wallet top-up amounts: $5, $20, $100, and $500. These are one-time top-ups, not subscriptions; custom amounts are also available on the wallet page.
- 活动、客服补偿或渠道合作发放的兑换码可在钱包兑换,适用条件以发放说明为准。 Redeem campaign, support or partner codes in the wallet. Check the terms provided with the code.
- 用量与消费明细可在 控制台日志 查看。 Usage and spend details are in the console logs.
- 充值、到账或账单问题请联系支持邮箱:[email protected] For top-up, settlement, or billing questions, contact support: [email protected]
HelpAPI