Authorization: Bearer sk-xxxxxxx-api-key 和 anthropic-version 头时返回 Anthropic 格式x-goog-api-key 头或 key 查询参数时返回 Gemini 格式| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| key | query | string | 否 | Google API Key (用于 Gemini 格式) |
| x-api-key | header | string | 否 | Anthropic API Key (用于 Claude 格式) |
| anthropic-version | header | string | 否 | Anthropic API 版本 |
| x-goog-api-key | header | string | 否 | Google API Key (用于 Gemini 格式) |
返回示例
200 Response
{
"object": "list",
"data": [
{
"id": "gpt-4",
"object": "model",
"created": 0,
"owned_by": "openai"
}
]
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功获取模型列表 | ModelsResponse |
| 401 | Unauthorized | 认证失败 | ErrorResponse |
返回示例
200 Response
{
"models": [
{
"name": "models/gemini-pro",
"version": "string",
"displayName": "string",
"description": "string",
"inputTokenLimit": 0,
"outputTokenLimit": 0,
"supportedGenerationMethods": [
"string"
]
}
]
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功获取模型列表 | GeminiModelsResponse |
anthropic-version。Body 请求参数
{
"model": "claude-3-opus-20240229",
"messages": [
{
"role": "user",
"content": "string"
}
],
"system": "string",
"max_tokens": 1,
"temperature": 1,
"top_p": 0,
"top_k": 0,
"stream": true,
"stop_sequences": [
"string"
],
"tools": [
{
"name": "string",
"description": "string",
"input_schema": {}
}
],
"tool_choice": {
"type": "auto",
"name": "string"
},
"thinking": {
"type": "enabled",
"budget_tokens": 0
},
"metadata": {
"user_id": "string"
}
}| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| anthropic-version | header | string | 是 | Anthropic API 版本 |
| x-api-key | header | string | 否 | Anthropic API Key (可选,也可使用 Bearer Token) |
| body | body | ClaudeRequest | 否 | none |
返回示例
200 Response
{
"id": "string",
"type": "message",
"role": "assistant",
"content": [
{
"type": "string",
"text": "string"
}
],
"model": "string",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功创建响应 | ClaudeResponse |
Body 请求参数
{
"model": "string",
"input": "string",
"instructions": "string",
"max_output_tokens": 0,
"temperature": 0,
"top_p": 0,
"stream": true,
"tools": [
{}
],
"tool_choice": "string",
"reasoning": {
"effort": "low",
"summary": "string"
},
"previous_response_id": "string",
"truncation": "auto"
}| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | ResponsesRequest | 是 | none |
返回示例
200 Response
{
"id": "string",
"object": "response",
"created_at": 0,
"status": "completed",
"model": "string",
"output": [
{
"type": "string",
"id": "string",
"status": "string",
"role": "string",
"content": [
{
"type": "string",
"text": "string"
}
]
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
}
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功创建响应 | ResponsesResponse |
Body 请求参数
{
"model": "gpt-image-1",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | object | 否 | none |
| » model | body | string | 否 | 用于图像生成的模型。dall-e-2、dall-e-3 或 gpt-image-1 之一。默认为 dall-e-2,除非使用特定于 gpt-image-1 的参数。 |
| » prompt | body | string | 是 | 所需图像的文本描述。gpt-image-1 的最大长度为 32000 个字符,dall-e-2 的最大长度为 1000 个字符,dall-e-3 的最大长度为 4000 个字符。 |
| » n | body | integer | 否 | 要生成的图像数量。必须介于 1 到 10 之间。对于 dall-e-3,仅支持 n=1。 |
| » size | body | string | 否 | 生成的图像的大小。对于 gpt-image-1,必须是 1024x1024、1536x1024(横向)、1024x1536(纵向)或自动(默认值)之一,对于 dall-e-2,必须是 256x256、``512x512 或 1024x1024 之一,对于 dall-e-3,必须是 1024x1024、1792x1024 或 1024x1792 之一。 |
| » background | body | string | 否 | 允许为生成的图像的背景设置透明度。此参数仅支持 gpt-image-1。必须是以下之一 透明、不透明或自动(默认值)。使用自动时,模型将自动确定图像的最佳背景。 |
| » moderation | body | string | 否 | 控制 gpt-image-1 生成的图像的内容审核级别。必须为低, 以进行限制较少的筛选或自动(默认值)。 |
| » quality | body | string | 否 | 将生成的图像的质量。 |
| » stream | body | string | 否 | none |
| » style | body | string | 否 | none |
| » user | body | string | 否 | none |
gpt-image-1。必须是以下之一 透明、不透明或自动(默认值)。使用自动时,模型将自动确定图像的最佳背景。是透明的,则输出格式需要支持透明度,因此应将其设置为 png(默认值)或 webp。返回示例
200 Response
{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | none | Inline |
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » created | integer | true | none | none | |
| » data | [object] | true | none | none | |
| »» b64_json | string | false | none | none | |
| »» url | string | true | none | none | |
| » usage | object | true | none | none | |
| »» total_tokens | integer | true | none | none | |
| »» input_tokens | integer | true | none | none | |
| »» output_tokens | integer | true | none | none | |
| »» input_tokens_details | object | true | none | none | |
| »»» text_tokens | integer | true | none | none | |
| »»» image_tokens | integer | true | none | none |
Body 请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | object | 否 | none |
| » image | body | string(binary) | 是 | 要编辑的图像。必须是有效的 PNG 文件,小于 4MB,并且是方形的。如果未提供遮罩,图像必须具有透明度,将用作遮罩。 |
| » mask | body | string(binary) | 否 | 附加图像,其完全透明区域(例如,alpha 为零的区域)指示image应编辑的位置。必须是有效的 PNG 文件,小于 4MB,并且尺寸与原始image相同。 |
| » prompt | body | string | 是 | 所需图像的文本描述。最大长度为 1000 个字符。 |
| » n | body | string | 否 | 要生成的图像数。必须介于 1 和 10 之间。 |
| » size | body | string | 否 | 生成图像的大小。必须是256x256、512x512或 1024x1024之一。 |
| » response_format | body | string | 否 | 生成的图像返回的格式。必须是url或b64_json。 |
| » user | body | string | 否 | 代表您的最终用户的唯一标识符,可以帮助 OpenAI 监控和检测滥用行为。了解更多。 |
| » model | body | string | 否 | none |
返回示例
200 Response
{}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | none | Inline |
Body 请求参数
{
"model": "qwen-image-plus",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "一副典雅庄重的对联悬挂于厅堂之中,房间是个安静古典的中式布置,桌子上放着一些青花瓷,对联上左书“义本生知人机同道善思新”,右书“通云赋智乾坤启数高志远”, 横批“智启通义”,字体飘逸,在中间挂着一幅中国风的画作,内容是岳阳楼。"
}
]
}
]
},
"parameters": {
"negative_prompt": "",
"prompt_extend": true,
"watermark": false,
"size": "1328*1328"
}
}| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | object | 否 | none |
| » model | body | string | 是 | none |
| » input | body | object | 是 | none |
| »» messages | body | [object] | 是 | none |
| »»» role | body | string | 否 | none |
| »»» content | body | [object] | 否 | none |
| »»»» text | body | string | 否 | none |
| » parameters | body | object | 否 | none |
| »» negative_prompt | body | string | 否 | none |
| »» prompt_extend | body | boolean | 否 | none |
| »» watermark | body | boolean | 否 | none |
| »» size | body | string | 否 | none |
返回示例
200 Response
{
"created": 0,
"data": [
{
"url": "string",
"b64_json": "string",
"revised_prompt": "string"
}
]
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功生成图像 | ImageResponse |
Body 请求参数
"{\n \"model\": \"qwen-image-edit-plus\",\n \"input\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"image\": \"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp\"\n },\n {\n \"text\": \"生成一张符合深度图的图像,遵循以下描述:一辆红色的破旧的自行车停在一条泥泞的小路上,背景是茂密的原始森林\"\n }\n ]\n }\n ]\n },\n \"parameters\": {\n \"n\": 2,\n \"negative_prompt\": \" \",\n \"prompt_extend\": true,\n \"watermark\": false\n }"| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | object | 否 | none |
| » model | body | string | 是 | none |
| » input | body | object | 是 | none |
| »» messages | body | [object] | 是 | none |
| »»» role | body | string | 否 | none |
| »»» content | body | [object] | 否 | none |
| »»»» image | body | string | 否 | none |
| »»»» text | body | string | 否 | none |
| » parameters | body | object | 否 | none |
| »» n | body | integer | 否 | none |
| »» negative_prompt | body | string | 否 | none |
| »» prompt_extend | body | boolean | 否 | none |
| »» watermark | body | boolean | 否 | none |
| »» size | body | string | 否 | none |
返回示例
200 Response
{
"created": 0,
"data": [
{
"url": "string",
"b64_json": "string",
"revised_prompt": "string"
}
]
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功生成图像 | ImageResponse |
Body 请求参数
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "draw a cat"
}
]
}
],
"generationConfig": {
"responseModalities": [
"TEXT",
"IMAGE"
],
"imageConfig": {
"aspectRatio": "16:9",
"imageSize": "4K"
}
}
}| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| model | path | string | 是 | 模型名称 |
| body | body | object | 否 | none |
| » contents | body | [object] | 是 | none |
| »» role | body | string | 否 | none |
| »» parts | body | [object] | 否 | none |
| »»» text | body | string | 否 | none |
| » generationConfig | body | object | 是 | none |
| »» thinkingConfig | body | object | 否 | none |
| »»» includeThoughts | body | boolean | 是 | 是否返回思考内容 |
| »» responseModalities | body | [string] | 是 | none |
| »» imageConfig | body | object | 是 | none |
| »»» aspectRatio | body | string | 是 | none |
| »»» imageSize | body | string | 是 | none |
返回示例
200 Response
{
"candidates": [
{
"content": {
"role": "string",
"parts": [
{}
]
},
"finishReason": "string",
"safetyRatings": [
{}
]
}
],
"usageMetadata": {
"promptTokenCount": 0,
"candidatesTokenCount": 0,
"totalTokenCount": 0
}
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功 | GeminiResponse |
Body 请求参数
{
"model": "kling-v1",
"prompt": "宇航员在月球上漫步",
"duration": 5,
"width": 1280,
"height": 720
}| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | VideoRequest | 是 | none |
返回示例
200 Response
{
"task_id": "abcd1234efgh",
"status": "queued"
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功创建视频生成任务 | VideoResponse |
| 400 | Bad Request | 请求参数错误 | ErrorResponse |
queued: 排队中in_progress: 生成中completed: 已完成failed: 失败| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| task_id | path | string | 是 | 任务 ID |
返回示例
200 Response
{
"task_id": "abcd1234efgh",
"status": "completed",
"url": "https://example.com/video.mp4",
"format": "mp4",
"metadata": {
"duration": 5,
"fps": 30,
"width": 1280,
"height": 720,
"seed": 20231234
},
"error": {
"code": 0,
"message": "string"
}
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功获取任务状态 | VideoTaskResponse |
| 404 | Not Found | 任务不存在 | ErrorResponse |
Body 请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | object | 否 | none |
| » model | body | string | 否 | 模型名称 |
| » prompt | body | string | 否 | 提示词 |
| » seconds | body | string | 否 | 生成秒数 |
| » input_reference | body | string(binary) | 否 | 参考图片文件 |
返回示例
200 Response
{
"id": "sora-2-123456",
"object": "video",
"model": "sora-2",
"status": "queued",
"progress": 0,
"created_at": 1764347090922,
"seconds": "8"
}400 Response
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功创建视频任务 | Inline |
| 400 | Bad Request | 请求参数错误 | ErrorResponse |
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » id | string | true | none | 视频 ID | |
| » object | string | true | none | 对象类型 | |
| » model | string | true | none | 使用的模型 | |
| » status | string | true | none | 任务状态 | |
| » progress | integer | true | none | 进度百分比 | |
| » created_at | integer | true | none | 创建时间戳 | |
| » seconds | string | true | none | 视频时长 | |
| » completed_at | integer | false | none | 完成时间戳 | |
| » expires_at | integer | false | none | 过期时间戳 | |
| » size | string | false | none | 视频尺寸 | |
| » error | OpenAIVideoError | false | none | OpenAI 视频错误信息 | |
| »» message | string | false | none | 错误信息 | |
| »» code | string | false | none | 错误码 | |
| » metadata | object | false | none | 额外元数据 |
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » error | object | false | none | none | |
| »» message | string | false | none | 错误信息 | |
| »» type | string | false | none | 错误类型 | |
| »» param | string¦null | false | none | 相关参数 | |
| »» code | string¦null | false | none | 错误代码 |
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| task_id | path | string | 是 | 视频任务 ID |
返回示例
200 Response
{
"id": "sora-2-123456",
"object": "video",
"model": "sora-2",
"status": "queued",
"progress": 0,
"created_at": 1764347090922,
"seconds": "8"
}404 Response
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功获取视频任务状态 | Inline |
| 404 | Not Found | 任务不存在 | ErrorResponse |
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » id | string | true | none | none | |
| » object | string | true | none | none | |
| » model | string | true | none | none | |
| » status | string | true | none | none | |
| » progress | integer | true | none | none | |
| » created_at | integer | true | none | none | |
| » seconds | string | true | none | none |
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » error | object | false | none | none | |
| »» message | string | false | none | 错误信息 | |
| »» type | string | false | none | 错误类型 | |
| »» param | string¦null | false | none | 相关参数 | |
| »» code | string¦null | false | none | 错误代码 |