Skip to main content

openbyd

An unofficial client for the BYD overseas app API, written in Rust, with bindings for Python, TypeScript, Java and Kotlin, and C#.

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 (fetched from the repository in parity/UPSTREAM_REPO, which is a fork while openbyd carries ports of pull requests pyBYD has not merged yet).

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
TypeScript, Java and Kotlin, C# packages bindings/ The same client and car, typed: the types are generated from pyBYD's own models and every recorded pyBYD model dump is checked against them. On npm (openbyd), Maven Central (io.github.pho3nix90:openbyd) and NuGet (OpenByd)
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);
}

Use it from TypeScript, Java, Kotlin or C#

These three packages share one layer over the Rust client and a typed layer generated for each language (how). Methods are pyBYD's in the language's own case, results are pyBYD's models, and errors are pyBYD's exception classes.

TypeScript or JavaScript (bindings/node):

import { Client } from "openbyd";

const client = new Client({ username: "you@example.com", password: "..." });
await client.login();
for (const vehicle of await client.getVehicles()) {
  const realtime = await client.getVehicleRealtime(vehicle.vin);
  console.log(vehicle.vin, realtime.elec_percent);
}
client.close();

Java or Kotlin (bindings/jvm):

try (Client client = new Client(new BydConfig("you@example.com", "..."))) {
    client.login().get();
    for (Vehicle vehicle : client.getVehicles().get()) {
        VehicleRealtimeData realtime = client.getVehicleRealtime(vehicle.vin()).get();
        System.out.println(vehicle.vin() + " " + realtime.elecPercent());
    }
}

C# (bindings/dotnet):

using var client = new Client(new BydConfig { Username = "you@example.com", Password = "..." });
await client.LoginAsync();
foreach (var vehicle in await client.GetVehiclesAsync())
{
    var realtime = await client.GetVehicleRealtimeAsync(vehicle.Vin);
    Console.WriteLine($"{vehicle.Vin} {realtime.ElecPercent}");
}

Speed up pyBYD today

pyBYD encrypts every request and decrypts every reply with a table-driven cipher written in Python. Up to pyBYD 0.0.85 a 2 KB request and reply cost it about 130 ms of CPU, during which the event loop is blocked. Later versions fold the cipher's tables when they load, which brings that down to a millisecond or two. 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+$(cat parity/UPSTREAM_REPO)@$(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.3

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.3
File Size Uploaded Provenance Actions
openbyd-0.1.3.tar.gz 1.1 MB With provenance Details for openbyd-0.1.3.tar.gz

Built distributions (wheels)

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

Total release size: 36.1 MB

Release files / openbyd-0.1.3.tar.gz

Download URL openbyd-0.1.3.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
25efdd4d81c0ba02a5e72a8bcc2cb77dfdd76bd549d397661db26890acccb78a
BLAKE2b-256 checksum
How to use checksums
526469afc5bc26e093ddbc3e52e2f021bccc689622f9452d8c23225c6b4b2540
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.3-cp311-abi3-win_amd64.whl

Download URL openbyd-0.1.3-cp311-abi3-win_amd64.whl
Size 5.4 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
068d30c07919d2be285be43975a4bfab319f0fb96d02ddf59c13de4ca9c78624
BLAKE2b-256 checksum
How to use checksums
d3121a462dd01b3cc799f441d7610ca814eaf9b038de481de769f339d31c1b7d
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.3-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL openbyd-0.1.3-cp311-abi3-musllinux_1_2_x86_64.whl
Size 5.3 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
2ebbabcd6776123abf5f4f1f3d3bd24c3ee7649d88ec7b283825fe012bd6fb96
BLAKE2b-256 checksum
How to use checksums
3392ef6c98e992f3425377b4bdf7495e5ffbed6b04e5c1838c353d46a8673de5
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.3-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL openbyd-0.1.3-cp311-abi3-musllinux_1_2_aarch64.whl
Size 5.0 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
df53531916b652cce4f70f4acb9d23e236b147433359d614789068721cdacf4d
BLAKE2b-256 checksum
How to use checksums
dcc117a0cb360d7e0a75edd6312368ea229b12348380e47d10b1549222132935
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.3-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL openbyd-0.1.3-cp311-abi3-manylinux_2_28_aarch64.whl
Size 4.8 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7d3dcee829c378522ae561b0e797a0d551983ffd45ede95afc3a8179c992743c
BLAKE2b-256 checksum
How to use checksums
564d641d134ce98e14d3cecfba1e82a73216c982cf3d0b7024c190107feed682
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.3-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL openbyd-0.1.3-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
6e26d249c798ab292a857fa3ebf8b7f91ca816cc838f6ff700726a3e74d9b149
BLAKE2b-256 checksum
How to use checksums
c37a23dea10e7a57f5e3a83514162aace632dc4802cbff2a72038f7675dde707
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.3-cp311-abi3-macosx_11_0_arm64.whl

Download URL openbyd-0.1.3-cp311-abi3-macosx_11_0_arm64.whl
Size 4.7 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6162ab611ed3a0ce5679843141f5b2f5fef52b8ca42163551ee919606ad5f73b
BLAKE2b-256 checksum
How to use checksums
c0bd22d516f9c317960c844c8583e819c20913a0bf43a501670a4e0700d29344
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.3-cp311-abi3-macosx_10_12_x86_64.whl

Download URL openbyd-0.1.3-cp311-abi3-macosx_10_12_x86_64.whl
Size 4.8 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d974531f722abbdc69148f3d3eace3f658efee54332749f601604338f5751d60
BLAKE2b-256 checksum
How to use checksums
c3f32bfdad2a18f94cbb6c6f8440850d625b2c64bafc66d75f38f4732a6d1c2d
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.3

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