GhostNexus Python SDK — EU GPU cloud, GDPR-compliant
Project description
ghostnexus — Python SDK
Run Python scripts on RTX 4090 / A100 / H100 GPUs in 30 seconds. Pay per second. 40% cheaper than AWS.
import ghostnexus
client = ghostnexus.Client(api_key="gn_live_...")
job = client.run("train.py")
result = job.wait()
print(result.output)
💸 Price Comparison
| Provider | GPU | $/hour | $/month (720h) |
|---|---|---|---|
| GhostNexus | RTX 4090 | $0.50 | $36 |
| AWS | A10G | $1.01 | $727 |
| Google Cloud | T4 | $0.35 | $252 |
| Lambda Labs | A10 | $0.60 | $432 |
| RunPod | RTX 4090 | $0.74 | $533 |
GhostNexus is a decentralized GPU marketplace — compute comes from real GPU owners, not hyperscaler data centers. Servers are EU-hosted and GDPR-compliant. No lock-in. No subscription required.
🚀 Quick Start
Install
pip install ghostnexus
Get your API key
Sign up at ghostnexus.net — you get $15 free credits with code WELCOME15.
Run a script
import ghostnexus
client = ghostnexus.Client(api_key="gn_live_YOUR_KEY")
# Run a file
job = client.run("train.py")
result = job.wait()
print(result.output)
print(f"Cost: ${result.cost_credits:.4f} credits")
# Run inline code
job = client.run(
"import torch; print(torch.cuda.get_device_name(0))",
inline=True,
)
result = job.wait(timeout=120)
print(result.output) # NVIDIA GeForce RTX 4090
Environment variable (recommended)
export GHOSTNEXUS_API_KEY="gn_live_YOUR_KEY"
client = ghostnexus.Client() # picks up key from env
📖 API Reference
Client(api_key, base_url, timeout)
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str |
$GHOSTNEXUS_API_KEY |
Your API key |
base_url |
str |
https://ghostnexus.net |
API base URL |
timeout |
int |
30 |
HTTP timeout (seconds) |
Methods
client.run(script, task_name=None, inline=False) → Job
Submit a Python script to the GPU network.
# From a file
job = client.run("finetune.py", task_name="llama-finetune")
# Inline
job = client.run("import torch; print(torch.__version__)", inline=True)
job.wait(timeout=600, poll_interval=3) → JobResult
Block until the job completes.
result = job.wait(timeout=300)
print(result.output) # stdout from your script
print(result.status) # "success" or "failed"
print(result.duration_seconds)
print(result.cost_credits)
client.status(job_id) → JobResult
Poll a job without blocking.
result = client.status("job-uuid-here")
if result.status == "success":
print(result.output)
client.history(limit=50, offset=0) → List[JobResult]
jobs = client.history(limit=10)
for job in jobs:
print(f"{job.task_name}: {job.status} (${job.cost_credits:.4f})")
client.balance() → float
print(f"Credits remaining: ${client.balance():.2f}")
client.me() → UserInfo
info = client.me()
print(info.email)
print(info.credit_balance)
🔥 Examples
Train a model
import ghostnexus
client = ghostnexus.Client()
job = client.run("train_resnet.py", task_name="resnet50-cifar10")
result = job.wait(timeout=3600)
print(result.output)
print(f"Trained in {result.duration_seconds:.0f}s for ${result.cost_credits:.4f}")
Check GPU info (quick test)
import ghostnexus
client = ghostnexus.Client()
job = client.run("""
import torch
print(f"GPU: {torch.cuda.get_device_name(0)}")
print(f"VRAM: {torch.cuda.get_device_properties(0).total_memory / 1e9:.1f} GB")
print(f"PyTorch: {torch.__version__}")
print(f"CUDA: {torch.version.cuda}")
""", inline=True)
result = job.wait(timeout=60)
print(result.output)
Batch pipeline
import ghostnexus
client = ghostnexus.Client()
for script in ["preprocess.py", "train.py", "evaluate.py"]:
job = client.run(script)
result = job.wait()
print(f"✓ {result.task_name} — {result.duration_seconds:.1f}s")
❌ Error Handling
import ghostnexus
from ghostnexus import AuthenticationError, InsufficientCreditsError, JobFailedError
try:
job = client.run("train.py")
result = job.wait()
except AuthenticationError:
print("Invalid API key — get one at ghostnexus.net/dashboard")
except InsufficientCreditsError:
print("Not enough credits — add credits at ghostnexus.net/dashboard")
except JobFailedError as e:
print(f"Job failed: {e.logs}")
except ghostnexus.GNTimeoutError:
print("Job timed out")
🔧 Jupyter Integration
pip install ghostnexus
%load_ext ghostnexus_magic
%ghostnexus_config --api-key gn_live_YOUR_KEY
%%ghostnexus --task train-resnet --timeout 60
import torch
model = torch.hub.load('pytorch/vision', 'resnet50', pretrained=True).cuda()
print(f"GPU: {torch.cuda.get_device_name(0)}")
Full docs: ghostnexus.net/integrations
⚙️ GitHub Actions Integration
- name: Run GPU job on GhostNexus
uses: Milaskinger/ghostnexus-run@v1
with:
api-key: ${{ secrets.GHOSTNEXUS_API_KEY }}
script: train.py
timeout-minutes: 30
🛡️ Security & Privacy
- API keys transmitted over HTTPS only
- Scripts run in isolated containers (RestrictedPython sandbox)
- GDPR-compliant — all data stays in the EU
- Fully open source — audit the code yourself
🤝 Contributing
Contributions are welcome!
git clone https://github.com/Milaskinger/ghostnexus-python
cd ghostnexus-python
pip install -e ".[dev]"
pytest
📄 License
MIT — see LICENSE.
🔗 Links
- ghostnexus.net — Platform
- Dashboard — Manage jobs & credits
- Integrations — GitHub Actions, Jupyter
- PyPI — Package
- ghostnexus-node — Provider node (share your GPU)
- contact@ghostnexus.net — Support
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 ghostnexus-0.2.0.tar.gz.
File metadata
- Download URL: ghostnexus-0.2.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6998f4bff67a21b86360dbd2da4153f21d06795b9ef0cd3f8ca154f7bf89a15
|
|
| MD5 |
d10d511722a96c83a19a7d4b92d1e482
|
|
| BLAKE2b-256 |
76370196c7e23f08c041aa67dc9fc50eca266f7545ad237cce7f4aa56c0a8b75
|
File details
Details for the file ghostnexus-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ghostnexus-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
908773391b04cdc6cd8a7e80229a0c9cf36709ffd83577378e1735e84c74148b
|
|
| MD5 |
8c2911f89667eec9166565d974687ae7
|
|
| BLAKE2b-256 |
06f577c1e94c316a225b9dc1f9b60bf721ea4b493003ba04da5450692fc2e808
|