A lightweight SDK to connect to a Krypton AI Gateway over the internet.
Project description
Krypton SDK
A fully-featured, ultra-lightweight Python SDK that allows clients to connect to a remotely hosted Krypton AI Gateway over the internet.
Zero VRAM required on the client side! You do not need to download your own LLaMA models.
All the heavy lifting and inference happens on the remote host's GPU seamlessly.
🌟 Key Features
- Remote AI Inference: Connect to powerful remote GPUs using your local machines without worrying about hardware bottlenecks.
- Smart Queueing System: Automatically handles waitlists! If the remote server is at maximum capacity, you are placed in a waitlist and automatically emailed a session token when your slot is ready.
- Streaming Support: Instantly stream generation tokens to your terminal/application instead of waiting for the full response to finish generating.
- Offline Support (Fallback Notification): If the host gateway goes completely offline, the SDK gracefully catches the network failure and pings a centralized server to automatically notify the host owner via email to turn their machine back on!
- Secure Authentication: Uses dynamic API sessions restricted by time limits (e.g., 3 hours).
🚀 Installation
Install the package directly via pip:
pip install krypton-sdk
📘 Quickstart Guide
1. Initialization
Provide your email and the public URL of the active Krypton gateway (such as an ngrok, Render, or localtunnel link provided by the host).
from krypton_sdk import KryptonClient
client = KryptonClient(
email="your_email@example.com",
base_url="http://your-gateway-url.com"
)
2. Joining the Queue
Before generating, you must request an API Key (session token).
# The server will check capacity. If free, you get a key instantly.
# If full, you are added to the waitlist and will be emailed when ready!
client.join_queue()
3. Generating Text (Standard)
Once you have an active API key, you can ping the remote Ollama models.
response = client.generate(
prompt="Explain quantum computing in one sentence.",
model="llama3",
max_tokens=200,
temperature=0.7
)
print(response)
4. Generating Text (Streaming)
Enable streaming to print chunks of text exactly as they are produced by the remote GPU.
stream_generator = client.generate(
prompt="Count from 1 to 10!",
model="llama3",
stream=True
)
if stream_generator:
for chunk in stream_generator:
print(chunk, end="", flush=True)
🛠️ Handling Server Downtime
If the gateway is ever offline, the SDK's join_queue() and generate() methods will automatically intercept the ConnectError, reach out to Krypton Ping Server, and instantly dispatch an alert to the server administrator. You'll simply see:
[Krypton] Central GPU Server is offline! Notifying the owner to start it...
[Krypton] Owner notified. You will receive an email shortly once the server is online.
👨💻 Contributing
Have suggestions or want to host your own Krypton Hub? Visit the repository at GitHub - saaj376/Krypton
License: MIT
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
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 krypton_sdk-0.2.1.tar.gz.
File metadata
- Download URL: krypton_sdk-0.2.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b3b37eb4428833659531d9d76c498d4de111a387c6b6a4c66e502fdb3c623c4
|
|
| MD5 |
9e6ace51ce7ebbeaaeb4d746525c73a2
|
|
| BLAKE2b-256 |
96aafe1b515beb0944d2af5c85fc3a2a589fafa0a608b680a912b26e21ca3658
|
File details
Details for the file krypton_sdk-0.2.1-py3-none-any.whl.
File metadata
- Download URL: krypton_sdk-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb4168c06f264346f42d4a1e6e9d4b09de5e11e71e071aee88aaf8f019ca7e8c
|
|
| MD5 |
ee1319f90403a8f9cf181e88148c96ad
|
|
| BLAKE2b-256 |
d08032a2db56ec71bbda00aef23602e7bd3020cb12037af6d4a038d38e747b04
|