面向文本、图像、视频、音频与模型管理的统一接口文档。所有接口使用 Unified API documentation for text, image, video, audio, and model management. All endpoints use Authorization: Bearer <Token> 鉴权,请求示例中的 for authentication. In the request examples, {BASE_URL} 为平台服务地址,OpenAI SDK 通常配置为 denotes the platform service address, typically configured as {BASE_URL}/v1。 in OpenAI SDKs.
OpenAI 兼容的对话补全接口,是文本生成的主要入口,支持流式输出、工具调用与多模态输入。OpenAI-compatible chat completions endpoint — the primary entry point for text generation, supporting streaming output, tool calling, and multimodal input.
鉴权方式Authentication
Authorization: Bearer <Token>
请求参数Request Parameters
参数Parameter
类型Type
必填Required
说明Description
示例Example
model
string
必填Required
模型名称Model name
"gpt-4o"
messages
array
必填Required
对话消息数组,每条含 role 与 contentArray of chat messages, each with role and content
[{"role":"user","content":"你好"}]
stream
boolean
可选Optional
是否流式返回,true 时以 SSE 逐段输出Whether to stream the response; when true, output is delivered incrementally via SSE
true
max_tokens
integer
可选Optional
单次生成的最大输出 token 数Maximum number of output tokens per generation
4096
temperature
float
可选Optional
采样温度,范围 0-2,值越大输出越随机Sampling temperature, range 0–2; higher values make output more random
0.7
top_p
float
可选Optional
核采样,范围 0-1Nucleus sampling, range 0–1
0.9
stop
string/array
可选Optional
停止词,命中即终止生成Stop sequences; generation terminates on a match
基于参考图与编辑指令修改图片,支持 URL 透传模式,避免 base64 体积与延迟。Modify images based on a reference image and editing instructions, with URL pass-through mode to avoid base64 payload size and latency.
鉴权方式Authentication
Authorization: Bearer <Token>
请求参数Request Parameters
参数Parameter
类型Type
必填Required
说明Description
示例Example
model
string
必填Required
模型名称Model name
"gpt-image-edit"
image
string
必填Required
参考图,支持 URL 或 base64Reference image, URL or base64 supported
异步视频生成任务提交接口。提交后立即返回任务 ID(Async video generation task submission endpoint. Returns a task ID immediately after submission (status=queued),随后通过查询接口轮询任务状态,成功后再取视频 URL。), then poll the task status via the query endpoint and fetch the video URL once it succeeds.
查询异步视频任务的状态与生成结果,轮询直至 Query the status and result of an async video task; poll until status=succeeded 后取 and then use result_url 下载视频。 to download the video.
鉴权方式Authentication
Authorization: Bearer <Token>
请求参数Request Parameters
参数Parameter
类型Type
必填Required
说明Description
示例Example
task_id
path
必填Required
提交视频生成任务返回的任务 IDTask ID returned when submitting the video generation task
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="{BASE_URL}/v1")
models = client.models.list()
for m in models.data:
print(m.id)
import OpenAI from "openai";
const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "{BASE_URL}/v1" });
const models = await client.models.list();
for (const m of models.data) {
console.log(m.id);
}
错误码Error Codes
HTTP 状态码HTTP Status Code
含义Meaning
处理建议Suggested Action
401
鉴权失败Authentication failed
检查 Token 是否有效、是否过期或已删除,重新在「令牌」页面创建。Check whether the Token is valid, expired, or deleted, then create a new one on the Tokens page.
403
权限不足 / 模型未配置价格Insufficient permissions / model price not configured
确认账号对该模型有访问权限,或模型已上线并配置价格。Confirm the account has access to the model, or that the model is live with its price configured.
404
接口或模型不存在Endpoint or model not found
确认请求路径与 Verify the request path and the model 参数是否正确。 parameter are correct.
429
余额不足或请求过于频繁Insufficient balance or requests too frequent
前往「充值」页面充值,或降低请求频率后重试。Top up on the Top-up page, or retry with a lower request rate.
5xx
平台服务异常Platform service error
稍后重试;若持续出现,可通过工单反馈。Retry later; if the issue persists, report it via a support ticket.
限制与建议Limits and Recommendations
所有请求必须携带 All requests must include the Authorization: Bearer <Token> 请求头。 header.
视频生成为异步任务,请以任务 ID 轮询查询,避免重复提交。Video generation is an async task; poll it by task ID instead of resubmitting.
大模型输出可能包含不准确内容,生产环境请自行做好内容校验。Model output may contain inaccurate content; perform your own content validation in production.