Alibaba Cloud Model Studio CLI is a command-line tool built by Alibaba Cloud Model Studio specifically for AI Agents. With a single installation command and authentication setup, you can integrate the AI capabilities of Model Studio into various AI tools.
Installation and setup
Installation
Prerequisites: Node.js ≥ 22.12.0. Model Studio CLI can only be installed via npm.
Option 1: Install within an AI Agent (recommended)
Tell the Agent:
Please read https://bailian.aliyun.com/cli/install.md and install Alibaba Cloud Model Studio CLI for me following the instructionsOption 2: Manual installation
# Step 1: Install CLI
npm install -g bailian-cli
# Step 2: Install Skills (register Model Studio capability descriptions to each Agent's Skills directory)
npx skills add modelstudioai/cli --all -g
# Step 3: Verify installation
bl --versionAuthentication and configuration
Before using Model Studio CLI, you must complete authentication. The following authentication methods are supported:
Authentication method | Command | Use case |
Console login (recommended) |
| Model invocation + application management (opens browser for OAuth login) |
API Key |
| Model invocation (text, image, video, speech, etc.) |
Environment variable | Configure API Key environment variable | CI/CD, headless environments |
Config file |
| Persistent (does not validate Key) |
One-time pass-through |
| Single invocation, not persisted |
Console login and API Key can be configured simultaneously without overriding each other.
After authentication is complete, you can use bl config to configure parameters such as the model and output directory:
# View current configuration
bl config show
# Set default text model
bl config set --key default-text-model --value qwen3.7-max
# Set output directory
bl config set --key output_dir --value ~/bailian-outputModel Studio CLI is compatible with mainstream AI tools and frameworks such as Claude Code, Cursor, Codex, and Qwen Code. For the complete compatibility list and integration methods, see the Model Studio CLI GitHub repository.
Real-world scenarios
E-commerce product image generation
Tell the Agent:
Generate a set of Amazon product listing images, 6 images, the product is a plain black summer men's T-shirtThe Agent automatically combines multiple commands to complete the task:
Generate 6 product listing images:
bl image generate --prompt "Plain black summer men's T-shirt, white background, Amazon product listing style" --n 6 --out-dir ./ecommerce/To adjust a specific image:
bl image edit --image ./ecommerce/image_01.png --prompt "Add a model wearing the T-shirt"To generate a product showcase video:
bl video generate --image ./ecommerce/image_01.png --prompt "T-shirt 360-degree rotating showcase" --download tshirt-demo.mp4
News podcast generation
Tell the Agent:
Search for today's AI news, write a dialogue script, then generate an audio podcast with distinct male and female voicesThe Agent executes the following steps in sequence:
Search the web for news material:
bl search web --query "today's AI news"Use an LLM to write a dialogue script:
bl text chat --message "Based on the following news material, write a dialogue script..."Generate audio for each role:
bl speech synthesize --text "Host A: Have you heard..." --voice Ethan --out host_male.mp3 bl speech synthesize --text "Host B: What happened?..." --voice Cherry --out host_female.mp3Use ffmpeg to merge the audio segments into a complete podcast.
Storybook generation
Tell the Agent:
Generate a Little Red Riding Hood storybook, photorealistic version, maintain character consistency, 20 pages, 16:9 aspect ratio, output as PDFThe Agent automatically completes the workflow: generate story text for each page, create style-consistent illustrations based on the text, then lay out and export as PDF.
Command reference
Text chat
bl text chat
Send text chat requests, compatible with the OpenAI API format.
bl text chat --message <text> [flags]Parameter | Description | Default |
| Model ID | qwen3.7-max |
| Message content (repeatable, prefix with | — |
| Read messages from a JSON file ( | — |
| System prompt | — |
| Maximum number of tokens to generate | 4096 |
| Sampling temperature (0.0, 2.0] | — |
| Top-p sampling threshold | — |
| Streaming output (enabled by default on TTY) | — |
| Tool definition, JSON or file path (repeatable) | — |
| Enable thinking mode (for qwen3/qwq models) | — |
| Maximum tokens for thinking mode | 4096 |
Omni-modal understanding
bl omni
Omni-modal conversation supporting image, audio, and video inputs with text and speech outputs.
bl omni --message <text> [flags]Parameter | Description | Default |
| Message content (repeatable) | — |
| Model ID | qwen3.5-omni-plus |
| System prompt | — |
| Image URL or local file (repeatable) | — |
| Audio URL or local file (repeatable) | — |
| Video URL or local file | — |
| Output voice (options: Chelsie, Cherry, Ethan, Serena, Tina) | Cherry |
| Audio output format | wav |
| Save audio to file | Auto-generated |
| Output text only, without generating audio | — |
| Maximum number of tokens to generate | — |
| Sampling temperature (0.0, 2.0] | — |
Image generation and editing
bl image generate
Generate images from text.
bl image generate --prompt <text> [flags]Parameter | Description | Default |
| Image description | — |
| Model ID | qwen-image-2.0 |
| Image size, supports ratio (3:4, 16:9) or pixels (2048*2048) | — |
| Number of images to generate per request (max 6) | 1 |
| Random seed for reproducible results | — |
| Negative prompt to exclude unwanted content | — |
| Enable prompt extension | true (synchronous mode) |
| Add watermark | true |
| Async mode, return task ID immediately | — |
| Image save directory | — |
| Filename prefix | image |
| Polling interval | 3 |
bl image edit
Edit existing images with support for multi-image compositing.
bl image edit --image <url> --prompt <text> [flags]Parameter | Description | Default |
| Source image URL or local file (repeatable, for multi-image compositing) | — |
| Editing instruction | — |
| Model ID | qwen-image-2.0 |
| Output size | — |
| Number of outputs (max 6) | 1 |
| Random seed | — |
| Negative prompt | — |
| Enable prompt extension | true |
| Add watermark | true |
| Save directory | — |
| Filename prefix | edited |
Video generation and editing
bl video generate
Generate videos from text or images.
bl video generate --prompt <text> [--image <url>] [flags]Parameter | Description | Default |
| Video description | — |
| Model ID | happyhorse-1.0-t2v (i2v when --image is specified) |
| Input image, enables image-to-video mode | — |
| Negative prompt | — |
| Resolution (e.g. 1280*720) | — |
| Aspect ratio (e.g. 16:9, 1:1) | — |
| Video duration (seconds) | 5 |
| Enable prompt extension | — |
| Add watermark | true |
| Random seed | — |
| Save to file upon completion | — |
| Return task ID immediately | — |
| Same as --no-wait, for Agent/CI mode | — |
| Polling interval | 5 |
bl video edit
Edit videos with support for style transfer, object replacement, and more.
bl video edit --video <url> --prompt <text> [flags]Parameter | Description | Default |
| Input video URL or local file (2-10 seconds) | — |
| Editing instruction | — |
| Model ID | happyhorse-1.0-video-edit |
| Reference images (up to 4, comma-separated) | — |
| Negative prompt | — |
| Resolution: 720P or 1080P | 1080P |
| Aspect ratio (16:9, 9:16, 1:1, 4:3, 3:4) | — |
| Output duration (2-10 seconds) | — |
| Audio processing: auto or origin (keep original audio) | auto |
| Enable prompt extension | — |
| Add watermark | true |
| Random seed | — |
| Save to file | — |
| Return task ID immediately | — |
| Polling interval | 15 |
bl video ref
Generate videos from multi-image references with support for multiple subjects, camera angles, and dubbing.
bl video ref --prompt <text> --image <url>... [flags]Parameter | Description | Default |
| Video description, use markers to reference assets (image 1, video 1, etc.) | — |
| Model ID | happyhorse-1.0-r2v |
| Reference images (repeatable, for multiple subjects) | — |
| Reference videos (repeatable) | — |
| Voice-over for images (matched by position) | — |
| Voice-over for videos (matched by position) | — |
| Resolution: 720P or 1080P | 720P |
| Aspect ratio (16:9, 9:16, 1:1) | — |
| Video duration (2-10 seconds) | 5 |
| Enable prompt extension | — |
| Add watermark | true |
| Random seed | — |
| Save to file | — |
| Return task ID immediately | — |
| Polling interval | 15 |
bl video task get
Query the status of an asynchronous video task.
bl video task get --task-id <id>Parameter | Description |
| Async task ID |
bl video download
Download a completed video by task ID.
bl video download --task-id <id> --out <path>Parameter | Description |
| Task ID |
| Output file path |
Visual understanding
bl vision describe
Describe image or video content using vision models.
bl vision describe --image <path-or-url> [flags]Parameter | Description | Default |
| Image path or URL | — |
| Video file path or URL | — |
| Question about the content | Auto-detect |
| Vision model | qwen3-vl-plus |
Speech synthesis and recognition
bl speech synthesize
Text-to-speech (TTS).
bl speech synthesize --text <text> [flags]Parameter | Description | Default |
| Text to synthesize | — |
| Read text from file | — |
| Model ID | cosyvoice-v3-flash |
| Voice ID (use --list-voices to view available voices) | — |
| List available voices | — |
| Audio format: mp3, pcm, wav, opus | mp3 |
| Sample rate (Hz) | — |
| Volume (0-100) | 50 |
| Speech rate (0.5-2.0) | 1.0 |
| Pitch (0.5-2.0) | 1.0 |
| Random seed(0-65535) | — |
| Language hint (zh, en, ja, ko, etc.) | — |
| Natural language style instruction (e.g., "please speak in a gentle tone") | — |
| Enable SSML markup parsing | — |
| Save audio to file | Auto-generated |
| Stream raw PCM audio output | — |
bl speech recognize
Speech-to-text (ASR).
bl speech recognize --url <audio-url> [flags]Parameter | Description | Default |
| Audio file URL or local path (repeatable, up to 100) | — |
| Model ID | fun-asr |
| Language hint (zh, en, ja, etc.) | — |
| Enable speaker diarization | — |
| Expected number of speakers (requires --diarization) | — |
| Hot word list ID to improve recognition accuracy | — |
| Audio channel ID | 0 |
| Save full recognition results to JSON file | — |
| Return task ID immediately | — |
| Polling interval | 2 |
Web search
bl search web
Web search。
bl search web --query <text> [flags]Parameter | Description | Default |
| Search keywords | — |
| Number of search results | 10 |
| List available MCP search tools | — |
Applications and data
bl app call
Call a Model Studio application (agent or workflow).
bl app call --app-id <id> --prompt <text> [flags]Parameter | Description | Default |
| Application ID (required) | — |
| Input prompt | — |
| Image URL (repeatable) | — |
| Pre-uploaded file ID (repeatable) | — |
| Session ID for multi-turn conversations | — |
| Streaming output (enabled by default on TTY) | — |
| Knowledge base pipeline ID (comma-separated) | — |
| Memory ID to enable long-term memory | — |
| Business parameters JSON (workflow variables) | — |
| Display Agent thinking process | — |
bl app list
List Model Studio applications.
bl app list [flags]Parameter | Description | Default |
| Search by name | — |
| Page number | 1 |
| Items per page | 30 |
| API region | cn-beijing |
bl memory add
Add memory.
bl memory add --user-id <id> [flags]Parameter | Description |
| User ID (required) |
| Messages JSON array |
| Custom memory content |
| User profile schema ID |
| Memory library ID (isolated memory space) |
bl memory search
Search memory.
bl memory search --user-id <id> [flags]Parameter | Description | Default |
| User ID (required) | — |
| Search keywords | — |
| Messages JSON array for contextual search | — |
| Number of results to return | 10 |
| Memory library ID | — |
bl memory list
List memories.
bl memory list --user-id <id> [flags]Parameter | Description | Default |
| User ID (required) | — |
| Items per page | 10 |
| Page number | 1 |
| Memory library ID | — |
bl knowledge retrieve
Retrieve from Model Studio knowledge base (requires AccessKey authentication).
bl knowledge retrieve --index-id <id> --query <text> [flags]Parameter | Description | Default |
| Knowledge base index ID (required) | — |
| Search keywords (required) | — |
| Model Studio workspace ID | — |
| Number of results to return | 10 |
| Enable reranking | — |
| Number of results to retain after reranking | — |
| Alibaba Cloud AccessKey ID | — |
| Alibaba Cloud AccessKey Secret | — |
Development utilities
bl file upload
Upload local files to DashScope temporary storage (valid for 48 hours).
bl file upload --file <path> --model <model>Parameter | Description |
| Local file path |
| Target model name (file is bound to this model) |
bl usage free
Query model free quota.
bl usage free --model <model> [flags]Parameter | Description | Default |
| Model name | — |
| API region | cn-beijing |
bl mcp list
List activated MCP services.
bl mcp list [flags]Parameter | Description | Default |
| Filter by name | — |
| Service type: OFFICIAL or PRIVATE | OFFICIAL |
| Page number | 1 |
| Items per page | 30 |
| API region | cn-beijing |
bl pipeline run
Run a pipeline workflow.
bl pipeline run <file> [flags]Parameter | Description | Default |
| Runtime input (JSON) | — |
| Read input from file | — |
| Maximum number of parallel steps | 1 |
| Event output format: jsonl | — |
| Step timeout | — |
bl advisor recommend
Recommend the best model based on your requirements.
bl advisor recommend <prompt> [flags]Parameter | Description |
| Describe your requirements |
| Show only intent analysis and candidate list without ranking |
FAQ
Q: What should I do if the installation fails?
Verify that your Node.js version is 22.12.0 or later and install using npm (pnpm/yarn is not supported):
node --version
npm install -g bailian-cli
npx skills add modelstudioai/cli --all -gQ: What should I do if authentication fails?
Check whether the API key is correctly configured:
bl auth statusTo reconfigure:
bl auth logout
bl auth login --api-key sk-xxx
# Or log in through the browser
bl auth login --consoleQ: Can I use local files directly?
Yes. Simply pass the file path to the Agent. The CLI automatically uploads files to temporary storage (valid for 48 hours):
Convert ./photo.png to watercolor style
Transcribe the recording ./meeting.wav
Describe the content of ./demo.mp4Q: How do I view the full parameters of a command?
Ask the Agent "What parameters does bl image generate have?", or run the following command directly:
bl <command> --help