One Python Client instance per game carries your X-Api-Token and optional private key, builds endpoint URLs, serializes JSON and unwraps the success/error envelope — create it once at startup and reuse it for every call below.
Client(
api_token: str,
api_private_token: str,
base_url: str = "https://api.michitai.com/api",
logger: Logger | None = None,
timeout: float = 30.0,
session: requests.Session | None = None,
)
Initializes the SDK with API tokens. Services are exposed as client.players, client.rooms, client.actions, client.updates, client.matchmaking, client.matchmaking_requests, client.leaderboard, client.games and client.time.
One client instance carries your game's credentials and connection settings — the public X-Api-Token, the secret X-Api-Private-Token where admin calls are needed, plus the API base URL, timeouts and JSON plumbing. Construct it once at startup and share it for the process lifetime: every facade on this page borrows that configuration, so creating a client per request only re-pays connection setup.
Two credential tiers ride on the same client. Player-facing calls present the X-Game-Player-Token issued at registration; administrative calls — bans, data writes, player lists — authenticate with the token pair alone. Credentials travel in headers only, never in URLs, so they cannot leak through access logs or referrers.