Skip to main content

openbyd

An unofficial client for the BYD overseas app API, written in Rust, with Python bindings.

openbyd is a port of pyBYD. pyBYD stays the reference: every piece ported here is tested against it, and the pyBYD commit openbyd currently matches is recorded in parity/UPSTREAM_COMMIT.

This project is not affiliated with, endorsed by or supported by BYD.

Status

All of pyBYD is ported and compared with pyBYD in the tests. It has not yet been run against BYD's live service, so treat it as pre-release, above all for commands that act on a car.

Part Crate or module State
Envelope cipher openbyd-crypto Matches pyBYD byte for byte
Signing, envelopes, reply models, error codes, command gating, state engine openbyd-protocol Ported; compared with pyBYD on recorded and random inputs
Async client: sessions, reads, commands, MQTT, the car layer openbyd-client Ported; every request sequence compared with pyBYD's against a script, plus tests over real sockets with a fake server and broker
Python package openbyd openbyd.Client and openbyd.Car with pyBYD's method names, returning plain dicts
Command-line tool openbyd-cli openbyd login, vehicles, dump, get, watch, command (usage)
Drop-in speed-up for pyBYD openbyd.pybyd_accel See below

An audit in the test suite fails if pyBYD has a public model, function, client method or car method that openbyd does not compare against. How openbyd and pyBYD compare on speed and memory is measured in bench.

Use it from Python

import asyncio
import openbyd

async def main():
    async with openbyd.Client(username="you@example.com", password="...") as client:
        await client.login()
        for vehicle in await client.get_vehicles():
            realtime = await client.get_vehicle_realtime(vehicle["vin"])
            print(vehicle["vin"], realtime["elec_percent"])

asyncio.run(main())

Methods and arguments are pyBYD's. Results are plain dicts shaped like pyBYD's model_dump(mode="json"), and errors are raised as pyBYD's exception classes (openbyd.BydApiError and its subclasses, with code and endpoint).

Use it from Rust

use openbyd_client::{client::BydClient, http::HttpPool};
use openbyd_protocol::config::BydConfig;

let pool = HttpPool::new(); // one per process, shared by every client
let client = BydClient::connect(BydConfig::new("you@example.com", "..."), &pool);
client.login().await?;
for vehicle in client.get_vehicles().await? {
    let realtime = client.get_vehicle_realtime(&vehicle.vin, Default::default()).await?;
    println!("{} {:?}", vehicle.vin, realtime.elec_percent);
}

Speed up pyBYD today

pyBYD encrypts every request and decrypts every reply with a table-driven cipher written in Python. A 2 KB request and reply cost it about 130 ms of CPU, during which the event loop is blocked. openbyd does the same work in under half a millisecond and releases the GIL while it runs.

from openbyd import pybyd_accel

pybyd_accel.install()  # call once, before creating a BydClient

install() returns True when pyBYD is using the Rust cipher. It first checks that pyBYD's tables are the ones built into openbyd and that both ciphers give the same answer on a self-test. If either check fails it changes nothing and returns False. A client given its own table file keeps using pyBYD's code.

Use the cipher directly

Python:

import openbyd

envelope = openbyd.encode_envelope('{"hello":"world"}')
plaintext = openbyd.decode_envelope(envelope)

Rust:

