mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
Merge pull request #71 from modelstudioai/feat/console-login-site
feat: Add default login site selection for agent
This commit is contained in:
@@ -147,8 +147,11 @@ More examples per command: see `reference/<group>.md` (e.g. [`reference/text.md`
|
||||
Install, API key / console login, endpoint override, and config keys:
|
||||
[`assets/setup.md`](assets/setup.md).
|
||||
|
||||
**Console login:** never run bare `bl auth login --console` — always pass `--console-site domestic` or `--console-site international`. Before login, run `bl config show --output json` and follow the site-selection rules in [`assets/setup.md` → Console site selection](assets/setup.md#console-site-selection).
|
||||
|
||||
```bash
|
||||
bl auth status # check current auth
|
||||
bl auth login --console --console-site international # example: international console
|
||||
bl text chat --message "Write a poem about spring" # quick smoke test
|
||||
```
|
||||
|
||||
@@ -197,3 +200,4 @@ Full workflow, redaction rules, template, and exit-code reference: [`assets/issu
|
||||
- Video understanding with audio context → `bl omni`, not only `bl vision describe`.
|
||||
- Search → `bl search web`.
|
||||
- Local paths → pass directly to `bl`; never require the user to obtain URLs first.
|
||||
- Console login → always `--console-site domestic|international`; see [`assets/setup.md`](assets/setup.md#console-site-selection).
|
||||
|
||||
@@ -21,10 +21,10 @@ Verify: `bl --version` (prints `bl X.Y.Z`).
|
||||
|
||||
## Authentication
|
||||
|
||||
| Auth | How | Used by |
|
||||
| ------------- | --------------------------------------------------------------------- | ---------------------------------------- |
|
||||
| API key | `export DASHSCOPE_API_KEY=sk-...` or `bl auth login --api-key sk-...` | Most DashScope API commands |
|
||||
| Console token | `bl auth login --console` | `app list`, `usage free`, `console call` |
|
||||
| Auth | How | Used by |
|
||||
| ------------- | ------------------------------------------------------------------------ | ---------------------------------------- |
|
||||
| API key | `export DASHSCOPE_API_KEY=sk-...` or `bl auth login --api-key sk-...` | Most DashScope API commands |
|
||||
| Console token | `bl auth login --console --console-site domestic` or `... international` | `app list`, `usage free`, `console call` |
|
||||
|
||||
```bash
|
||||
bl auth status # check current auth
|
||||
@@ -34,6 +34,45 @@ bl auth logout --console # clear console token only
|
||||
|
||||
Get an API key: https://bailian.console.aliyun.com/cn-beijing/?tab=app#/api-key
|
||||
|
||||
### Console site selection
|
||||
|
||||
Console login and console-gateway commands (`app list`, `usage *`, `quota *`, `workspace list`, `console call`) target one of two Bailian consoles:
|
||||
|
||||
| Site | Value | Login URL |
|
||||
| ----------------- | --------------- | ---------------------------------------------- |
|
||||
| Domestic (中国站) | `domestic` | `https://bailian.console.aliyun.com` |
|
||||
| International | `international` | `https://modelstudio.console.alibabacloud.com` |
|
||||
|
||||
**Do not run bare `bl auth login --console`** — the CLI defaults to `domestic`. Always pass `--console-site` explicitly (or rely on a saved `console_site` in config).
|
||||
|
||||
**Before console login**, run `bl config show --output json` and check `console_site`.
|
||||
|
||||
**How to choose the site** (first match wins):
|
||||
|
||||
1. **`console_site` in `~/.bailian/config.json`** — use it; no need to ask again.
|
||||
2. **User explicitly says** 国际站 / 全球站 / international / `modelstudio.console.alibabacloud.com` → `international`.
|
||||
3. **User explicitly says** 国内站 / 中国站 / domestic / `bailian.console.aliyun.com` → `domestic`.
|
||||
4. **Infer from DashScope endpoint** (`base_url` or `DASHSCOPE_BASE_URL` from `bl config show`):
|
||||
- `https://dashscope-intl.aliyuncs.com` → `international`
|
||||
- `https://dashscope.aliyuncs.com` or `https://dashscope-us.aliyuncs.com` → `domestic`
|
||||
5. **Still unclear** — ask the user which console they use; do not assume domestic.
|
||||
|
||||
```bash
|
||||
# Domestic
|
||||
bl auth login --console --console-site domestic
|
||||
|
||||
# International
|
||||
bl auth login --console --console-site international
|
||||
```
|
||||
|
||||
After a successful console login, the callback may persist `console_site` in `~/.bailian/config.json`. You can also set it manually:
|
||||
|
||||
```json
|
||||
{ "console_site": "international" }
|
||||
```
|
||||
|
||||
Use the same `--console-site` on console-gateway commands when it differs from the saved default, e.g. `bl app list --console-site international`.
|
||||
|
||||
---
|
||||
|
||||
## DashScope endpoint
|
||||
|
||||
Reference in New Issue
Block a user