Skip to main content

Client library for the GPU Share service

Project description

gpushare

Python client for the GPU Share service.

Note: Before start using this library, Please make sure to login to our service GPUShare and get your API key and logins ready.
Note: please do understand the otp or anyother future emails will go to spam as im using my personal gmail as service mail. please mark the email as looks safe. Thank you!

Installation

pip install gpushare

pypi library gpushare

Quickstart

from gpushare import GPUShareClient, AuthenticationError, APIError

client = GPUShareClient("https://gpushare.srimanhq.com")

# 1. Authenticate (OTP flow):
client.login("you@example.com", "yourpassword", "8bit string")
# then enter the OTP when prompted

# or, if you already have a token:
client.set_api_token("YOUR_API_TOKEN")

# 2. Pick a GPU
client.select_gpu(1)

# 3. Execute code
output = client.execute_code("print('Hello from GPU!')")
print(output)

API Reference

Authentication

login(email: str, password: str, random_token: str, mode: str = "user"):
Starts the OTP login flow, sending an OTP to your email/device.

client.login("you@example.com", "pass123", "AbCd1234")
# prompts for OTP, then calls verify_otp() internally

verify_otp(email: str, otp: str):
Complete OTP verification and retrieve your API token.

client.verify_otp("you@example.com", "123456")

get_api_token():
Fetch a new token directly from the web endpoint (parses HTML).

client.get_api_token()

set_api_token(token: str):
Manually set a pre‑obtained API token.

client.set_api_token("YOUR_API_TOKEN")

Token Management

get_token_info() -> dict:
Returns { created_at, expires_at, revoked }

info = client.get_token_info()
print(info["expires_at"])

refresh_token() -> dict:
Extend token expiry; returns the new token and expiry.

new_info = client.refresh_token()
print(new_info["token"], new_info["expires_at"])

kill_token():
Revoke the current API token.

client.kill_token()

GPU Selection & Roles

select_gpu(gpu_id: int):
Choose which GPU you want to control.

client.select_gpu(2)

switch_mode(mode: str):
Switch your role ("user", "owner", "admin", "moderator"):
currently moderator is not completely implemented i will update it soon :)

client.switch_mode("owner")

User Info

whoami() -> dict:
Get full session info (requires OTP if not authenticated).

info = client.whoami()

whoami_quick(8bit_token: str) -> dict:
Quick lookup using your 8‑char token when you first logged in.

info = client.whoami_quick("AbCd1234")

GPU & Access APIs

list_available_gpus() -> list:
List all GPUs you can request, in your current mode.

gpus = client.list_available_gpus()

get_gpu_detail() -> dict | None:
Fetch metadata for the selected GPU.

detail = client.get_gpu_detail()

request_access(code: str = None) -> dict:
Request access to the GPU (if not already a user).

resp = client.request_access(code="Please grant access")

get_my_requests() -> list:
List your own pending/approved/denied requests.

my_reqs = client.get_my_requests()

approve_request(req_id: int) -> dict:
Approve someone’s request (owner/admin only). For this you have to change set_mode() to owner as i have to open sourced the server side code yet, you guys cant use the admin mode. Soon, i will open-source.

client.approve_request(42)

deny_request(req_id: int) -> dict:
denying someone’s request (owner/admin only). For this too you have to change set_mode() to owner.

client.deny_request(43)

revoke_access(request_id: int) -> dict:
Revoke a granted access (owner/admin/user).

client.revoke_access(10)

set_gpu_idle(idle: bool) -> dict:
Mark the GPU idle or busy (owner only). Must set mode to owner not even admin can change it to idle. You must be in owner mode to operate this.

client.set_gpu_idle(True)   # mark idle
client.set_gpu_idle(False)  # mark active

Code Review & Execution

download_reviewed_code(review_id: int, dest_path: str):
Download a reviewed code bundle to disk. Currently broken, did a oopsie. will fix it.

client.download_reviewed_code(123, "reviewed.py")

run_reviewed_code(review_id: int) -> str:
Execute a previously reviewed code snippet. Currently broken.

output = client.run_reviewed_code(123)

execute_code(code: str) -> str:
Send arbitrary Python to run on the GPU. GPU is either have to be previously approved by owner or should be owner to run this part.

out = client.execute_code("for i in range(3): print(i)")
print(out)

run_file(filepath: str) -> str:
Read a local .py file and execute its contents remotely. GPU is either have to be previously approved by owner or should be owner to run this part.

out = client.run_file("script.py")

Admin Dashboard

Curently unavailable for anybody until open-sourced

get_admin_dashboard() -> dict:
Fetch global stats (admin mode only).

dashboard = client.get_admin_dashboard()

Error Handling

All methods will raise one of:

  • AuthenticationError (login/token issues)

  • AuthorizationError (permission errors)

  • APIError (other API failures)

from gpushare import AuthenticationError, AuthorizationError, APIError

try:
    client.select_gpu(1)
except APIError as e:
    print("API error:", e)

Currently only support Windows and RTX only Tested and remaining lack of resources to test.

you can download the host agent for windows from the link below:
Download Host Agent

Download the archive, extract it, and navigate to the dist folder. Run the gpu_agent_gui app to start the host agent (currently only tested on Windows with RTX and Quadro GPUs; other GPUs have not been tested due to lack of resources).

you will download from a private cloud hosted at 'https://cloud.srimanhq.com' anyone in need for private cloud storage with good research idea can approach my email to send why you need it and how much you need it. I will review it and make decision.

you data will be safe and almost currently 95% uptime if natural disaster and 100% if informed for specific specific time. data is replicated using raid 1 redundant cause my wallet has issue :') and shout-out to my under-paid under-voltaged worker (pi5) for working really hard 24/7.

Note: Everything I provide as service for community is Free of charge, Under no point in future will this project will be converted to be paid. Let's Create, Contribute, Communicate together.

Please make sure to email me any bugs or not properly coded endpoints. Also, Please do understand i am only human, i might have made critical mistakes. I made sure that the Access to your gpu as safe as possible and you, only you can access the GPU until you approve it to your friends or partners, not even admin or i can access without you accepting it. At the end you have the power to do anything with your APIs.

YOU HAVE THE FREEDOM TO DO ANYTHING.

your gentle feedback & suggestions is much appreciated ;)

License

Not yet Licenced by 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

gpushare-0.1.11.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpushare-0.1.11-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file gpushare-0.1.11.tar.gz.

File metadata

  • Download URL: gpushare-0.1.11.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for gpushare-0.1.11.tar.gz
Algorithm Hash digest
SHA256 4b68721b6d6f52b81a59ac75ffa8bac647b6d7cc680a20ffd8ef7511c5c1256a
MD5 48f1230e113414ef95a4b317020c853b
BLAKE2b-256 10821e6babf2886e22bf2296b36db70d814fc9ee8d49d9c72d6833d1de786c27

See more details on using hashes here.

File details

Details for the file gpushare-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: gpushare-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for gpushare-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f1d0f722c668dd400a88921ebaa62c561397c52d30505c777b5428849579c06b
MD5 ef87c42844d2f8fd84b7d045bd36d04f
BLAKE2b-256 131ac34c8a95f1d85a06b58810e1a65f4ae58d3bd6c07af04abed9f51be7ebf1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page