Job to request bootloader unlock request programmatically at 00:00 Beijing time.
- Python 96.5%
- Shell 2.9%
- Dockerfile 0.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Start from the stock OS1.0.15 Global fastboot ROM: the flashable firmware zip skips some firmware partitions, which left the other slot with a black screen. Also note the macOS grep -P gap in flash_all.sh, mirror choice, and that HyperOS shows no unlock countdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
| .beads | ||
| .github | ||
| docker | ||
| mocktest | ||
| src/xiaomi_unlock | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .python-version | ||
| AGENTS.md | ||
| fire.sh | ||
| NEXT_STEPS.md | ||
| push-tokens.sh | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
Xiaomi Bootloader Unlock Request (AQLR)
Sends 4 parallel HTTP requests to Xiaomi's unlock API at exactly 00:00 Beijing time (UTC+8) with staggered timing offsets to beat the daily quota reset.
Based on the XDA AQLR method.
Setup
# Install deps (one-time)
uv sync
Get Tokens
You need 2 session tokens from 2 different browsers, both logged into the same Mi Account on Mi Community Global.
Run the interactive setup wizard:
uv run mi-unlock setup
Or manually create tokens.json:
{
"firefox": "<new_bbs_serviceToken from Firefox cookies>",
"chrome": "<popRunToken from Chrome cookies>"
}
Token 1: Firefox (new_bbs_serviceToken)
- Open Firefox → https://c.mi.com/global → Login
- Press F12 → Storage → Cookies →
c.mi.com - Find
new_bbs_serviceToken→ copy the Value
Token 2: Chrome (popRunToken)
- Open Chrome → https://c.mi.com/global → Login (same account)
- Press F12 → Application → Cookies →
https://c.mi.com - Find
popRunToken→ copy the Value
⚠️ Tokens expire — get fresh ones right before running the script each night.
Commands
Check eligibility
uv run mi-unlock status
Run the unlock request
uv run mi-unlock run
The script will:
- Check your account eligibility
- Sync time via NTP servers
- Count down to midnight Beijing time
- Fire 4 parallel requests at offsets: 1400, 900, 400, 100ms before midnight
- Retry in a tight loop for 30 seconds after midnight
Options for run
uv run mi-unlock run --dry-run # Test everything except the actual HTTP POST
uv run mi-unlock run --plain # Line-based output (no Rich Live display)
uv run mi-unlock run --token-file /path/to/tokens.json
Download (Pre-built Binaries)
No Python needed — download the binary for your platform from the Releases page.
| Platform | File |
|---|---|
| 🐧 Linux (x86_64) | mi-unlock-linux-x86_64 |
| 🍎 macOS (Apple Silicon / Intel via Rosetta) | mi-unlock-macos-arm64 |
| 🪟 Windows (x86_64) | mi-unlock-windows-x86_64.exe |
| 🤖 Android / Termux | mi-unlock-termux-android.whl |
Linux / macOS:
chmod +x mi-unlock-*
./mi-unlock-linux-x86_64 --help
Windows: double-click or run mi-unlock-windows-x86_64.exe --help in PowerShell.
Android / Termux:
pkg install python
pip install mi-unlock-termux-android.whl
mi-unlock --help
Development
# Run tests
uv run pytest
# Run with coverage
uv run pytest --cov=src/xiaomi_unlock
After Approval
Once the unlock request is approved:
- Sign out of Mi Account on your phone
- Restart the phone
- Sign in to Mi Account
- Go to Developer Options → Mi Unlock Status → Link Account
- Use Mi Unlock Tool on PC (72-hour waiting period applies)