---
title: Use an Alibaba Cloud Bailian Token Plan
nav: Alibaba Bailian
summary: Run Agent J in mainland China on an Alibaba Cloud Bailian Token Plan (Qwen): paste the key into the phone key card and it is checked at once, use OpenCode or Alibaba's own Qwen Code; the default Qwen 3.8 Max reads screenshots. Read the data terms before you buy.
order: 42
---
# Use an Alibaba Cloud Bailian Token Plan

Alibaba Cloud Bailian (Model Studio) is Alibaba Cloud's model platform. Its Token Plan, personal edition, is a monthly plan for coding tools: mostly Qwen, plus models from Zhipu GLM and DeepSeek.

Not sure which vendor to pick? Start at [Choose by your model](/docs/models/). Installing and pairing your phone are the same for every vendor: see [Install](/docs/install/) and [Using it on your phone](/docs/phone/).

## Who it is for {#who}

- Mainland China and already a Bailian user: use it.
- You want Alibaba's own Qwen Code, or want to know the moment you paste the key whether it works: pick this one.
- Nothing bought yet and you just want the easiest start: we recommend [Volcano Ark](/docs/ark/) first.
- Hong Kong or abroad: Alibaba's international site only sells a Coding Plan Pro with a daily allocation, and Agent J has no one-step setup for it yet. Abroad we suggest [Kimi](/docs/kimi/).

## Sign up and pick a plan {#plan}

1. With an identity-verified Alibaba Cloud account, open the Bailian subscription page https://bailian.console.aliyun.com/cn-beijing/subscription/overview .
2. Subscribe to **Token Plan (personal)**. It has four tiers, Lite, Essential, Standard and Pro, metered in Credits: 11,500, 25,500, 45,000 and 180,000 Credits a month. For one Agent, Lite or Essential is enough; to run 3 to 4 Agents at once, start at Standard.

The subscription page is authoritative for prices: it lists the monthly price of all four plans, and `agentj provider bailian` prints the prices we checked on 2026-10-15. Official guide: [Token Plan personal quick start](https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start).

**Read these terms before you buy:**

- Only you, working interactively in a coding tool. No automation scripts, app back ends or batch calls, or the plan or key may be suspended.
- **While you subscribe, what you send the model and what it answers are used by Alibaba Cloud to improve its models.** Be careful with private material.
- For the subscriber only; no sharing.

## Get the key {#key}

1. In the Bailian console, create the plan's own API key.
2. **Do not copy it to anyone yet.** Wait for the key card on your phone and paste it there.

## Hand the key to Agent J {#hand-over}

Tell the Agent on your computer: connect my Alibaba Bailian Token Plan. It will:

1. Run this to add Bailian to OpenCode's settings. Nothing you already set is changed.

```bash
agentj provider bailian
```

2. Run the key card command it prints. A key card named `BAILIAN_TOKEN_PLAN_API_KEY` opens on your phone; paste the key there and nowhere else. Agent J checks it right away against Bailian's read-only model list, without using Credits.
3. Restart the background service, then switch to Qwen 3.8 Max:

```bash
agentj service restart
```

```bash
agentj agent switch opencode --model bailian-token-plan-personal/qwen3.8-max
```

How the key card works: [Admin rights and API keys, from your phone](/docs/phone-admin/).

## AI coding tools {#tools}

Both work with the same key:

- **OpenCode (the default)**: the steps above. OpenCode not installed yet? See [Set up AI command-line tools](/docs/setup-agents/#opencode).
- **Qwen Code (Alibaba's own `qwen`, Apache-2.0)**: version 0.25 or newer; installing it needs Node.js 20 or newer, see [Qwen Code](/docs/setup-agents/#qwen). Its free sign-in ended on 2026-04-15, so the key is its login: the same `BAILIAN_TOKEN_PLAN_API_KEY` key card. Then switch:

```bash
agentj agent switch qwen
```

Agent J hands the key to Qwen Code in memory only and writes nothing into your Qwen settings; if you set Qwen Code up yourself, your settings win. Qwen Code runs in independent sessions only, and every permission request goes to your phone. More: [Switch to Qwen Code](/docs/switch-harness/#qwen).

## Models and screenshots {#models}

| Use | Model | Reads screenshots |
|---|---|---|
| Default | `qwen3.8-max` | Yes (tested) |
| Saves Credits | `qwen3.8-flash` | Yes (tested) |
| Also read images | `qwen3.7-plus`, `qwen3.6-flash` | Yes |
| Not as the default | `qwen3.7-max` | No (tested) |
| Text only | `glm-5.3`, `deepseek-v4-pro` | No |

In OpenCode, models are written `bailian-token-plan-personal/<model>`. Tested means: on 2026-10-16 we sent a software screenshot and asked for the dialog title, the error code, the button text and an amount in a table; in OpenCode and in Qwen Code it got all of them right. With Qwen Code, `/model` on your phone lists the plan's models and marks the ones that read images.

With a text-only model, a screenshot from your phone or a page the browser automation needs to look at never reaches the model. Switch back to `qwen3.8-max`.

## Common problems {#pitfalls}

- **The key card check fails**: the key was not copied whole, or it is not the plan's own key. Copy it again in full from the console and open the key card again.
- **Screenshots stopped working after picking `qwen3.7-max`**: it is text only; switch back to `qwen3.8-max`.
- **You have the older Coding Plan (keys starting with `sk-sp-`)**: it works too; ask the Agent to run `agentj provider bailian --plan coding-plan`. It has no Max model, and its key cannot be checked in advance.
- **Scheduled tasks, support bots**: the terms allow only you, working interactively. Unattended work needs a pay-as-you-go key; Agent J never hands the Token Plan key to them.

## Switch back {#switch-back}

Tell the Agent at any time: switch back to Claude Code (or Codex). It checks first and switches only if that works. Or run it on the computer yourself:

```bash
agentj agent switch claude
```

To go straight back to the tool you used before the last switch:

```bash
agentj agent switch --undo
```

Details: [Switch AI coding tool](/docs/switch-harness/).

<details>
<summary>Technical details: addresses and names</summary>

- In OpenCode the provider is `bailian-token-plan-personal`.
- Model list used for the read-only check: `https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/models`; the OpenAI-compatible address Qwen Code uses: `https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1`.
- Key variable: `BAILIAN_TOKEN_PLAN_API_KEY`; the older Coding Plan uses `BAILIAN_CODING_PLAN_API_KEY`.

</details>