let envelope = openbyd_crypto::encode_envelope(br#"{"hello":"world"}"#);
let plaintext = openbyd_crypto::decode_envelope(&envelope)?;

Build from source

You need a Rust toolchain and Python 3.11 or newer.

python -m venv .venv
.venv/bin/pip install maturin pytest
.venv/bin/maturin develop --release

Tests

cargo test -p openbyd-crypto   # Rust, against vectors recorded from pyBYD
pytest                         # Python bindings, same vectors

With pyBYD installed, pytest also compares openbyd against it on random inputs, and checks that the recorded vectors are still what pyBYD produces:

pip install "pybyd @ git+https://github.com/jkaberg/pyBYD@$(cat parity/UPSTREAM_COMMIT)"
pytest

To follow upstream, change parity/UPSTREAM_COMMIT, reinstall pyBYD, and run python parity/gen_bangcle_vectors.py. Any test that then fails marks behaviour that changed upstream.

Credits

  • pyBYD by Joel Kåberg and contributors, which this project ports.
  • Niek/BYD-re, the reverse-engineering work pyBYD builds on.

Licence

MIT. See LICENSE.

Metadata

Release files for openbyd 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openbyd 0.1.2
File Size Uploaded Provenance Actions
openbyd-0.1.2.tar.gz 1.0 MB With provenance Details for openbyd-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for openbyd 0.1.2
File Actions
openbyd-0.1.2-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for openbyd-0.1.2-cp311-abi3-win_amd64.whl
openbyd-0.1.2-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for openbyd-0.1.2-cp311-abi3-musllinux_1_2_x86_64.whl
openbyd-0.1.2-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for openbyd-0.1.2-cp311-abi3-musllinux_1_2_aarch64.whl
openbyd-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for openbyd-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl
openbyd-0.1.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for openbyd-0.1.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
openbyd-0.1.2-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for openbyd-0.1.2-cp311-abi3-macosx_11_0_arm64.whl
openbyd-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for openbyd-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 33.3 MB

Release files / openbyd-0.1.2.tar.gz

Download URL openbyd-0.1.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
6f620edbca66ab0387b8b96354bf38f90976d0a3fa20cd6bd5a2e164b8fbc474
BLAKE2b-256 checksum
How to use checksums
e33e1832b1c11054c36d07420ca0ea4f0308eefb40dd88ea5120aec4b5971495
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / openbyd-0.1.2-cp311-abi3-win_amd64.whl

Download URL openbyd-0.1.2-cp311-abi3-win_amd64.whl
Size 4.9 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
28e8d7d8340774dadab296e70ab0ec9ae3d7bcd75f0f82265ce4b46505ad3ca8
BLAKE2b-256 checksum
How to use checksums
e2455859277bc0a229fd9bce6326ca28287acf25731fc9a24c67aa6ec043ae53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / openbyd-0.1.2-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL openbyd-0.1.2-cp311-abi3-musllinux_1_2_x86_64.whl
Size 4.9 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
8a5624ba3eb33b86043489084e2308a773887917a678a480c4c788cf778c36ef
BLAKE2b-256 checksum
How to use checksums
def535ae417af6097c2b9b6ece427fd59d9d9fd86d1a0e2d7956897ba651c2c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / openbyd-0.1.2-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL openbyd-0.1.2-cp311-abi3-musllinux_1_2_aarch64.whl
Size 4.7 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
5aa910b791a93cfdca05a4e4ae7258be79c044ab99eb64996816ad0f38388625
BLAKE2b-256 checksum
How to use checksums
57a20943fb4559c273c2368bb1534e05beebd0bb7886f95388fbdfa3a0209c0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / openbyd-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL openbyd-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl
Size 4.5 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
bbd16f316ef292e6dcb56642276414f3eaa45964c068a701fd98edf215872f47
BLAKE2b-256 checksum
How to use checksums
03c207947827f46fa2a50dc9a01b64a424670d1544de6d17fddbdac99c04abdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / openbyd-0.1.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL openbyd-0.1.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f6930b03844a3ffd01827a31d35e7eabc7e2492328f9a3b3106d44e2cc823e23
BLAKE2b-256 checksum
How to use checksums
267d69de6599f20842fbb4ba15c4b60373ab4088ab71a228f94c7862f68a9b25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / openbyd-0.1.2-cp311-abi3-macosx_11_0_arm64.whl

Download URL openbyd-0.1.2-cp311-abi3-macosx_11_0_arm64.whl
Size 4.3 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
659faf7508e16dd0bc74f43ce41af6d6ef9586f1a40a25479c9e1ed6755b6b47
BLAKE2b-256 checksum
How to use checksums
4d2052be792e4abb84d93307945f753e9aef42375bfe205bbf0c422d87969cfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / openbyd-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl

Download URL openbyd-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl
Size 4.5 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ef5fa975de2457a06d6b1612802bd50e104fdbff52a6e8452dd59035b97905ab
BLAKE2b-256 checksum
How to use checksums
5ae21422abc6fc7abcf631edf056a294760a1178207307215fdd5adfb7a1d3d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for openbyd 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for openbyd-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page