Python client for interacting with the ZeroGPT API and generating images.
Project description
ZeroGPT
ZeroGPT is a Python library for interacting with AI APIs, providing capabilities for text and image generation.
Features
- Text generation using various models
- Image creation based on textual descriptions
- Support for "uncensored" mode for more unrestricted responses
- Optimized memory and data handling
- Streamed data support
- Secure request authentication
Installation
pip install zerogpt
Usage
Client Initialization
from zerogpt import Client
client = Client()
Text Generation
# Simple request
response = client.send_message("Hi, how are you?")
# Request with instruction
response = client.send_message(
"Tell me about space",
instruction="You are an astronomy expert"
)
# Using "uncensored" mode
response = client.send_message(
"Explain a complex topic",
uncensored=True
)
# Using "think" mode (deeper reasoning)
response = client.send_message(
"Solve a difficult math problem",
think=True
)
# With context
messages=[
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hello!"}
]
response = client.send_message(
messages,
think=True
)
Image Generation
# Create image
result = client.create_image(
prompt="anime neko girl",
samples=1,
resolution=(768, 512),
seed=-1,
steps=50
)
# Get generated image
image = client.get_image(result['data']['request_id'])
# Save image
image.download(['path/to/save/image.png'])
# View image
image.open()
Image to Prompt
from zerogpt.utils.tools import image_to_prompt
resp = image_to_prompt('path/to/image.png')
Working with Dummy Context[^1]
from zerogpt.utils.prompt import Dummy
# Create context
dummy = Dummy()
dummy.create(messages=[
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hello!"}
])
# Also possible for image generation
dummy = Dummy()
dummy.create(prompt='neko girl', steps=100)
# Save context
dummy.save("context.bin")
# Load context
dummy.load("context.bin")
# Use instead of messages:
# client.send_message(dummy)
# or
# client.create_image(dummy)
Parameters
send_message
input(str or list): Text prompt or list of messagesinstruction(str, optional): System instructionthink(bool, optional): Use model with deeper reasoninguncensored(bool, optional): Use unrestricted mode
create_image
prompt(str): Description of the desired imagesamples(int, optional): Number of samplesresolution(tuple, optional): Image resolution (width, height)seed(int, optional): Seed for reproducibilitysteps(int, optional): Number of generation stepsnegative_prompt(str, optional): Description of undesired elements
Security
The library uses HMAC-SHA256 to sign requests and ensure secure data transmission. All requests are authenticated using timestamps to prevent replay attacks.
Requirements
- Python 3.8+
License
MIT License Copyright (c) 2025 RedPiar
Author
[^1]: Dummy is used to compress context and data in general, very useful for systems with low RAM. It can also be saved for even greater memory efficiency!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zerogpt-1.3.0.tar.gz.
File metadata
- Download URL: zerogpt-1.3.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef323f77e10da8b6263b6ac6356ef0ffa0961ff22664d8183b3c7286a538d8ba
|
|
| MD5 |
4789e7c45bcdc7185be77814d8636dae
|
|
| BLAKE2b-256 |
c4ae4b8c5413f548a959ac62761a62a7e57cf0dcb28da294f5a8f988ff10f5da
|
File details
Details for the file zerogpt-1.3.0-py3-none-any.whl.
File metadata
- Download URL: zerogpt-1.3.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
176d6fb745bc42d5985333b92cbd4cd6b2f800fffe8edf09181f4a1ba44a3a99
|
|
| MD5 |
858aa8cc20d3a2dfd464e90b6ba9998f
|
|
| BLAKE2b-256 |
8f229b45a301bf8ec136236ff138569eb17432b41f227ec69f6d8e69ca158e6a
|