Skip to main content

Player2 for Python

A lightweight Python client designed to easily interact with Player2 Local Endpoints.

Installation

Install the package via pip:

pip install player2

Usage

1. Initialize the Client

When initializing the client, pass your game_id. It will automatically handle web login to fetch authorization keys and spin up a background health-check loop.

from player2 import APIClient

client = APIClient(game_id="your_game_id")  # Get the gameID from the player2 website

2. Chat Completions

Send user queries with optional system instructions:

response = client.chat(
    user="Hello, how are you doing today?",
    system="You are a helpful and witty assistant."
)

print(response)

3. Text-to-Speech (TTS)

Trigger speech generation locally:

tts_response = client.speak(
    text="Hello, how are you doing today?",
    instructions="Speak with a cheerful tone",
    speed=1.0
)

print(tts_response)

4. Speech-to-Text (STT)

Info This function is still untested and might not work, It's still W.I.P.

Trigger speech recording for 5 seconds and then stop.

from time import sleep # For this example, we will use time.sleep

client.start_stt()
sleep(5)
recording = client.stop_stt()

print(recording) # Returns the text in a JSON format.

Metadata

Release files for player2 0.0.2

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

Source distribution (sdist)

Source distribution for player2 0.0.2
File Size Uploaded Provenance
player2-0.0.2.tar.gz 4.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for player2 0.0.2
File Interpreter ABI Platform
player2-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / player2-0.0.2.tar.gz

Download URL player2-0.0.2.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4bcbb0bc118fb48ca0c5e625937934e5eebeb7f43ed5654335f5a7a3321a221f
BLAKE2b-256 checksum
How to use checksums
fe00ac767c785b944600a5c90c4f28ec50ca5d1e116163a53d57e5b7649f1714
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / player2-0.0.2-py3-none-any.whl

Download URL player2-0.0.2-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e98e0033fb64a2e9333e38ad421935305251690b7b488cd9a8f9b15c4fac7f8
BLAKE2b-256 checksum
How to use checksums
362d38c683c767e2fe757645ff6bca69d441f1ccfa6c85395ee01f5a1058044f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for player2 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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