aiopikvm
Async Python client for the PiKVM API.
Installation
pip install aiopikvm
or with uv:
uv add aiopikvm
Quick start
import asyncio
from aiopikvm import PiKVM
async def main():
async with PiKVM("https://pikvm.local", user="admin", passwd="admin") as kvm:
# ATX power control
state = await kvm.atx.get_state()
if not state.leds.power:
await kvm.atx.power_on()
# HID — type text
await kvm.hid.type_text("Hello from aiopikvm!")
# Streamer — take a screenshot
snapshot = await kvm.streamer.snapshot()
with open("screen.jpeg", "wb") as f:
f.write(snapshot)
asyncio.run(main())
Features
API resources
| Resource | Description |
|---|---|
| ATX | Host power control (power on/off, reset, status LEDs) |
| HID | Keyboard and mouse input, text typing, keymaps |
| MSD | Virtual mass storage drives, image upload |
| GPIO | GPIO channel read/write control |
| Streamer | Video snapshots, OCR |
| Switch | Multi-port KVM switching, EDID management |
| Redfish | DMTF Redfish BMC compatibility interface |
| Prometheus | Metrics export in Prometheus format |
| System | Device info, service logs, realtime log streaming |
| WebSocket | Realtime events, keyboard/mouse input via WebSocket |
Highlights
- Full async/await API built on httpx
- Response models powered by Pydantic v2
- Custom exception hierarchy for precise error handling
- External
httpx.AsyncClientsupport for advanced use cases - TOTP two-factor authentication support
- WebSocket client for realtime events and low-latency HID input
- Fully typed (PEP 561, mypy strict)
Configuration
from aiopikvm import PiKVM
kvm = PiKVM(
"https://pikvm.local",
user="admin", # default: "admin"
passwd="secret",
totp="123456", # optional TOTP code
verify_ssl=False, # default: False (PiKVM uses self-signed certs)
timeout=10.0, # default timeout in seconds
)
External httpx client
import httpx
from aiopikvm import PiKVM
async with httpx.AsyncClient(verify=False) as http:
async with PiKVM("https://pikvm.local", http_client=http) as kvm:
state = await kvm.atx.get_state()
When an external client is provided, PiKVM does not close it on exit — the caller is responsible.
WebSocket
async with PiKVM("https://pikvm.local", user="admin", passwd="admin") as kvm:
async with kvm.ws() as ws:
# Send keyboard input
await ws.send_key("KeyA", state=True)
await ws.send_key("KeyA", state=False)
# Move mouse
await ws.send_mouse_move(100, 200)
# Iterate over realtime events
async for event in ws.events():
print(event)
Documentation
Full documentation is available at kudato.github.io/aiopikvm.
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
Release files for aiopikvm 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiopikvm-0.2.1.tar.gz | 93.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiopikvm-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 118.9 kB
Release files / aiopikvm-0.2.1.tar.gz
| Download URL | aiopikvm-0.2.1.tar.gz |
|---|---|
| Size | 93.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84003bc4660fb30b6b84095e720d3a06235bef0024b0a074ca14e7705936acdf
|
|
BLAKE2b-256 checksum How to use checksums |
55923580817f08a00a285b1e449ddbdeacdba8911d46c2ed02b5722ded86ab6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 5, 2026.
Transparency logRelease files / aiopikvm-0.2.1-py3-none-any.whl
| Download URL | aiopikvm-0.2.1-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5be99e6fe429b6350c4873760e631478f5219cb69fd83b8548ac77ad434a9476
|
|
BLAKE2b-256 checksum How to use checksums |
6e8045a51b279e4a9d94b993a290b72b1f7213f333f9e747026199e72a3ec28c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 5, 2026.
Transparency log