bailian-cli 0.1.2-beta.0 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md DELETED
@@ -1,291 +0,0 @@
1
- <div align="center">
2
-
3
- <img src="https://img.alicdn.com/imgextra/i1/O1CN01RSQFUD1jN5IBzHORt_!!6000000004535-2-tps-2440-521.png" alt="Bailian CLI" width="420" />
4
-
5
- # >_ Bailian CLI
6
-
7
- **The official command-line interface for Alibaba Cloud Bailian (DashScope) AI Platform**
8
-
9
- [![npm version](https://img.shields.io/npm/v/bailian-cli?color=0969da&label=npm)](https://www.npmjs.com/package/bailian-cli)
10
- [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
11
- [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6)](https://www.typescriptlang.org)
12
- [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
13
-
14
- [中文文档](README_CN.md) · [API Documentation](https://help.aliyun.com/zh/model-studio/) · [Get API Key](https://bailian.console.aliyun.com/cn-beijing/?source_channel=aliway&tab=app#/api-key)
15
-
16
- ---
17
-
18
- *Chat with Qwen, generate images & videos, understand images, call agents,*
19
- *manage memory, search the web — all from your terminal.*
20
-
21
- *Built for AI Agents. Every command works as a structured tool call.*
22
-
23
- </div>
24
-
25
- ## Installation
26
-
27
- ```bash
28
- npm install -g bailian-cli
29
- ```
30
-
31
- After installation, both `bailian` and `bl` (short alias) are available.
32
-
33
- ## Quick Start
34
-
35
- ```bash
36
- # Authenticate
37
- bl auth login --api-key sk-xxxxx
38
-
39
- # Chat with Qwen
40
- bl text chat --message "What is DashScope?"
41
-
42
- # Multimodal chat (text + image + audio + video)
43
- bl omni --message "Describe this image" --image ./photo.jpg
44
-
45
- # Generate an image
46
- bl image generate --prompt "A cat in a spacesuit" --out-dir ./images/
47
-
48
- # Generate a video from local image
49
- bl video generate --image ./cat.png --prompt "Make the cat move" --download cat.mp4
50
- ```
51
-
52
- ## Features
53
-
54
- > **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.
55
-
56
- <table>
57
- <tr><td>
58
-
59
- | Category | Commands | Default Model |
60
- |:---------|:---------|:--------------|
61
- | **Text** | `text chat` | qwen3.6-plus |
62
- | **Omni** | `omni` (text+image+audio+video) | qwen3.5-omni-plus |
63
- | **Image** | `image generate` | qwen-image-2.0 |
64
- | | `image edit` (multi-image merge) | qwen-image-2.0 |
65
- | **Video** | `video generate` (text/image-to-video) | happyhorse-1.0-t2v / happyhorse-1.0-i2v |
66
- | | `video edit` (style transfer) | happyhorse-1.0-video-edit |
67
- | | `video task get` / `video download` | — |
68
-
69
- </td></tr>
70
- <tr><td>
71
-
72
- | Category | Commands | Default Model |
73
- |:---------|:---------|:--------------|
74
- | **Vision** | `vision describe` | qwen-vl-max |
75
- | **Speech** | `speech synthesize` (TTS) | cosyvoice-v3-flash |
76
- | | `speech recognize` (ASR) | fun-asr |
77
- | **File** | `file upload` (to temp OSS) | — |
78
- | **App** | `app call` (agents / workflows) | — |
79
- | **Memory** | `memory add/search/list/update/delete` | — |
80
- | **Knowledge** | `knowledge retrieve` (RAG) | — |
81
- | **Search** | `search web` | — |
82
-
83
- </td></tr>
84
- </table>
85
-
86
- ## Usage Examples
87
-
88
- ### Text Chat
89
-
90
- ```bash
91
- # Simple chat
92
- bl text chat --message "Explain quantum computing"
93
-
94
- # Multi-turn conversation
95
- bl text chat --message "Hello" --message "assistant:Hi!" --message "How are you?"
96
-
97
- # With system prompt
98
- bl text chat --system "You are a coding assistant." --message "Write fizzbuzz in Python"
99
-
100
- # Enable thinking mode (qwen3 / qwq)
101
- bl text chat --model qwq-plus --message "Solve 1+1" --enable-thinking
102
- ```
103
-
104
- ### Omni Multimodal
105
-
106
- ```bash
107
- # Describe an image
108
- bl omni --message "What's in this photo?" --image ./photo.jpg
109
-
110
- # Understand audio
111
- bl omni --message "Transcribe this audio" --audio ./recording.wav
112
-
113
- # Generate speech output
114
- bl omni --message "Read this aloud" --audio-out greeting.wav
115
- ```
116
-
117
- ### Image Generation & Editing
118
-
119
- ```bash
120
- # Generate images
121
- bl image generate --prompt "Mountain landscape" --size 16:9
122
-
123
- # Generate multiple images
124
- bl image generate --prompt "Logo design" --n 3 --out-dir ./generated/
125
-
126
- # Edit an image (local file auto-uploaded)
127
- bl image edit --image ./photo.png --prompt "Change background to beach"
128
-
129
- # Multi-image merge
130
- bl image edit --image ./a.png --image ./b.png --prompt "Combine into a collage"
131
- ```
132
-
133
- ### Video Generation & Editing
134
-
135
- ```bash
136
- # Text to video
137
- bl video generate --prompt "A person reading a book" --download output.mp4
138
-
139
- # Image to video (local file auto-uploaded)
140
- bl video generate --image ./cat.png --prompt "Make the cat move" --ratio 3:4
141
-
142
- # Edit a video (style transfer)
143
- bl video edit --video ./input.mp4 --prompt "Convert to clay style"
144
- ```
145
-
146
- ### Speech
147
-
148
- ```bash
149
- # List available voices
150
- bl speech synthesize --list-voices --model cosyvoice-v3-flash
151
-
152
- # Text-to-speech
153
- bl speech synthesize --text "Hello world" --voice longyumi_v3 --out speech.wav
154
-
155
- # Stream to audio player (macOS)
156
- bl speech synthesize --text "你好" --voice longyumi_v3 --stream | afplay -
157
-
158
- # Speech-to-text (local file auto-uploaded)
159
- bl speech recognize --url ./meeting.mp3
160
- ```
161
-
162
- ### File Upload, App, Memory & Knowledge
163
-
164
- ```bash
165
- # Upload a local file to DashScope temp storage
166
- bl file upload --file ./photo.png --model qwen-vl-max
167
-
168
- # Call a Bailian application
169
- bl app call --app-id <APP_ID> --prompt "Hello" --stream
170
-
171
- # Memory management
172
- bl memory add --user-id user1 --content "User prefers Python"
173
- bl memory search --user-id user1 --query "programming language"
174
-
175
- # Knowledge base retrieval (requires AK/SK)
176
- bl knowledge retrieve --index-id <INDEX_ID> --query "search text"
177
-
178
- # Web search
179
- bl search web --query "latest TypeScript features" --count 5
180
- ```
181
-
182
- ## Authentication
183
-
184
- ### DashScope API Key
185
-
186
- Required for most commands. Get your key from the [DashScope Console](https://bailian.console.aliyun.com/cn-beijing/?source_channel=aliway&tab=app#/api-key).
187
-
188
- ```bash
189
- # Option 1: Environment variable
190
- export DASHSCOPE_API_KEY=sk-xxxxx
191
-
192
- # Option 2: Login command (persisted to ~/.bailian/config.json)
193
- bl auth login --api-key sk-xxxxx
194
-
195
- # Option 3: Per-command flag
196
- bl text chat --api-key sk-xxxxx --message "Hello"
197
- ```
198
-
199
- ### Alibaba Cloud AK/SK (Knowledge Base only)
200
-
201
- Required for `knowledge retrieve`. Get your AccessKey from [RAM Console](https://ram.console.aliyun.com/manage/ak).
202
-
203
- ```bash
204
- export ALIBABA_CLOUD_ACCESS_KEY_ID=LTAI5t...
205
- export ALIBABA_CLOUD_ACCESS_KEY_SECRET=...
206
- export BAILIAN_WORKSPACE_ID=ws-...
207
- ```
208
-
209
- ## Configuration
210
-
211
- ```bash
212
- # View current config
213
- bl config show
214
-
215
- # Set defaults
216
- bl config set --key region --value us
217
- bl config set --key default_text_model --value qwen-turbo
218
- bl config set --key timeout --value 600
219
-
220
- # Export MCP-compatible JSON Schema for all commands
221
- bl config export-schema
222
-
223
- # Self-update to latest version
224
- bl update
225
- ```
226
-
227
- Config file location: `~/.bailian/config.json`
228
-
229
- ## Global Flags
230
-
231
- | Flag | Description |
232
- |:-----|:------------|
233
- | `--api-key <key>` | API key (overrides all other auth) |
234
- | `--region <region>` | API region: `cn` (default), `us`, `intl` |
235
- | `--output <format>` | Output format: `text`, `json` |
236
- | `--quiet` | Suppress non-essential output |
237
- | `--verbose` | Print HTTP request/response details |
238
- | `--dry-run` | Show what would happen without executing |
239
- | `--no-color` | Disable ANSI colors and spinners |
240
- | `--timeout <seconds>` | Request timeout (default: 300) |
241
- | `--non-interactive` | Disable interactive prompts (CI mode) |
242
-
243
- ## Project Structure
244
-
245
- ```
246
- src/
247
- ├── main.ts # CLI entry point
248
- ├── registry.ts # Command registry (30 commands)
249
- ├── args.ts # Argument parsing
250
- ├── command.ts # Command interface & global options
251
- ├── auth/ # Authentication (credentials, resolver, setup)
252
- ├── client/ # HTTP client (AK signing, endpoints, streaming)
253
- ├── commands/ # Command implementations
254
- │ ├── auth/ # login, status, logout
255
- │ ├── text/ # chat
256
- │ ├── omni/ # multimodal chat
257
- │ ├── image/ # generate, edit
258
- │ ├── video/ # generate, edit, task-get, download
259
- │ ├── vision/ # describe
260
- │ ├── speech/ # synthesize, recognize
261
- │ ├── file/ # upload
262
- │ ├── app/ # call
263
- │ ├── memory/ # add, search, list, update, delete, profile
264
- │ ├── knowledge/ # retrieve
265
- │ ├── search/ # web
266
- │ └── config/ # show, set, export-schema
267
- ├── config/ # Config loading & schema (Zod)
268
- ├── errors/ # Error handling hierarchy
269
- ├── output/ # Formatters (text, json, progress, status-bar)
270
- ├── polling/ # Async task polling
271
- ├── update/ # Self-update checker
272
- └── utils/ # Utilities (fs, token, env, prompt)
273
- ```
274
-
275
- ## Links
276
-
277
- | Resource | URL |
278
- |:---------|:----|
279
- | DashScope API Docs | https://help.aliyun.com/zh/model-studio/ |
280
- | Qwen Model List | https://help.aliyun.com/zh/model-studio/getting-started/models |
281
- | Bailian Console | https://bailian.console.aliyun.com/ |
282
- | Get API Key | https://bailian.console.aliyun.com/cn-beijing/?source_channel=aliway&tab=app#/api-key |
283
- | Get AccessKey | https://ram.console.aliyun.com/manage/ak |
284
-
285
- <div align="center">
286
-
287
- ---
288
-
289
- Made with `>_` by the Bailian team
290
-
291
- </div>