API 参考
把官方 SDK 的 base_url 设成这个地址。模型 ID 到模型广场复制,不要传企业编号。
https://huantu.xyz/api/v1Bearer ic_live_...curl
curl https://huantu.xyz/api/v1/models \ -H "Authorization: Bearer ic_live_..."失败
{ "error": { "message": "错误原因", "type": "invalid_request_error", "code": "invalid_request" }}图片
POST
/images/generations一次返回图片。编辑走 /images/edits,参考图用同名 image 上传。
curl
curl https://huantu.xyz/api/v1/images/generations \ -H "Authorization: Bearer ic_live_..." \ -H "Content-Type: application/json" \ -d '{ "model": "模型广场里的 ID", "prompt": "白色背景的运动鞋主图", "size": "1024x1024" }'视频
POST
/videos先创建拿到 id,查到 completed,再下载 MP4。
- 创建
- POST /videos
- 查询
- GET /videos/{id}?model=
- 下载
- GET /videos/{id}/content
curl
curl https://huantu.xyz/api/v1/videos \ -H "Authorization: Bearer ic_live_..." \ -F "model=模型广场里的 ID" \ -F "prompt=运动鞋在雨夜街头旋转" \ -F "seconds=5" \ -F "size=1280x720"音频
POST
/audio/speech成功时响应体就是音频文件。
curl
curl https://huantu.xyz/api/v1/audio/speech \ -H "Authorization: Bearer ic_live_..." \ -H "Content-Type: application/json" \ -d '{ "model": "模型广场里的 ID", "input": "欢迎使用幻图开放接口。", "voice": "alloy" }' \ --output speech.mp3