Python SDK for
Multiplayer Games

Full coverage of players, rooms, matchmaking, leaderboards and realtime WebSocket rooms — with type hints, dataclass responses and typed errors.

pip Installable

A proper package with type hints, dataclass responses and full coverage of players, rooms, matchmaking and leaderboards.

Async Realtime

Native asyncio + websockets client for the realtime relay at wss://realtime.michitai.com.

Engine Friendly

Works with Pygame, Godot-Python, Panda3D and any backend or tool that can make HTTP requests.

Python SDK

Download

# Requires Python 3.9+ — install the dependencies, then run the example
pip install requests            # core SDK
pip install websockets          # optional, realtime rooms only

python Game.py
View on GitHub
Repository

The + Steam variant adds STEAM.md (ticket-minting guide — Steam needs a native binding or engine plugin). Valve's proprietary Steamworks SDK is a separate download from partner.steamgames.com.

Quick Start

from multiplayer import Client

client = Client("YOUR_API_TOKEN", "YOUR_PRIVATE_TOKEN")

# Register & authenticate a player
reg = client.players.register("PlayerOne", {"level": 1, "class": "mage"})
player_token = reg.private_key

# Or sign in via a Steam auth ticket (project must have Steam enabled):
# reg = client.players.register_steam(ticket_hex, "michitai")

# Create and join a room
room = client.rooms.create(player_token, "Lobby 1", max_players=4)
client.rooms.heartbeat(player_token)

# Fetch the leaderboard
lb = client.leaderboard.get(["level", "score"], limit=10)
for entry in lb.leaderboard:
    print(f"#{entry.rank} - {entry.player_name}")

Every response is a dataclass extending ApiResponse — check response.success, response.error, response.error_type (typed enum) and response.error_message.

Inside the Python package

The download is a real package, not a script: pyproject.toml declares michitai-multiplayer (import name multiplayer) so it installs with pip, and requests is the only hard dependency. The optional websockets extra unlocks the realtime lane — pip install michitai-multiplayer[realtime] pulls in the asyncio WebSocket client used by the Rooms/Realtime calls.

It targets Python 3.9+ and every call is a plain synchronous function — ideal for tooling, bots, backends and Pygame-family projects. In asyncio code or a frame-driven loop, wrap calls in asyncio.to_thread or a job pool so a slow request never blocks the loop; responses arrive as dataclasses so IDEs autocomplete fields like response.error_type.

  • Game.py: a runnable end-to-end session — register a player, create a room, read the leaderboard — mirroring the Quick Start above.
  • Type annotated: request parameters and response models are fully hinted, so editors catch misuse before runtime.
  • SDK + Steam: the Steam zip adds ticket helpers and STEAM.md (Steam needs a native binding or engine plugin for the ticket itself).
  • Runs anywhere: desktop, server or embedded — wherever Python 3.9+ and requests are installed.

SDK Documentation

Pick a topic — each area has its own page.