Tomoviee AI Text-to-Music
Overview
Generate background music from text prompts.
- - API capability: INLINECODE0
- Task creation endpoint: INLINECODE1
- Result endpoint: INLINECODE2
Provider and Endpoint Provenance
Use this mapping to verify provider identity and runtime endpoints:
- - Vendor portals:
https://www.tomoviee.ai and INLINECODE4 - API gateway host used by this skill: INLINECODE5
- This skill sends runtime API calls only to INLINECODE6
Credential Handling
- -
app_key and app_secret are only used to construct Authorization: Basic <base64(app_key:app_secret)>. - Credentials are kept in process memory only and are not written to disk by this skill.
- Do not commit credentials into
SKILL.md, scripts, or repository files.
Quick Start
Install dependencies
CODEBLOCK0
Authentication helper
CODEBLOCK1
Python Client
CODEBLOCK2
API Usage
Basic Example
CODEBLOCK3
Parameters
- -
prompt (required): Prompt text. Supports up to 77 tokens; extra content is truncated. - INLINECODE12 (required): Target music duration in seconds, range
0-95. - INLINECODE14 (required): Number of generated music outputs, range
1-4. - INLINECODE16 (optional): Whether to disable translation.
- INLINECODE17 (optional): Callback URL.
- INLINECODE18 (optional): Transparent callback parameter.
Async Workflow
- 1. Create task and get INLINECODE19
- Poll with INLINECODE20
- Parse output URL from INLINECODE21
Status codes:
- -
1 queued - INLINECODE23 processing
- INLINECODE24 success
- INLINECODE25 failed
- INLINECODE26 cancelled
- INLINECODE27 timeout
Resources
- -
scripts/tomoviee_text2music_client.py - main API client - INLINECODE29 - compatibility import shim
- INLINECODE30 - auth token helper
- INLINECODE31 - API reference and parameter constraints
- INLINECODE32 - prompt writing guidance
External Resources
- - Developer portal (global): INLINECODE33
- API docs (global): INLINECODE34
- Developer portal (mainland): INLINECODE35
- API docs (mainland): INLINECODE36
- API gateway host used by this package: INLINECODE37
Tomoviee AI 文本转音乐
概述
根据文本提示生成背景音乐。
- - API 能力:tmtext2music
- 任务创建端点:https://openapi.wondershare.cc/v1/open/capacity/application/tmtext2music
- 结果端点:https://openapi.wondershare.cc/v1/open/pub/task
提供商与端点来源
使用此映射验证提供商身份和运行时端点:
- - 供应商门户:https://www.tomoviee.ai 和 https://www.tomoviee.cn
- 此技能使用的 API 网关主机:https://openapi.wondershare.cc
- 此技能仅向 openapi.wondershare.cc 发送运行时 API 调用
凭证处理
- - appkey 和 appsecret 仅用于构建 Authorization: Basic key:appsecret)>。
- 凭证仅保留在进程内存中,此技能不会将其写入磁盘。
- 请勿将凭证提交到 SKILL.md、脚本或仓库文件中。
快速开始
安装依赖
bash
pip install -r requirements.txt
认证辅助工具
bash
python scripts/generateauthtoken.py YOURAPPKEY YOURAPPSECRET
Python 客户端
python
from scripts.tomovieetext2musicclient import TomovieeText2MusicClient
client = TomovieeText2MusicClient(appkey, appsecret)
API 使用
基本示例
python
taskid = client.textto_music(
prompt=欢快的科技音乐,现代且充满活力的电子流行,
duration=30,
qty=1,
disable_translate=False,
)
result = client.polluntilcomplete(task_id)
import json
audiourl = json.loads(result[result])[audiopath][0]
print(audio_url)
参数
- - prompt(必填):提示文本。最多支持 77 个令牌,超出部分将被截断。
- duration(必填):目标音乐时长(秒),范围 0-95。
- qty(必填):生成的音乐输出数量,范围 1-4。
- disable_translate(可选):是否禁用翻译。
- callback(可选):回调 URL。
- params(可选):透明回调参数。
异步工作流
- 1. 创建任务并获取 taskid
- 使用 polluntilcomplete(taskid) 轮询
- 从 result 解析输出 URL
状态码:
- - 1 已排队
- 2 处理中
- 3 成功
- 4 失败
- 5 已取消
- 6 超时
资源
- - scripts/tomovieetext2musicclient.py - 主 API 客户端
- scripts/tomovieetexttomusicclient.py - 兼容性导入垫片
- scripts/generateauthtoken.py - 认证令牌辅助工具
- references/audioapis.md - API 参考和参数约束
- references/promptguide.md - 提示编写指南
外部资源
- - 开发者门户(全球):https://www.tomoviee.ai/developers.html
- API 文档(全球):https://www.tomoviee.ai/doc/
- 开发者门户(中国大陆):https://www.tomoviee.cn/developers.html
- API 文档(中国大陆):https://www.tomoviee.cn/doc/
- 此包使用的 API 网关主机:https://openapi.wondershare.cc