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.

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 :')

Note: Everything I provide is service for community, Free of charge. Create, Contribute, Communicate.

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.10.tar.gz (10.4 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.10-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gpushare-0.1.10.tar.gz
  • Upload date:
  • Size: 10.4 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.10.tar.gz
Algorithm Hash digest
SHA256 4460bcf9bd8f1972ad6f9f07222ad7d7d83c1486ed0a0c5ec8511bca2afa3365
MD5 e60203dd23209d7bfe6a34a739f6a8db
BLAKE2b-256 ee4e8b4a451ec72811e408c1fb29ee80537ed0be3431691de8d52457f3ff522c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gpushare-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 90aa546cb0414b4f8fe2d1b43c5fe1bed3b18fc7e9ccf9c0a46578cf55d718cc
MD5 ec582e07054ad6e3a829636185a4042d
BLAKE2b-256 11d4a7e27142f6df73f73e5398be910c511aae81252b08c3649333f5eaca127f

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