Job to request bootloader unlock request programmatically at 00:00 Beijing time.
  • Python 96.5%
  • Shell 2.9%
  • Dockerfile 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
hectorviov 7052da6f71 NEXT_STEPS: record what worked for PixelOS on pipa
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>
2026-10-27 18:25:59 -06:00
.beads chore: sync pyproject.toml and uv.lock 2026-02-22 23:21:14 +07:00
.github ci: use git log for changelog instead of GH generate-notes API (direct push workflow) 2026-02-22 01:12:17 +07:00
docker Pre-warm connections, retry early quota replies, add Docker runner 2026-10-25 15:33:40 -06:00
mocktest Add mocktest: mock Xiaomi API and timing client 2026-10-26 10:45:14 -06:00
src/xiaomi_unlock Send 30 requests 5 ms apart, first arriving 20 ms before midnight 2026-10-26 10:32:04 -06:00
tests Send 30 requests 5 ms apart, first arriving 20 ms before midnight 2026-10-26 10:32:04 -06:00
.gitattributes feat: AQLR bootloader unlock script — 4 parallel requests at midnight Beijing time 2026-02-21 23:29:40 +07:00
.gitignore chore: keep .beads/ on main, ignore binary/runtime files, set sync-branch 2026-02-22 00:16:59 +07:00
.python-version feat: AQLR bootloader unlock script — 4 parallel requests at midnight Beijing time 2026-02-21 23:29:40 +07:00
AGENTS.md docs: add calver release guide to AGENTS.md and binary download section to README 2026-02-22 01:02:59 +07:00
fire.sh Add Mac helper scripts: fire.sh and push-tokens.sh 2026-10-25 15:43:37 -06:00
NEXT_STEPS.md NEXT_STEPS: record what worked for PixelOS on pipa 2026-10-27 18:25:59 -06:00
push-tokens.sh Add Mac helper scripts: fire.sh and push-tokens.sh 2026-10-25 15:43:37 -06:00
pyproject.toml chore: sync pyproject.toml and uv.lock 2026-02-22 23:21:14 +07:00
README.md ci: drop macos-13 (unsupported), use arm64 binary for all Macs via Rosetta 2026-02-22 01:05:43 +07:00
uv.lock chore: sync pyproject.toml and uv.lock 2026-02-22 23:21:14 +07:00

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)

  1. Open Firefox → https://c.mi.com/global → Login
  2. Press F12 → Storage → Cookies → c.mi.com
  3. Find new_bbs_serviceToken → copy the Value

Token 2: Chrome (popRunToken)

  1. Open Chrome → https://c.mi.com/global → Login (same account)
  2. Press F12 → Application → Cookies → https://c.mi.com
  3. 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:

  1. Check your account eligibility
  2. Sync time via NTP servers
  3. Count down to midnight Beijing time
  4. Fire 4 parallel requests at offsets: 1400, 900, 400, 100ms before midnight
  5. 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:

  1. Sign out of Mi Account on your phone
  2. Restart the phone
  3. Sign in to Mi Account
  4. Go to Developer Options → Mi Unlock Status → Link Account
  5. Use Mi Unlock Tool on PC (72-hour waiting period applies)