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.1

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.1
File Size Uploaded Provenance Actions
openbyd-0.1.1.tar.gz 966.9 kB With provenance Details for openbyd-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for openbyd 0.1.1
File Actions
openbyd-0.1.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for openbyd-0.1.1-cp311-abi3-win_amd64.whl
openbyd-0.1.1-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for openbyd-0.1.1-cp311-abi3-musllinux_1_2_x86_64.whl
openbyd-0.1.1-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for openbyd-0.1.1-cp311-abi3-musllinux_1_2_aarch64.whl
openbyd-0.1.1-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for openbyd-0.1.1-cp311-abi3-manylinux_2_28_aarch64.whl
openbyd-0.1.1-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.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
openbyd-0.1.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for openbyd-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
openbyd-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for openbyd-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 29.8 MB

Release files / openbyd-0.1.1.tar.gz

Download URL openbyd-0.1.1.tar.gz
Size 966.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cfc20d8f5e22b68e94698e58d63c2273a1fc6e734c91aa8c7ca402185f206ede
BLAKE2b-256 checksum
How to use checksums
a1e0468276886303e1fcab7e432f34883fc97a6c10f1778a143d60f883aa8a40
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 19, 2026.

Transparency log

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

Download URL openbyd-0.1.1-cp311-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a7446e367493a7714aa70351465a4105be0d966971e126e68051d46d8caabf9f
BLAKE2b-256 checksum
How to use checksums
c0691c82fdd85a9a4fa9f56b04d187b3cf2de13bf68b5629a4f862f909940037
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 19, 2026.

Transparency log

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

Download URL openbyd-0.1.1-cp311-abi3-musllinux_1_2_x86_64.whl
Size 4.4 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
89a617b37d59a08a51726becbc565be87af64200b16ea5739051fe577bd8b7f6
BLAKE2b-256 checksum
How to use checksums
fe64fe0a8a7c2ee6f0a9134e938cb4a26a4f7d050aa119e693cabb1523219a0e
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 19, 2026.

Transparency log

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

Download URL openbyd-0.1.1-cp311-abi3-musllinux_1_2_aarch64.whl
Size 4.2 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
b5f3735569134f1b4b43bebebf3f313772eeb7bd075eadfa3a21e5f2539a3469
BLAKE2b-256 checksum
How to use checksums
4fa86e6b8a8b8da92747d4d563a0aaa68784161c09fa93ebc0c08048a3ee6386
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 19, 2026.

Transparency log

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

Download URL openbyd-0.1.1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 4.0 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
e3d95142935bf2a6285736746d4efec3e8a38311185200669f94e393d4ae9476
BLAKE2b-256 checksum
How to use checksums
1c899187008d8dd245f2385f33f8494ff79164593d75f53ca93e8db10b5b687d
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 19, 2026.

Transparency log

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

Download URL openbyd-0.1.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
427adb51f99c5c48de421426bae6c3a666dd2d50c2e571c72c440471a3122760
BLAKE2b-256 checksum
How to use checksums
1aad2d2a944abaab343c7434e3d061ac1c31f5153869e419463d46bcfcb8f749
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 19, 2026.

Transparency log

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

Download URL openbyd-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8720552bb1b82cc52dd632e167f1fefb2da5801dea43d386eccee9b35fc12e85
BLAKE2b-256 checksum
How to use checksums
890ead9dca53035793b840ff0bf2ccb94c03727fe3395c8b03463ea6bfc133eb
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 19, 2026.

Transparency log

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

Download URL openbyd-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 4.0 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4b922f9f2d0db6f2759ec8f6db886c6e9a3fea5fcadcfed4728dba604e201b75
BLAKE2b-256 checksum
How to use checksums
8cc3395508b1177b75561f2ccb5abe291f1a8abf7dde71dc616e2f31bb1c649c
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 19, 2026.

Transparency log

Security for openbyd 0.1.1

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.1.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 19, 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