[{"data":1,"prerenderedAt":159},["ShallowReactive",2],{"reference-detail-zh-create_asset_api_v1_asset_post":3,"developer-code-1k9u1i5":157,"developer-code-x5l7mp":158},{"tag":4,"sourceTag":4,"tagSlug":5,"method":6,"path":7,"slug":8,"summary":9,"description":10,"operationId":11,"groupOrder":12,"descriptionHtml":13,"parameters":14,"requestBody":22,"responses":49,"security":144,"codeSamples":147},"Assets","assets","POST","\u002Fapi\u002Fv1\u002Fasset","create-asset","上传素材","通过公开 URL 或内嵌 base64 上传可复用的媒体素材（图像\u002F视频\u002F音频），获得可在生成请求中引用的 `asset_id`。重复上传相同内容时返回已有素材。大小限制：图像 ≤30MB，音频 ≤15MB，视频 ≤100MB。","create_asset_api_v1_asset_post",90,"\u003Cp>通过公开 URL 或内嵌 base64 上传可复用的媒体素材（图像\u002F视频\u002F音频），获得可在生成请求中引用的 \u003Ccode>asset_id\u003C\u002Fcode>。重复上传相同内容时返回已有素材。大小限制：图像 ≤30MB，音频 ≤15MB，视频 ≤100MB。\u003C\u002Fp>",[15],{"name":16,"in":17,"required":18,"description":19,"type":20,"example":21},"X-API-Key","header",true,"你的 VisionStory API Key（`sk-vs-...`），请仅保存在服务端。可在 [API Key 管理](\u002Fapi-keys) 中创建或管理，需要 Pro 或更高方案。","string","sk-vs-your-api-key",{"required":18,"contentType":23,"schema":24,"example":47},"application\u002Fjson",{"type":25,"description":26,"nullable":27,"properties":28},"CreateAssetRequest","",false,[29,42],{"name":30,"required":27,"type":31,"description":32,"nullable":18,"properties":33},"inline_data","InlineDataModel | null","以内嵌 base64 数据提供的媒体。此字段与 `url` 二选一。",[34,38],{"name":35,"required":18,"type":20,"description":36,"nullable":27,"properties":37},"data","文件原始字节编码后的 base64 字符串，不包含 `data:` URI 前缀。",[],{"name":39,"required":18,"type":20,"description":40,"nullable":27,"properties":41},"mime_type","内嵌数据的 MIME 类型，网关据此区分图像、音频和视频。可接受的类型取决于具体接口，请参阅包含此对象的字段说明。数字人视频接受音频 ['audio\u002Favi', 'audio\u002Fmpeg', 'audio\u002Fmp3', 'audio\u002Fmp4', 'audio\u002Fm4a', 'audio\u002Fwav'] 和图像 ['image\u002Fjpeg', 'image\u002Fjpg', 'image\u002Fpng', 'image\u002Fwebp', 'image\u002Fheic']。",[],{"name":43,"required":27,"type":44,"description":45,"nullable":18,"properties":46},"url","string | null","公开可访问的媒体 URL（图像\u002F视频\u002F音频）。此字段与 `inline_data` 二选一。",[],{"url":48},"https:\u002F\u002Fexample.com\u002Fmedia\u002Freference.jpg",[50,115],{"status":51,"description":52,"contentType":23,"schema":53,"example":101,"examples":109,"headers":114},"200","请求成功",{"type":54,"description":26,"nullable":27,"properties":55},"BaseSuccessResponse_CreateAssetResponse_",[56,91,96],{"name":35,"required":18,"type":57,"description":58,"nullable":18,"properties":59},"CreateAssetResponse | null","当前接口的响应数据，字段定义见该接口的响应结构。仅当操作不返回数据时为 null。",[60,64,70,75,79,83,87],{"name":61,"required":18,"type":20,"description":62,"nullable":27,"properties":63},"asset_id","素材的唯一标识符，在生成请求中作为 `asset_id` 引用。",[],{"name":65,"required":27,"type":66,"description":67,"nullable":27,"default":68,"properties":69},"created_at","integer","素材上传时的 Unix 时间戳，单位为秒。",0,[],{"name":71,"required":27,"type":72,"description":73,"nullable":27,"default":68,"properties":74},"duration_sec","number","视频或音频素材的时长，单位为秒；图像为 0。",[],{"name":76,"required":27,"type":66,"description":77,"nullable":27,"default":68,"properties":78},"height","图像或视频素材的像素高度；不适用时为 0。",[],{"name":80,"required":18,"type":20,"description":81,"nullable":27,"properties":82},"kind","识别出的媒体类型，为 `image` \u002F `video` \u002F `audio` 之一。",[],{"name":84,"required":27,"type":20,"description":85,"nullable":27,"default":26,"properties":86},"mime","识别出的素材 MIME 类型，例如 `image\u002Fpng`。",[],{"name":88,"required":27,"type":66,"description":89,"nullable":27,"default":68,"properties":90},"width","图像或视频素材的像素宽度；不适用时为 0。",[],{"name":92,"required":27,"type":20,"description":93,"nullable":27,"default":94,"properties":95},"message","便于阅读的状态消息；调用成功时为 `\"success\"`。","success",[],{"name":97,"required":18,"type":98,"description":99,"nullable":27,"properties":100},"server_time","string · date-time","服务端生成响应时的时间戳，使用 ISO 8601 格式（UTC）。",[],{"data":102,"message":94,"server_time":108},{"asset_id":103,"created_at":104,"duration_sec":68,"height":105,"kind":106,"mime":107,"width":105},"example_asset_id",1788480000,1024,"image","image\u002Fpng","2026-09-04T00:00:00Z",[110],{"name":94,"description":111,"summary":52,"value":112},"示例仅用于说明响应结构，不代表实时账户数据或实际报价。ID 和 URL 均为占位内容。请调用模型查询及费用估算接口，获取当前可用模型和价格。",{"data":113,"message":94,"server_time":108},{"asset_id":103,"created_at":104,"duration_sec":68,"height":105,"kind":106,"mime":107,"width":105},[],{"status":116,"description":117,"contentType":23,"schema":118,"example":140,"headers":143},"default","错误响应。所有失败均使用统一结构：`error` 对象包含数字错误码 `code`、便于阅读的 `message`、可选的 `details` 字符串，以及提供后续处理建议的可选 `hint`（便于 AI Agent 使用）。",{"type":119,"description":26,"nullable":27,"properties":120},"ErrorResponse",[121],{"name":122,"required":18,"type":123,"description":26,"nullable":27,"properties":124},"error","ErrorDetail",[125,129,133,137],{"name":126,"required":18,"type":66,"description":127,"nullable":27,"properties":128},"code","机器可读的错误码。传输层失败时对应 HTTP 状态码（例如 401、404、422、500），其他情况可能使用业务专用错误码。",[],{"name":130,"required":27,"type":44,"description":131,"nullable":18,"properties":132},"details","可选的结构化错误详情，例如 422 响应中逐字段校验错误的 JSON 字符串。无补充信息时不返回。",[],{"name":134,"required":27,"type":44,"description":135,"nullable":18,"properties":136},"hint","供用户和 AI Agent 参考的错误处理建议，例如如何修正请求或在哪里获取 API Key。可能不返回此字段。",[],{"name":92,"required":18,"type":20,"description":138,"nullable":27,"properties":139},"便于阅读的错误原因说明，可安全记录到日志或展示给最终用户；此返回值未本地化。",[],{"error":141},{"code":142,"message":20,"details":20,"hint":20},1,[],[145],{"APIKeyHeader":146},[],[148,151,154],{"lang":149,"source":150},"SDK","from visionstory import VisionStoryClient\n\nclient = VisionStoryClient.from_env()\nasset = client.upload_asset(url=\"https:\u002F\u002Fexample.com\u002Fmedia\u002Freference.jpg\")\nprint(asset)",{"lang":152,"source":153},"REST","import os\nimport requests\n\nresponse = requests.post(\n    \"https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Fasset\",\n    headers={\"X-API-Key\": os.environ[\"VISIONSTORY_API_KEY\"]},\n    json={\n      \"url\": \"https:\u002F\u002Fexample.com\u002Fmedia\u002Freference.jpg\"\n    },\n)\nresponse.raise_for_status()\nprint(response.json())",{"lang":155,"source":156},"cURL","curl --request POST 'https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Fasset' \\\n  --header 'X-API-Key: $VISIONSTORY_API_KEY' \\\n  --header 'Content-Type: application\u002Fjson' \\\n  --data '{\n  \"url\": \"https:\u002F\u002Fexample.com\u002Fmedia\u002Freference.jpg\"\n}'","\u003Cpre class=\"shiki github-dark-default\" style=\"background-color:#0d1117;color:#e6edf3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#FF7B72\">from\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> visionstory \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> VisionStoryClient\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">client \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> VisionStoryClient.from_env()\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">asset \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> client.upload_asset(\u003C\u002Fspan>\u003Cspan style=\"color:#FFA657\">url\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"https:\u002F\u002Fexample.com\u002Fmedia\u002Freference.jpg\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79C0FF\">print\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">(asset)\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>","\u003Cpre class=\"shiki github-dark-default\" style=\"background-color:#0d1117;color:#e6edf3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">{\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">  \"data\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">    \"asset_id\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"example_asset_id\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">    \"created_at\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">1788480000\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">    \"duration_sec\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">0\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">    \"height\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">1024\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">    \"kind\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"image\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">    \"mime\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"image\u002Fpng\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">    \"width\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">1024\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">  },\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">  \"message\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"success\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7EE787\">  \"server_time\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"2026-09-04T00:00:00Z\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>",1788547144560]