Skip to main content

An asynchronous Python client for the Puter API

Project description

PuterGenAI

PyPI version License: MIT

An asynchronous Python client for the Puter.com API, enabling easy integration with AI chat models.

Features

  • Asynchronous API client for Puter.com
  • Support for multiple AI models (GPT, Claude, etc.)
  • Streaming and non-streaming responses
  • Simple authentication via username/password
  • Configurable options: temperature, model selection, etc.

Installation

Install from PyPI:

pip install putergenai

Or install from source:

git clone https://github.com/Nerve11/putergenai.git
cd putergenai
pip install -e .

Quick Start

import asyncio
from putergenai import PuterClient

async def main():
    async with PuterClient() as client:
        await client.login('your_username', 'your_password')

        messages = [
            {'role': 'user', 'content': 'Hello!'}
        ]

        # Non-streaming response
        result = await client.ai_chat(messages=messages)
        print(result)

        # Streaming response
        async for content, model in await client.ai_chat(messages=messages, options={'stream': True}):
            print(content, end='')

asyncio.run(main())

Detailed Example

See examples/example.py for a complete interactive example with model selection, streaming options, and error handling.

Configuration Options

When calling ai_chat, you can pass options:

  • model: Specify the AI model (e.g., 'gpt-5', 'claude-4', etc.)
  • stream: Enable/disable streaming (boolean)
  • temperature: Adjust creativity/randomness (0.0-2.0)

Requirements

  • Python >= 3.11
  • Dependencies: aiohttp, aiofiles, certifi, pillow, customtkinter, cryptography, flask, keyring

Development

To set up for development:

pip install -e .[dev]

Run tests:

pytest

Lint code:

black src/
flake8 src/

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

Report bugs or request features at: https://github.com/Nerve11/putergenai/issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

putergenai-2.0.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

putergenai-2.0.1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file putergenai-2.0.1.tar.gz.

File metadata

  • Download URL: putergenai-2.0.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for putergenai-2.0.1.tar.gz
Algorithm Hash digest
SHA256 13fb93002e989cf8ca5bbb8f566272d98fd8a0cc9c9ddaccfb2334d40a423007
MD5 9e1492004d27c792e1a3f08606bbd3d0
BLAKE2b-256 dfb60eb8a21231770f5542a6956fd57446a66ebf88c08c230e8108a51119a3d4

See more details on using hashes here.

File details

Details for the file putergenai-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: putergenai-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for putergenai-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe21c55bd06dea6a46a31a96c495a9a4064fd047719e7e697cd52c52fab21253
MD5 95743a67787da7ffab48b783219cb6c6
BLAKE2b-256 39d5541b97e4b22ccd2a70d11eab95f9edff7ea6f27b9dbeefc52995f45ec000

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page