PutergenAI
Asynchronous Python SDK for Puter.com API — an open-source cloud platform with AI capabilities, file storage, and privacy-first design.
Features
- 200+ AI Models: GPT, Claude, Gemini, Mistral, Grok, DeepSeek, and more
- File System: Cloud storage operations (read/write/delete/copy/move/mkdir/readdir/stat/space/upload)
- Key-Value Store: Full KV API (set/get/list + add/incr/decr/update/remove/expire/flush)
- Image Generation: Text-to-image with multiple providers
- OCR: Extract text from images
- Text-to-Speech: Convert text to MP3 audio
- Driver Calls: Low-level
drivers.call()equivalent for unsupported endpoints - Streaming Support: Real-time chat completions
- Async/Await: Modern Python async architecture
Quick Start
Install the package:
pip install putergenai
Basic usage:
import asyncio
from putergenai import PuterClient
async def main():
async with PuterClient() as client:
await client.login("your_username", "your_password")
result = await client.ai_chat(
prompt="Hello, how are you?",
options={"model": "gpt-4o"}
)
print(result["response"]["result"]["message"]["content"])
asyncio.run(main())
CLI Usage
PuterGenAI now includes a command-line interface!
# Login
puter login
# Chat
puter chat --model gpt-4o
# List Models
puter models
# KV Store Operations
puter kv set mykey "hello world"
puter kv get mykey
Documentation
- Installation Guide — Setup instructions and dependencies
- API Reference — Complete method documentation
Examples
Streaming Chat
async def stream_example():
async with PuterClient() as client:
await client.login("username", "password")
stream = await client.ai_chat(
prompt="Tell me a story",
options={"model": "claude-opus-4.5", "stream": True}
)
async for chunk, model in stream:
print(chunk, end='', flush=True)
asyncio.run(stream_example())
File Operations
async def file_example():
async with PuterClient() as client:
await client.login("username", "password")
await client.fs_write("test.txt", "Hello, Puter!")
content = await client.fs_read("test.txt")
print(content.decode('utf-8'))
await client.fs_delete("test.txt")
asyncio.run(file_example())
Key-Value Store
async def kv_example():
async with PuterClient() as client:
await client.login("username", "password")
await client.kv_set("my_key", "my_value")
value = await client.kv_get("my_key")
print(value)
asyncio.run(kv_example())
Vision (Image Analysis)
messages = [{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
]
}]
result = await client.ai_chat(messages=messages, options={"model": "gpt-4o"})
Image Generation
image_url = await client.ai_txt2img(
"A beautiful sunset over mountains",
model="pollinations-image"
)
print(image_url)
OCR (Image to Text)
text = await client.ai_img2txt("https://example.com/image.png")
print(text)
Text-to-Speech
audio_bytes = await client.ai_txt2speech("Hello, world!")
with open("output.mp3", "wb") as f:
f.write(audio_bytes)
GUI Application
Try the interactive GUI built with CustomTkinter:
python examples/example-ui.py
Features:
- Secure login with encrypted credentials
- Multi-model chat interface
- Image generation with 4 free APIs
- Async operations (non-blocking UI)
- API key management via system keychain
Supported Models
The SDK supports models from multiple providers:
| Provider | Examples |
|---|---|
| OpenAI | GPT-5, GPT-4o, o3 series |
| Anthropic | Claude Opus, Sonnet, Haiku |
| Gemini Pro, Flash | |
| Mistral | Large, Medium, Small |
| xAI | Grok series |
| DeepSeek | Chat, Reasoner |
| TogetherAI | Various LLMs |
| OpenRouter | 100+ models |
For the complete list, see the API Reference.
Security
- Encrypted Storage: API keys stored via system keychain or Fernet encryption
- No Plain-Text Credentials: Session tokens instead of passwords
- SSL/TLS: All connections secured by default
- Input Validation: Sanitized user inputs
See SECURITY.md for reporting vulnerabilities.
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/xyz) - Commit your changes
- Add tests for new functionality
- Submit a pull request
Run tests:
python -m unittest discover tests
License
MIT License — see LICENSE for details.
Links
- PyPI: pypi.org/project/putergenai
- GitHub: github.com/Nerve11/putergenai
- Puter Platform: puter.com
Maintainers: Nerve11 • KernFerm
Version: 3.0.0 • Built with ❤️ for the Puter.com platform
Metadata
Release files for putergenai 3.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| putergenai-3.5.0.tar.gz | 38.4 kB | Without provenance | Details for putergenai-3.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| putergenai-3.5.0-py3-none-any.whl | Python 3 | none | any | Details for putergenai-3.5.0-py3-none-any.whl |
Total release size: 61.3 kB
Release files / putergenai-3.5.0.tar.gz
| Download URL | putergenai-3.5.0.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ba148faeafba7048244c5042c81f42562340e25701507914d9a231d804692f1
|
|
BLAKE2b-256 checksum How to use checksums |
7f79432c8885d9eb3abe2c9ea6a5c3ac4312c53b412ce43b557f0da9a2077278
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / putergenai-3.5.0-py3-none-any.whl
| Download URL | putergenai-3.5.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
076ee133d094ba5143a803d8b8f7d306be1404abc6da9bd89ca633cba4b53265
|
|
BLAKE2b-256 checksum How to use checksums |
8ffdf014bd6abb9dddfcee3db964db582e8fbc62c7e242329be95fe7abc8466d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for putergenai 3.5.0
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.