Skip to content

Latest commit

 

History

History
285 lines (200 loc) · 5.69 KB

File metadata and controls

285 lines (200 loc) · 5.69 KB

🤖 ZeroGPT


📚 ZeroGPT Mini Docs

ZeroGPT is a Python library for interacting with AI APIs, providing capabilities for text and image generation.


✨ Features

Feature Description
💬 Text Generation Various models for diverse text outputs
🎨 Image Creation Generate images from textual descriptions
🔓 Uncensored Mode More unrestricted response capabilities
Optimized Performance Memory and data handling optimization
📡 Stream Support Real-time streamed data processing
🔐 Secure Authentication HMAC-SHA256 request signing

🚀 Installation

pip install zerogpt

🛠️ Usage

🔧 Client Initialization

from zerogpt import Client
client = Client()

💬 Text Generation

📝 Simple Text Generation
# Simple request
response = client.send_message("Hi, how are you?")
📋 Text Generation with Instructions
# Request with instruction
response = client.send_message(
    "Tell me about space",
    instruction="You are an astronomy expert"
)
🔓 Uncensored Mode
# Using "uncensored" mode
response = client.send_message(
    "Explain a complex topic",
    uncensored=True
)
🧠 Think Mode (Deep Reasoning)
# Using "think" mode (deeper reasoning)
response = client.send_message(
    "Solve a difficult math problem",
    think=True
)
💭 Contextual Conversations
# With context
messages=[
    {"role": "user", "content": "Hi"},
    {"role": "assistant", "content": "Hello!"}
]
response = client.send_message(
    messages,
    think=True
)

🎨 Image Generation

🖼️ Create Images
# Create image
result = client.create_image(
    prompt="anime neko girl",
    samples=1,
    resolution=(768, 512),
    seed=-1,
    steps=50
)
💾 Manage Generated Images
# 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 Context1

💾 Context Management
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

Parameter Type Required Description
input str or list Text prompt or list of messages
instruction str System instruction
think bool Use model with deeper reasoning
uncensored bool Use unrestricted mode

🎨 create_image

Parameter Type Required Description
prompt str Description of the desired image
samples int Number of samples
resolution tuple Image resolution (width, height)
seed int Seed for reproducibility
steps int Number of generation steps
negative_prompt str Description of undesired elements

🔒 Security

🔐 HMAC-SHA256
All requests are signed using HMAC-SHA256 for secure data transmission
Timestamp Authentication
Prevents replay attacks with timestamp validation

📋 Requirements

Python


📄 License

MIT License

Copyright (c) 2025 RedPiar


👨‍💻 Author

Telegram


Made with ❤️ by RedPiar

Footnotes

  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!