Skip to main content

chiaki-py

PS4/PS5 Remote Play from Python, built on chiaki-ng: discover consoles, pair, stream video and audio, and send controller input.

chiaki-py is pure Python. The native bindings around chiaki-ng live in chiaki-lib, which pip installs with it; the low-level classes (ChiakiPySession, Settings, the frame handlers, ...) are imported from chiaki_lib.

Install

pip install chiaki-py

Python 3.11–3.14. chiaki-lib has wheels for Windows, Ubuntu, macOS 15+ (Apple Silicon) and 64-bit Raspberry Pi OS; elsewhere, build it from source as its README describes.

On Linux, the Qt windows (StreamDisplay, PSNLoginQt) also need sudo apt install libxcb-cursor0.

On macOS, PySDL3's prebuilt SDL3_ttf links against Homebrew's libraries, so run brew install harfbuzz freetype. Without them, chiaki-py falls back to loading only the core SDL3 library, which is all controller input needs.

Quickstart

from chiaki_py import Session, discover_hosts, register_host, Serializer, AudioSink
from chiaki_py.psn import PSNLoginQt

host = discover_hosts(timeout=3.0)[0]
psn_account = PSNLoginQt.login()
registration = register_host(
    host=host.host_addr,
    psn_id=psn_account.user_rpid,  # or .online_id for a PS4
    pin="12345678",                # shown on the console's Link Device screen
    target=host.target,
)
Serializer.save(registration, "registration.json")  # reload later with Serializer.load(HostRegistration, path)

with Session(registration) as session:
    audio_sink = AudioSink(session)  # plays audio on the default output device
    for frame in session.frames(max_fps=60):
        ...  # frame is an (H, W, 3) uint8 numpy array

Registering without a PIN

auto_register_host() registers through PSN instead, like chiaki-ng's automatic registration: no PIN, and the console need not be on the same network. It must be signed in to the account, have Remote Play enabled, and be on or in rest mode with "Stay connected to the internet" on. For a PS4, only the account's primary console can be registered this way.

from chiaki_py import auto_register_host, find_host
from chiaki_py.psn import PSNLoginQt, fresh_access_token

psn_account = PSNLoginQt.login()
registration = auto_register_host(
    psn_token=fresh_access_token(psn_account),  # refreshes the token if it is about to expire
    psn_account_id=psn_account.user_rpid,
    console_name="PS5-123",                     # optional if the account has a single PS5; ps4=True for a PS4
)
registration.host = find_host(registration.nickname).host_addr  # PSN does not report the local address

list_psn_devices(token) lists the account's PS5s. PSN tokens expire after about an hour. fresh_access_token() refreshes them in place, so save the account again afterwards. Accounts saved before chiaki-py 0.1.1 have no tokens: log in again.

Frame handlers

The third argument to Session picks what session.frames() yields:

Handler Yields Notes
CpuFrameHandler (default) (H, W, 3) uint8 numpy array Works everywhere
CudaFrameHandler (H, W, 3) uint8 CuPy array on the GPU NVIDIA only; settings.set_hardware_decoder("cuda"). Pass out= to write into your own tensor (see CudaFrameHandler.empty_frame)
VulkanFrameHandler VulkanFrame with raw GPU handles (NV12/P010) Any hardware decoder; release frames promptly
from chiaki_lib import CudaFrameHandler

settings.set_hardware_decoder("cuda")
with Session(registration, CudaFrameHandler) as session:
    for frame in session.frames():
        ...

Logging

chiaki-py logs through Python's logging under chiaki_py.*, the native libraries under chiaki_lib (chiaki-ng), chiaki_lib.ffmpeg and chiaki_lib.placebo:

import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger("chiaki_lib.ffmpeg").setLevel(logging.CRITICAL)  # e.g. hide decoder errors

For noisy streams, filter at the source instead: settings.set_log_level(LogLevel.WARNING), and CHIAKI_PY_PLACEBO_LOG=warning for libplacebo.

Examples

Run from the repo root; the scripts share a ./cache directory for the PSN account and console registration.

Script What it does Extra packages
1.1_login.py PSN login, saved to cache/
1.2_discover_hosts.py List consoles on the network
1.3_register_console.py <host> <pin> [--ps4] Pair with a console
1.3.2_auto_register_console.py [name] [--ps4] Pair through PSN, without a PIN
1.4.1_stream_cpu_qt.py Stream in a Qt window (CPU)
1.4.2_stream_cuda_qt.py Same, via CUDA + OpenGL (NVIDIA) cupy-cuda12x cuda-python PyOpenGL
1.4.3_stream_vulkan_qt.py Same, via Vulkan + libplacebo, zero-copy (Windows, Linux X11; XWayland on Wayland)
2_whole_process_till_stream_opencv.py Discover, log in, pair and stream in one script opencv-python typer
3_simple_stream.py Minimal OpenCV viewer; good starting point opencv-python
4_stream_cuda_glfw.py CUDA stream in a GLFW window (NVIDIA) cupy-cuda12x glfw opencv-python typer
5_stream_tensor_opengl.py Frames as PyTorch GPU tensors, e.g. for YOLO (NVIDIA) CUDA PyTorch, glfw opencv-python typer

All examples also need pip install miniaudio.

Development

chiaki-py needs chiaki-lib, either from PyPI or built next to it (see chiaki-lib's README for the CMake build):

git clone https://github.com/Rothen/chiaki-lib
git clone https://github.com/Rothen/chiaki-py && cd chiaki-py
pip install -r requirements.txt   # installs ../chiaki-lib in editable mode
pip install -e .

Known limitations

  • settings.set_audio_volume() has no effect yet.
  • Rumble/haptics and microphone aren't forwarded yet.
  • PS4 pairing is far less tested than PS5.

License

AGPL-3.0-only (see LICENSE), like chiaki-lib, which statically links chiaki-ng's AGPL-3.0 C library.

Metadata

Release files for chiaki-py 0.3.4

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

Source distribution (sdist)

Source distribution for chiaki-py 0.3.4
File Size Uploaded Provenance Actions
chiaki_py-0.3.4.tar.gz 118.7 kB With provenance Details for chiaki_py-0.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chiaki-py 0.3.4
File Interpreter ABI Platform Actions
chiaki_py-0.3.4-py3-none-any.whl Python 3 none any Details for chiaki_py-0.3.4-py3-none-any.whl

Total release size: 227.4 kB

Release files / chiaki_py-0.3.4.tar.gz

Download URL chiaki_py-0.3.4.tar.gz
Size 118.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5e1acccf923277e83e9e882ae3cd59bba871bc541e1130758fb7aedf2ad28468
BLAKE2b-256 checksum
How to use checksums
8f6c5cccd178adfd2a5f51a5aedee522f3481725a5c187e73b088084174475c0
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 26, 2026.

Transparency log

Release files / chiaki_py-0.3.4-py3-none-any.whl

Download URL chiaki_py-0.3.4-py3-none-any.whl
Size 108.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07cf6e05e756d016978b56bc04852a7e7e2f3f0cd33d988fc130855a14773fab
BLAKE2b-256 checksum
How to use checksums
852a81ff5b94d05644a3f07aad1db053924aac0b96987709a20f7b2cd052b0ca
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 26, 2026.

Transparency log

Security for chiaki-py 0.3.4

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for chiaki_py-0.3.4.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 26, 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.

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files Full provenance

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