dashscope
Original:🇺🇸 English
Translated
DashScope (Alibaba Cloud Bailian / 阿里云百炼) integration — image generation (qwen-image-2.0-pro), text-to-speech (qwen3-tts-flash), and ASR with word-level timestamps (qwen3-asr-flash-filetrans). Use when generating images via Qwen-Image, narrating via Qwen-TTS, or transcribing with word-level timestamps via Qwen-ASR.
37installs
Sourcecalesthio/openmontage
Added on
NPX Install
npx skill4agent add calesthio/openmontage dashscopeTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →DashScope
Current API
CRITICAL: DashScope's only supports and . Image generation, TTS, and ASR all use DashScope-native endpoints — not OpenAI-compatible paths.
/compatible-mode/v1//chat/completions/embeddingsAll three tools use .
Authorization: Bearer $DASHSCOPE_API_KEYImage Generation
text
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation- Model: (default),
qwen-image-2.0-pro,qwen-image-max,wan2.7-imagez-image-turbo - Body:
{model, input: {messages: [{role: "user", content: [{text: "prompt"}]}]}, parameters: {size: "W*H", n, prompt_extend, watermark}} - Size format uses asterisk: not
"1024*1024""1024x1024" - Response: (URL, valid ~24h) — must download separately
output.choices[0].message.content[0].image
Text-to-Speech
text
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generationSame endpoint as image gen, different body.
- Model: (default),
qwen3-tts-flash,qwen3-tts-instruct-flashqwen-tts-2025-05-22 - Body:
{model, input: {text, voice: "Cherry", language_type: "Auto"}} - Response: (WAV, valid ~24h) — must download separately
output.audio.url
ASR with Word-Level Timestamps
text
POST https://dashscope.aliyuncs.com/api/v1/services/audio/asr/transcription
Header: X-DashScope-Async: enable- Model: (NOT
qwen3-asr-flash-filetrans— the sync version has no word timestamps)qwen3-asr-flash - Body:
{model, input: {file_url: "https://public-url/audio.mp3"}, parameters: {enable_words: true, language_hints: ["zh","en"]}} - Returns → poll
task_iduntilGET /api/v1/tasks/{task_id}→ downloadSUCCEEDED→ JSON withoutput.result.transcription_urltranscripts[].sentences[].words[] - Timestamps in /
begin_timeare in milliseconds — the tool normalizes to secondsend_time
OpenMontage Usage
Image via selector
python
from tools.graphics.image_selector import ImageSelector
result = ImageSelector().execute({
"preferred_provider": "dashscope",
"prompt": "一只猫坐在沙发上",
"output_path": "projects/my-video/assets/images/cat.png",
})TTS via selector
python
from tools.audio.tts_selector import TTSSelector
result = TTSSelector().execute({
"preferred_provider": "dashscope",
"text": "如果 AI 真的会改变未来,普通人到底该怎么参与?",
"voice": "Cherry",
"output_path": "projects/my-video/assets/audio/narration.wav",
})ASR directly (word timestamps for subtitles)
python
from tools.analysis.dashscope_asr import DashscopeAsr
result = DashscopeAsr().execute({
"audio_url": "https://example.com/narration.wav",
"output_path": "projects/my-video/assets/audio/transcription.json",
})
# result.data["words"] is a flat list of {text, begin_time_seconds, end_time_seconds}Recommended Workflow
- Image: Generate a sample first. Check (default) — DashScope rewrites your prompt for better results. Disable if you need literal prompt adherence.
prompt_extend: true - TTS: Generate a 10-15 second sample before full narration. Approve voice and pacing before committing to full generation.
- ASR: Audio must be at a publicly accessible URL. Upload to any public host (S3, etc.) first. Local paths are rejected with a clear error.
- Subtitles: Build from — each word has
result.data["words"]andbegin_time_seconds. Group words into caption phrases by language semantics, not fixed character count.end_time_seconds
Parameters
Image (dashscope_image
)
dashscope_image- (required): text prompt
prompt - : default
modelqwen-image-2.0-pro - : default
size— asterisk separator, not "x""1024*1024" - : 1-6 images
n - : things to avoid (max 500 chars)
negative_prompt - : default
prompt_extend— auto-rewrite prompt for better resultstrue - : default
watermarkfalse - : for reproducibility
seed
TTS (dashscope_tts
)
dashscope_tts- (required): text to synthesize (max 600 chars for qwen3-tts-flash)
text - : default
modelqwen3-tts-flash - : default
voice— other voices:"Cherry","Ethan", etc."Chelsie" - : default
language_type—"Auto","Chinese","English","Japanese""Korean" - : natural language delivery instructions (only for
instructions)qwen3-tts-instruct-flash
ASR (dashscope_asr
)
dashscope_asr- (required): must be publicly accessible URL
audio_url - :
model(only model that supports word timestamps)qwen3-asr-flash-filetrans - : default
language_hints["zh", "en"] - : default
enable_words— required for word-level timestampstrue - : default
poll_interval_seconds5.0 - : default
timeout_seconds300
Troubleshooting
- Image size error: Use with asterisk, not
"W*H". Example:"WxH"."2048*2048" - TTS no audio URL: Check — if empty, the model name or voice may be wrong.
output.audio.url - ASR "file not accessible": must be publicly reachable. DashScope servers fetch the file; local paths and auth-gated URLs don't work.
audio_url - ASR poll timeout: Increase (default 300). Long audio files take longer to transcribe.
timeout_seconds - ASR no word timestamps: Ensure and model is
enable_words: true(not the syncqwen3-asr-flash-filetrans).qwen3-asr-flash - Auth error (401): Verify is set. Use
DASHSCOPE_API_KEYheader.Authorization: Bearer $KEY
Safety
Never print or write the API key to logs, metadata, patches, or project artifacts. should contain only empty variable names. The tool's method redacts the key from error messages.
.env.example_safe_error()