{ "openapi": "3.1.0", "info": { "title": "Text2Video - 图片生成 API", "description": "基于 Midjourney 的图片生成服务", "version": "1.0.0" }, "paths": { "/api/mj/sync/image": { "post": { "tags": [ "midjourney生图" ], "summary": "同步生成图片接口", "description": "同步生成图片接口 - 提交任务并轮询结果\n\nArgs:\n prompt (str): 图片生成提示词\n max_wait_time (int): 最大等待时间,默认120秒\n poll_interval (int): 轮询间隔,默认2秒\n\nReturns:\n dict: 包含status, msg, data的响应字典", "operationId": "generate_image_sync_api_mj_sync_image_post", "parameters": [ { "name": "prompt", "in": "query", "required": true, "schema": { "type": "string", "title": "Prompt" } }, { "name": "max_wait_time", "in": "query", "required": false, "schema": { "type": "integer", "default": 120, "title": "Max Wait Time" } }, { "name": "poll_interval", "in": "query", "required": false, "schema": { "type": "integer", "default": 2, "title": "Poll Interval" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/mj/generate-image": { "post": { "tags": [ "midjourney生图" ], "summary": "生成图片", "description": "生成图片接口", "operationId": "generate_image_api_api_mj_generate_image_post", "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/Body_generate_image_api_api_mj_generate_image_post" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/mj/sync/img/describe": { "post": { "tags": [ "midjourney生图" ], "summary": "获取图像描述", "description": "获取图像描述接口", "operationId": "describe_image_api_api_mj_sync_img_describe_post", "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/Body_describe_image_api_api_mj_sync_img_describe_post" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/mj/health": { "get": { "tags": [ "midjourney生图" ], "summary": "健康检查", "description": "健康检查接口", "operationId": "health_check_api_mj_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/api/file/upload": { "post": { "tags": [ "文件操作" ], "summary": "上传文件到COS", "description": "上传文件到腾讯云COS\n\n- **file**: 要上传的文件\n\n返回上传后的文件URL", "operationId": "upload_file_api_file_upload_post", "requestBody": { "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/Body_upload_file_api_file_upload_post" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/jm/generate-video": { "post": { "tags": [ "极梦视频生成api" ], "summary": "生成视频", "description": "生成视频接口", "operationId": "generate_video_api_api_jm_generate_video_post", "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/Body_generate_video_api_api_jm_generate_video_post" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/jm/health": { "get": { "tags": [ "极梦视频生成api" ], "summary": "健康检查", "description": "健康检查接口", "operationId": "health_check_api_jm_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/api/prompt/default": { "get": { "tags": [ "处理提示词" ], "summary": "获取示例提示词", "operationId": "get_sample_prompt_api_prompt_default_get", "parameters": [ { "name": "task_type", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Task Type" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/task/test": { "post": { "tags": [ "任务管理api" ], "summary": "测试 Modal 连接", "description": "测试 Modal 连接是否正常", "operationId": "test_modal_connection_api_task_test_post", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/api/task/create/task": { "post": { "tags": [ "任务管理api" ], "summary": "异步提交任务(不阻塞)", "description": "异步提交任务到 Modal 进行处理(不阻塞,立即返回任务ID)\n\n- **task_type**: 任务类型 (tea/chop/lady/vlog)\n- **prompt**: 生成提示词\n- **img_url**: 可选的参考图片URL,如果提供会先进行图片描述\n- **ar**: 生成图片的长宽比 默认为9:16\n\n立即返回 Modal 任务ID,任务在后台异步执行", "operationId": "submit_task_api_task_create_task_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/task/{task_id}": { "get": { "tags": [ "任务管理api" ], "summary": "同步查询任务结果(阻塞等待)", "description": "同步查询任务的执行状态和结果(阻塞等待模式)\n\n- **task_id**: 任务ID\n\n**阻塞等待任务完成**,直到任务执行完成才返回最终结果\n适用于需要等待任务完成的场景", "operationId": "query_task_result_sync_api_task__task_id__get", "parameters": [ { "name": "task_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Task Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/task/status/{task_id}": { "get": { "tags": [ "任务管理api" ], "summary": "异步查询任务状态(立即返回)", "description": "异步查询任务的状态信息(非阻塞,立即返回当前状态)\n\n- **task_id**: 任务ID\n\n**立即返回当前状态**,不等待任务完成\n适用于需要快速检查任务状态的场景", "operationId": "get_task_status_async_api_task_status__task_id__get", "parameters": [ { "name": "task_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Task Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/mj/video/async/submit": { "post": { "tags": [ "midjourney视频生成api" ], "summary": "异步提交生成视频任务", "operationId": "submit_video_task_api_mj_video_async_submit_post", "parameters": [ { "name": "prompt", "in": "query", "required": true, "schema": { "type": "string", "title": "Prompt" } }, { "name": "img_url", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Img Url" } } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/Body_submit_video_task_api_mj_video_async_submit_post" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/mj/video/async/task/status": { "post": { "tags": [ "midjourney视频生成api" ], "summary": "异步查询生成任务进度", "operationId": "async_query_task_status_api_mj_video_async_task_status_post", "parameters": [ { "name": "task_id", "in": "query", "required": true, "schema": { "type": "string", "title": "Task Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/mj/video/sync/gen": { "post": { "tags": [ "midjourney视频生成api" ], "summary": "同步生成视频", "operationId": "sync_submit_task_api_mj_video_sync_gen_post", "parameters": [ { "name": "prompt", "in": "query", "required": true, "schema": { "type": "string", "title": "Prompt" } }, { "name": "img_url", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Img Url" } } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/Body_sync_submit_task_api_mj_video_sync_gen_post" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/": { "get": { "summary": "根路径", "description": "根路径,返回API信息", "operationId": "root__get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } } }, "components": { "schemas": { "Body_describe_image_api_api_mj_sync_img_describe_post": { "properties": { "image_url": { "type": "string", "title": "Image Url", "description": "图片URL地址" }, "max_wait_time": { "type": "integer", "title": "Max Wait Time", "description": "最大等待时间(秒)", "default": 120 }, "poll_interval": { "type": "integer", "title": "Poll Interval", "description": "轮询间隔(秒)", "default": 2 } }, "type": "object", "required": [ "image_url" ], "title": "Body_describe_image_api_api_mj_sync_img_describe_post" }, "Body_generate_image_api_api_mj_generate_image_post": { "properties": { "prompt": { "type": "string", "title": "Prompt", "description": "图片生成提示词" }, "max_wait_time": { "type": "integer", "title": "Max Wait Time", "description": "最大等待时间(秒)", "default": 120 }, "poll_interval": { "type": "integer", "title": "Poll Interval", "description": "轮询间隔(秒)", "default": 2 } }, "type": "object", "required": [ "prompt" ], "title": "Body_generate_image_api_api_mj_generate_image_post" }, "Body_generate_video_api_api_jm_generate_video_post": { "properties": { "prompt": { "type": "string", "title": "Prompt", "description": "视频生成提示词" }, "img_url": { "type": "string", "title": "Img Url", "description": "图片URL地址" }, "duration": { "type": "string", "title": "Duration", "description": "视频时长(秒)", "default": "5" }, "max_wait_time": { "type": "integer", "title": "Max Wait Time", "description": "最大等待时间(秒)", "default": 300 }, "poll_interval": { "type": "integer", "title": "Poll Interval", "description": "轮询间隔(秒)", "default": 5 } }, "type": "object", "required": [ "prompt", "img_url" ], "title": "Body_generate_video_api_api_jm_generate_video_post" }, "Body_submit_video_task_api_mj_video_async_submit_post": { "properties": { "img_file": { "anyOf": [ { "type": "string", "format": "binary" }, { "type": "null" } ], "title": "Img File" } }, "type": "object", "title": "Body_submit_video_task_api_mj_video_async_submit_post" }, "Body_sync_submit_task_api_mj_video_sync_gen_post": { "properties": { "img_file": { "anyOf": [ { "type": "string", "format": "binary" }, { "type": "null" } ], "title": "Img File" } }, "type": "object", "title": "Body_sync_submit_task_api_mj_video_sync_gen_post" }, "Body_upload_file_api_file_upload_post": { "properties": { "file": { "type": "string", "format": "binary", "title": "File" } }, "type": "object", "required": [ "file" ], "title": "Body_upload_file_api_file_upload_post" }, "FileUploadResponse": { "properties": { "status": { "type": "boolean", "title": "Status", "description": "上传状态" }, "msg": { "type": "string", "title": "Msg", "description": "响应消息" }, "data": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Data", "description": "文件URL" }, "filename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Filename", "description": "原始文件名" } }, "type": "object", "required": [ "status", "msg" ], "title": "FileUploadResponse", "description": "文件上传响应模型" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "TaskRequest": { "properties": { "task_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Task Type", "description": "任务类型如: tea, chop, lady, vlog", "default": "" }, "prompt": { "type": "string", "title": "Prompt", "description": "生图的提示词" }, "img_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Img Url", "description": "参考图", "default": "" }, "ar": { "type": "string", "title": "Ar", "description": "生成图片,视频的分辨率", "default": "9:16" } }, "type": "object", "required": [ "prompt" ], "title": "TaskRequest" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } }