全部接口
文生视频查询任务(免费)
图像生成
Chat(工具tools调用)
Flux
Recraftv3
文生图
模型信息
| 模型 ID | grok-4.1-image | 供应商 | X.AI |
|---|---|---|---|
| 输入模态 | 未注明 | 输出模态 | 未注明 |
| 分类 | 未注明 | 发布时间 | 2026-03-07 14:13:39 |
调用接口
| 分组 | 接口 | 渠道 | 方法 | 路径 |
|---|---|---|---|---|
| 全部接口 | 文生视频查询任务(免费) | 本站 AI 中转站 | GET | /kling/v1/images/text2video/{task_id} |
| 全部接口 | 图像生成 | 本站 AI 中转站 | POST | /kling/v1/images/generations |
| 全部接口 | Chat(工具tools调用) | 本站 AI 中转站 | POST | /v1/chat/completions |
| 全部接口 | Flux | 本站 AI 中转站 | POST | /v1/images/generations |
| 全部接口 | Recraftv3 | 本站 AI 中转站 | POST | /v1/images/generations |
| 全部接口 | 文生图 | 本站 AI 中转站 | POST | /v1/images/generations |
GET /kling/v1/images/text2video/{task_id}
{
"summary": "文生视频查询任务(免费)",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"code",
"message",
"request_id",
"data"
],
"properties": {
"code": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"task_id": {
"type": "string"
},
"created_at": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"task_result": {
"type": "object",
"properties": {
"videos": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"url": {
"type": "string"
},
"duration": {
"type": "string"
}
}
}
}
}
},
"task_status": {
"type": "string"
},
"task_status_msg": {
"type": "string"
}
}
},
"message": {
"type": "string"
},
"request_id": {
"type": "string"
}
}
}
}
},
"description": "成功"
}
},
"parameters": [
{
"in": "path",
"name": "task_id",
"schema": {
"type": "string",
"description": "任务ID"
},
"required": true,
"description": "任务ID"
}
],
"description": ""
}POST /kling/v1/images/generations
### 图像生成
本文档不实时更新,完整版请查看官方文档:
{
"summary": "图像生成",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"code",
"message",
"request_id",
"data"
],
"properties": {
"code": {
"type": "integer",
"description": "错误码;具体定义错误码"
},
"data": {
"type": "object",
"required": [
"task_id",
"task_status",
"created_at",
"updated_at"
],
"properties": {
"task_id": {
"type": "string",
"description": "任务ID,系统生成"
},
"created_at": {
"type": "integer",
"description": "任务创建时间,Unix时间戳、单位ms"
},
"updated_at": {
"type": "integer",
"description": "任务更新时间,Unix时间戳、单位ms"
},
"task_status": {
"enum": [
"submitted(已提交)",
"processing(处理中)",
"succeed(成功)",
"failed(失败)"
],
"type": "string",
"description": "任务状态,枚举值:submitted(已提交)、process任务创建时间,Unix时间戳、单位msing(处理中)、succeed(成功)、failed(失败)"
}
}
},
"message": {
"type": "string",
"description": "错误信息"
},
"request_id": {
"type": "string",
"description": "请求ID,系统生成,用于跟踪请求、排查问题"
}
}
}
}
},
"description": "成功"
}
},
"parameters": [],
"description": "### 图像生成\n本文档不实时更新,完整版请查看官方文档:",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"title": "图像生成",
"$schema": "",
"required": [
"prompt"
],
"properties": {
"n": {
"type": "integer",
"maximum": 9,
"minimum": 1,
"description": "生成图片数量,可选,取值范围:[1,9]"
},
"image": {
"type": "string",
"description": "参考图片,可选,支持Base64编码或图片URL,支持.jpg / .jpeg / .png格式,大小不能超过10MB"
},
"prompt": {
"type": "string",
"maxLength": 5000,
"description": "正向文本提示,必须,不能超过500个字符"
},
"model_name": {
"type": "string",
"default": "kling-v1",
"description": "kling-v1-5,kling-v2"
},
"aspect_ratio": {
"enum": [
"16:9",
"9:16",
"1:1",
"4:3",
"3:4",
"3:2",
"2:3"
],
"type": "string",
"description": "生成图片的纵横比,可选,枚举值:16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3"
},
"callback_url": {
"type": "string",
"description": "本次任务结果回调通知地址,可选"
},
"image_fidelity": {
"type": "number",
"maximum": 1,
"minimum": 0,
"description": "生成过程中对用户上传图片的参考强度,可选,取值范围:[0,1]"
},
"negative_prompt": {
"type": "string",
"maxLength": 2000,
"description": "负向文本提示,可选,不能超过200个字符"
}
},
"x-apifox-id": "253413273"
}
}
},
"required": true
}
}POST /v1/chat/completions
### Chat(工具tools调用)
[官方指南](
[官方API文档](
所有对话模型,都可使用此接口, 修改 model 属性为模型名
给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。
为提供的提示和参数创建完成
测试页面:
{
"summary": "Chat(工具tools调用)",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"id",
"object",
"created",
"choices",
"usage"
],
"properties": {
"id": {
"type": "string"
},
"usage": {
"type": "object",
"required": [
"prompt_tokens",
"completion_tokens",
"total_tokens"
],
"properties": {
"total_tokens": {
"type": "integer"
},
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
}
}
},
"object": {
"type": "string"
},
"choices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"index": {
"type": "integer"
},
"message": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
}
},
"finish_reason": {
"type": "string"
}
}
}
},
"created": {
"type": "integer"
}
}
}
}
},
"description": "OK"
}
},
"parameters": [],
"description": "### Chat(工具tools调用)\n[官方指南](\n[官方API文档](\n所有对话模型,都可使用此接口, 修改 model 属性为模型名\n给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。\n为提供的提示和参数创建完成 \n测试页面:",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"title": "Chat(工具tools调用)",
"$schema": "",
"required": [
"model",
"messages",
"tools",
"tool_choice"
],
"properties": {
"n": {
"type": "integer",
"description": "默认为 1\n为每个输入消息生成多少个聊天补全选择。"
},
"seen": {
"type": "integer",
"description": "此功能处于测试阶段。如果指定,我们的系统将尽最大努力确定性地进行采样,以便使用相同的种子和参数进行重复请求应返回相同的结果。不能保证确定性,您应该参考 system_fingerprint 响应参数来监控后端的更改。"
},
"stop": {
"type": "string",
"description": "默认为 null 最多 4 个序列,API 将停止进一步生成标记。"
},
"user": {
"type": "string",
"description": "代表您的最终用户的唯一标识符,可以帮助 OpenAI 监控和检测滥用行为。[了解更多]("
},
"model": {
"type": "string",
"description": "要使用的模型的 ID。有关哪些模型可与聊天 API 一起使用的详细信息,请参阅模型端点兼容性表。"
},
"tools": {
"type": "array",
"items": {
"type": "string"
},
"description": "模型可以调用的一组工具列表。目前,只支持作为工具的函数。使用此功能来提供模型可以为之生成 JSON 输入的函数列表。"
},
"top_p": {
"type": "integer",
"description": "一种替代温度采样的方法,称为核采样,其中模型考虑具有 top_p 概率质量的标记的结果。所以 0.1 意味着只考虑构成前 10% 概率质量的标记。 我们通常建议改变这个或`temperature`但不是两者。"
},
"stream": {
"type": "boolean",
"description": "默认为 false 如果设置,则像在 ChatGPT 中一样会发送部分消息增量。标记将以仅数据的服务器发送事件的形式发送,这些事件在可用时,并在 data: [DONE] 消息终止流。Python 代码示例。"
},
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
}
},
"description": "至今为止对话所包含的消息列表。Python 代码示例。"
},
"logit_bias": {
"type": "null",
"description": "修改指定标记出现在补全中的可能性。\n\n接受一个 JSON 对象,该对象将标记(由标记器指定的标记 ID)映射到相关的偏差值(-100 到 100)。从数学上讲,偏差在对模型进行采样之前添加到模型生成的 logit 中。确切效果因模型而异,但-1 和 1 之间的值应减少或增加相关标记的选择可能性;如-100 或 100 这样的值应导致相关标记的禁用或独占选择。"
},
"max_tokens": {
"type": "integer",
"description": "默认为 inf\n在聊天补全中生成的最大标记数。\n\n输入标记和生成标记的总长度受模型的上下文长度限制。计算标记的 Python 代码示例。"
},
"temperature": {
"type": "integer",
"description": "使用什么采样温度,介于 0 和 2 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如 0.2)将使输出更加集中和确定。 我们通常建议改变这个或`top_p`但不是两者。"
},
"tool_choice": {
"type": "object",
"properties": [],
"description": "控制模型调用哪个函数(如果有的话)。none 表示模型不会调用函数,而是生成消息。auto 表示模型可以在生成消息和调用函数之间进行选择。通过 {\"type\": \"function\", \"function\": {\"name\": \"my_function\"}} 强制模型调用该函数。 如果没有函数存在,默认为 none。如果有函数存在,默认为 auto。 显示可能的类型"
},
"response_format": {
"type": "object",
"properties": [],
"description": "指定模型必须输出的格式的对象。 将 { \"type\": \"json_object\" } 启用 JSON 模式,这可以确保模型生成的消息是有效的 JSON。 重要提示:使用 JSON 模式时,还必须通过系统或用户消息指示模型生成 JSON。如果不这样做,模型可能会生成无休止的空白流,直到生成达到令牌限制,从而导致延迟增加和请求“卡住”的外观。另请注意,如果 finish_reason=\"length\",则消息内容可能会被部分切断,这表示生成超过了 max_tokens 或对话超过了最大上下文长度。 显示属性"
},
"presence_penalty": {
"type": "number",
"description": "-2.0 和 2.0 之间的数字。正值会根据到目前为止是否出现在文本中来惩罚新标记,从而增加模型谈论新主题的可能性。 [查看有关频率和存在惩罚的更多信息。]("
},
"frequency_penalty": {
"type": "number",
"description": "默认为 0 -2.0 到 2.0 之间的数字。正值根据文本目前的存在频率惩罚新标记,降低模型重复相同行的可能性。 有关频率和存在惩罚的更多信息。"
}
},
"x-apifox-id": "223322111"
}
}
},
"required": true
}
}POST /v1/images/generations
### Flux
model 支持
flux
flux-dev
flux-pro
size 支持
1024x512
1024x1024
1024x576
1024x768
1024x512
512x1024
512x768
1280x960
1280x960
960x1280
960x1280
768x1366
768x512
1366x768
1344x576
{
"summary": "Flux",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": []
}
}
},
"description": "成功"
}
},
"parameters": [],
"description": "### Flux\nmodel 支持\nflux\nflux-dev\nflux-pro\n\nsize 支持 \n1024x512\n1024x1024\n1024x576\n1024x768\n1024x512\n512x1024\n512x768\n1280x960\n1280x960\n960x1280\n960x1280\n768x1366\n768x512\n1366x768\n1344x576",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"title": "Flux",
"$schema": "",
"properties": [],
"x-apifox-id": "139454705"
}
}
},
"required": true
}
}POST /v1/images/generations
### Recraftv3
model 支持
recraftv3
recraftv3-halloween
size 支持
1024x512
1024x1024
1024x576
1024x768
1024x512
512x1024
512x768
1280x960
1280x960
960x1280
960x1280
768x1366
768x512
1366x768
1344x576
{
"summary": "Recraftv3",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": []
}
}
},
"description": "成功"
}
},
"parameters": [],
"description": "### Recraftv3\nmodel 支持\nrecraftv3\nrecraftv3-halloween\n\nsize 支持 \n1024x512\n1024x1024\n1024x576\n1024x768\n1024x512\n512x1024\n512x768\n1280x960\n1280x960\n960x1280\n960x1280\n768x1366\n768x512\n1366x768\n1344x576",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"title": "Recraftv3",
"$schema": "",
"properties": [],
"x-apifox-id": "201845672"
}
}
},
"required": true
}
}POST /v1/images/generations
### 文生图
[图片](
给定提示和/或输入图像,模型将生成新图像。
相关指南:[图像生成](
根据提示创建图像。
{
"summary": "文生图",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"created",
"data"
],
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"required": [
"url"
],
"properties": {
"url": {
"type": "string"
}
}
}
},
"created": {
"type": "integer"
}
}
}
}
},
"description": "Create image"
}
},
"parameters": [],
"description": "### 文生图\n[图片](\n\n给定提示和/或输入图像,模型将生成新图像。\n\n相关指南:[图像生成](\n\n根据提示创建图像。",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"title": "文生图",
"$schema": "",
"required": [
"prompt"
],
"properties": {
"n": {
"type": "integer",
"title": "",
"description": "要生成的图像数。必须介于 1 和 10 之间。"
},
"size": {
"type": "string",
"title": "",
"description": "生成图像的大小。必须是256x256、512x512或 1024x1024之一。"
},
"prompt": {
"type": "string",
"title": "",
"description": "所需图像的文本描述。最大长度为 1000 个字符。"
}
},
"x-apifox-id": "229045941"
}
}
},
"required": true
}
}价格
| 价格组 | 渠道 | 计费项 | 价格 | 单位 |
|---|---|---|---|---|
| default | AI 中转站 | request | CNY 0.1 | request |
服务级错误码参照(error_code):
| 错误码 | 说明 | |
|---|---|---|
| 221301 | 数据源超时 | |
| 221303 | 认证失败 认证失败,请稍后重试 认证失败,该卡当日连续多次认证不通过被限制校验,次日恢复 |
|
| 221306 | 参数错误 参数错误:姓名格式不正确 参数错误:手机号格式不正确 参数错误:身份证格式不正确 参数错误:银行卡号格式不正确 同一银行卡请求过于频繁 |
系统级错误码参照:
| 错误码 | 说明 | |
|---|---|---|
| 10001 | 错误的请求KEY | |
| 10002 | 该KEY无请求权限 | |
| 10003 | KEY过期 | |
| 10004 | 错误的OPENID | |
| 10005 | 应用未审核超时,请提交认证 | |
| 10007 | 未知的请求源 | |
| 10008 | 被禁止的IP | |
| 10009 | 被禁止的KEY | |
| 10011 | 当前IP请求超过限制 | |
| 10012 | 请求超过次数限制 | |
| 10013 | 测试KEY超过请求限制 | |
| 10014 | 系统内部异常(调用充值类业务时,请务必联系客服或通过订单查询接口检测订单,避免造成损失) | |
| 10020 | 接口维护 | |
| 10021 | 接口停用 |
错误码格式说明(示例:200201):
| 2 | 002 | 01 | |
|---|---|---|---|
| 服务级错误(1为系统级错误) | 服务模块代码(即数据ID) | 具体错误代码 |
使用文档下载
| 附件标题/下载链接 | 更新时间 | |
|---|---|---|
| 接口资料:GET /kling/v1/images/text2video/{task_id}(文生视频查询任务(免费)) | 2026-09-09 15:29:05 | |
| 接口资料:POST /kling/v1/images/generations(图像生成) | 2026-09-09 15:29:05 | |
| 接口资料:POST /v1/chat/completions(Chat(工具tools调用)) | 2026-09-09 15:29:05 | |
| 接口资料:POST /v1/images/generations(Flux) | 2026-09-09 15:29:05 | |
| 接口资料:POST /v1/images/generations(Recraftv3) | 2026-09-09 15:29:05 | |
| 接口资料:POST /v1/images/generations(文生图) | 2026-09-09 15:29:05 | |
| 价格分组:default(CNY 0.1/request) | 2026-09-09 15:29:05 | |
| 供应商令牌分组折扣资料 | 2026-09-09 15:29:05 |
常见问题:
| 标题 | 更新时间 | |
|---|---|---|
| Token 是什么?中文、英文与上下文窗口如何计算 | 2026-09-18 19:52:51 | |
| LLM API 费用如何计算?如何选择合适的模型 | 2026-09-18 19:52:54 | |
| Word-to-Token 转换与用量估算指南 | 2026-09-19 00:49:28 |
gemini-3.8-flash-thinking-medium
gemini-3.8-flash-thinking-high