npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bailian-cli

v0.1.2

Published

CLI for Alibaba Cloud Bailian (DashScope) AI Platform

Readme

>_ Bailian CLI

The official command-line interface for Alibaba Cloud Bailian (DashScope) AI Platform

npm version Node.js TypeScript License

中文文档 · API Documentation · Get API Key


Chat with Qwen, generate images & videos, understand images, call agents, manage memory, search the web — all from your terminal.

Built for AI Agents. Every command works as a structured tool call.

Installation

npm install -g bailian-cli

After installation, both bailian and bl (short alias) are available.

Quick Start

# Authenticate
bl auth login --api-key sk-xxxxx

# Chat with Qwen
bl text chat --message "What is DashScope?"

# Multimodal chat (text + image + audio + video)
bl omni --message "Describe this image" --image ./photo.jpg

# Generate an image
bl image generate --prompt "A cat in a spacesuit" --out-dir ./images/

# Generate a video from local image
bl video generate --image ./cat.png --prompt "Make the cat move" --download cat.mp4

Features

Local File Support: All commands accepting file URLs also accept local file paths — files are auto-uploaded. Just pass ./photo.png instead of a URL.

| Category | Commands | Default Model | |:---------|:---------|:--------------| | Text | text chat | qwen3.6-plus | | Omni | omni (text+image+audio+video) | qwen3.5-omni-plus | | Image | image generate | qwen-image-2.0 | | | image edit (multi-image merge) | qwen-image-2.0 | | Video | video generate (text/image-to-video) | happyhorse-1.0-t2v / happyhorse-1.0-i2v | | | video edit (style transfer) | happyhorse-1.0-video-edit | | | video task get / video download | — |

| Category | Commands | Default Model | |:---------|:---------|:--------------| | Vision | vision describe | qwen-vl-max | | Speech | speech synthesize (TTS) | cosyvoice-v3-flash | | | speech recognize (ASR) | fun-asr | | File | file upload (to temp OSS) | — | | App | app call (agents / workflows) | — | | Memory | memory add/search/list/update/delete | — | | Knowledge | knowledge retrieve (RAG) | — | | Search | search web | — |

Usage Examples

Text Chat

# Simple chat
bl text chat --message "Explain quantum computing"

# Multi-turn conversation
bl text chat --message "Hello" --message "assistant:Hi!" --message "How are you?"

# With system prompt
bl text chat --system "You are a coding assistant." --message "Write fizzbuzz in Python"

# Enable thinking mode (qwen3 / qwq)
bl text chat --model qwq-plus --message "Solve 1+1" --enable-thinking

Omni Multimodal

# Describe an image
bl omni --message "What's in this photo?" --image ./photo.jpg

# Understand audio
bl omni --message "Transcribe this audio" --audio ./recording.wav

# Generate speech output
bl omni --message "Read this aloud" --audio-out greeting.wav

Image Generation & Editing

# Generate images
bl image generate --prompt "Mountain landscape" --size 16:9

# Generate multiple images
bl image generate --prompt "Logo design" --n 3 --out-dir ./generated/

# Edit an image (local file auto-uploaded)
bl image edit --image ./photo.png --prompt "Change background to beach"

# Multi-image merge
bl image edit --image ./a.png --image ./b.png --prompt "Combine into a collage"

Video Generation & Editing

# Text to video
bl video generate --prompt "A person reading a book" --download output.mp4

# Image to video (local file auto-uploaded)
bl video generate --image ./cat.png --prompt "Make the cat move" --ratio 3:4

# Edit a video (style transfer)
bl video edit --video ./input.mp4 --prompt "Convert to clay style"

Speech

# List available voices
bl speech synthesize --list-voices --model cosyvoice-v3-flash

# Text-to-speech
bl speech synthesize --text "Hello world" --voice longyumi_v3 --out speech.wav

# Stream to audio player (macOS)
bl speech synthesize --text "你好" --voice longyumi_v3 --stream | afplay -

# Speech-to-text (local file auto-uploaded)
bl speech recognize --url ./meeting.mp3

File Upload, App, Memory & Knowledge

# Upload a local file to DashScope temp storage
bl file upload --file ./photo.png --model qwen-vl-max

# Call a Bailian application
bl app call --app-id <APP_ID> --prompt "Hello" --stream

# Memory management
bl memory add --user-id user1 --content "User prefers Python"
bl memory search --user-id user1 --query "programming language"

# Knowledge base retrieval (requires AK/SK)
bl knowledge retrieve --index-id <INDEX_ID> --query "search text"

# Web search
bl search web --query "latest TypeScript features" --count 5

Authentication

DashScope API Key

Required for most commands. Get your key from the DashScope Console.

# Option 1: Environment variable
export DASHSCOPE_API_KEY=sk-xxxxx

# Option 2: Login command (persisted to ~/.bailian/config.json)
bl auth login --api-key sk-xxxxx

# Option 3: Per-command flag
bl text chat --api-key sk-xxxxx --message "Hello"

Alibaba Cloud AK/SK (Knowledge Base only)

Required for knowledge retrieve. Get your AccessKey from RAM Console.

export ALIBABA_CLOUD_ACCESS_KEY_ID=LTAI5t...
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=...
export BAILIAN_WORKSPACE_ID=ws-...

Configuration

# View current config
bl config show

# Set defaults
bl config set --key region --value us
bl config set --key default_text_model --value qwen-turbo
bl config set --key timeout --value 600

# Export MCP-compatible JSON Schema for all commands
bl config export-schema

# Self-update to latest version
bl update

Config file location: ~/.bailian/config.json

Global Flags

| Flag | Description | |:-----|:------------| | --api-key <key> | API key (overrides all other auth) | | --region <region> | API region: cn (default), us, intl | | --output <format> | Output format: text, json | | --quiet | Suppress non-essential output | | --verbose | Print HTTP request/response details | | --dry-run | Show what would happen without executing | | --no-color | Disable ANSI colors and spinners | | --timeout <seconds> | Request timeout (default: 300) | | --non-interactive | Disable interactive prompts (CI mode) |

Project Structure

src/
├── main.ts              # CLI entry point
├── registry.ts          # Command registry (30 commands)
├── args.ts              # Argument parsing
├── command.ts           # Command interface & global options
├── auth/                # Authentication (credentials, resolver, setup)
├── client/              # HTTP client (AK signing, endpoints, streaming)
├── commands/            # Command implementations
│   ├── auth/            #   login, status, logout
│   ├── text/            #   chat
│   ├── omni/            #   multimodal chat
│   ├── image/           #   generate, edit
│   ├── video/           #   generate, edit, task-get, download
│   ├── vision/          #   describe
│   ├── speech/          #   synthesize, recognize
│   ├── file/            #   upload
│   ├── app/             #   call
│   ├── memory/          #   add, search, list, update, delete, profile
│   ├── knowledge/       #   retrieve
│   ├── search/          #   web
│   └── config/          #   show, set, export-schema
├── config/              # Config loading & schema (Zod)
├── errors/              # Error handling hierarchy
├── output/              # Formatters (text, json, progress, status-bar)
├── polling/             # Async task polling
├── update/              # Self-update checker
└── utils/               # Utilities (fs, token, env, prompt)

Links

| Resource | URL | |:---------|:----| | DashScope API Docs | https://help.aliyun.com/zh/model-studio/ | | Qwen Model List | https://help.aliyun.com/zh/model-studio/getting-started/models | | Bailian Console | https://bailian.console.aliyun.com/ | | Get API Key | https://bailian.console.aliyun.com/cn-beijing/?source_channel=aliway&tab=app#/api-key | | Get AccessKey | https://ram.console.aliyun.com/manage/ak |


Made with >_ by the Bailian team