GridShare API Docs
REST API + Python SDK + CLI. Base URL: https://gridshare.in · All endpoints return JSON · TLS only
⚡ Quickstart — 60 seconds
1
Create an account & top up

Sign up at /app, add ₹100 via UPI. Students get 15% bonus on every top-up (up to ₹3,000 total).

2
Get your API key

In the dashboard, open 🔑 API Keys in the left sidebar → Create key. Keys start with gs_live_ and never expire unless revoked.

3
Launch a GPU instance
cURL
Python
CLI
curl -X POST https://gridshare.in/v1/instances/ \ -H "Authorization: Bearer gs_live_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "image": "gridshare/jupyter:latest", "min_vram_gb": 8, "exposed_ports": [8888] }' # Response: {"id":"...","status":"provisioning","ssh":{"host":"relay.gridshare.in","port":30042,...},...}
4
Stop when done — billing stops immediately
curl -X DELETE https://gridshare.in/v1/instances/inst_xxx \ -H "Authorization: Bearer gs_live_YOUR_KEY" # Billing stops within seconds of container termination
🔑 Authentication
All API endpoints require a bearer token. Pass your API key in the Authorization header:
Authorization: Bearer gs_live_your_api_key_here
API keys are created at /app → 🔑 API Keys (left sidebar, or Account → API Keys). You can have up to 10 active keys. Keys are shown only once at creation — store them securely. Revoke anytime.
Rate limits
Per client IP, sliding window:
EndpointLimitWindow
/v1/serverless/*300 reqper minute
/buyers/signup10 reqper minute
/buyers/login30 reqper minute
/webhooks/*60 reqper minute
All other endpoints600 reqper minute
Exceeding a limit returns 429 Too Many Requests — back off and retry after the window. Limits may tighten without notice for abusive traffic.
🐍 Python SDK
Official Python client. Wraps the REST API with typed responses, retries, and async support.
# Install (private beta — the same wheel provides the `gridshare` CLI) pip install https://gridshare.in/dl/gridshare-0.2.2-py3-none-any.whl
import gridshare # Auth (or set the GRIDSHARE_TOKEN env var and skip this) gridshare.configure(api_key="gs_live_...") # — Instances — inst = gridshare.launch(template="pytorch", gpu_vram=24) gridshare.list_instances() gridshare.get_instance(inst.id) gridshare.get_metrics(inst.id) gridshare.stop(inst.id) # — GPUs — gridshare.list_gpus(min_vram=24) gridshare.list_templates() # — Serverless (scale-to-zero endpoints) — gridshare.serverless.create(name="my-llama-3", image="gridshare/vllm:latest", env={"HF_MODEL": "meta-llama/Meta-Llama-3-8B"}) result = gridshare.serverless.run("my-llama-3", {"messages": [{"role": "user", "content": "Hello"}]}) # — Workspaces / agents whose saved files survive their machine dying — ws = gridshare.workspaces.run_agent(image="python:3.11-slim", start_command="python3 /workspace/agent.py") # — Secrets (encrypted env vars injected at boot) — gridshare.secrets.set("HF_TOKEN", "hf_abc123...") gridshare.secrets.list() # — SSH keys — gridshare.ssh_keys.add(label="MacBook", public_key="ssh-ed25519 AAAA...") # — Wallet — gridshare.balance()
Set the GRIDSHARE_TOKEN environment variable to avoid passing the key in code — the SDK reads it automatically. For explicit lifecycle control use gridshare.GridShareClient(api_key=...), which exposes the same methods. The SDK is synchronous; there is no async client yet.
💻 CLI Reference
# Install (private beta — installs the `gridshare` CLI and the Python SDK) pip install https://gridshare.in/dl/gridshare-0.2.2-py3-none-any.whl gridshare --help
# Auth gridshare signup # create an account gridshare login # saves to ~/.gridshare/config.json gridshare logout # Browse available GPUs gridshare gpus # available nodes (--min-vram, --city) gridshare templates # pre-built Docker templates # Instances gridshare launch # launch a GPU instance gridshare list # your instances gridshare status <id> gridshare stop <id> gridshare ssh <id> # interactive SSH session gridshare metrics <id> # live GPU metrics # Wallet & account gridshare balance gridshare topup # dev/mock mode only gridshare student-verify # institutional email → student rate gridshare referral info # ₹100 each when a friend's first top-up is ₹500+
Run gridshare <command> --help for the flags on any command. Serverless endpoints, secrets and SSH-key management are available through the Python SDK and the REST API (see the sections below) — they are not yet exposed as CLI subcommands.
⚡ Instances API
Create, list, stop GPU instances. Billing runs per second while the instance runs and stops at termination; on GridShare app templates the meter doesn't start until the app is actually ready (up to a 15-minute boot window).
POST/v1/instances/
Launch a new GPU instance.
# Request body { "image": "gridshare/jupyter:latest", # required — any template image or your own "label": "my-notebook", # optional: friendly name in the dashboard "gpu_count": 1, # 0-8 (0 = CPU-only) "min_vram_gb": 8, # optional: minimum GPU VRAM "disk_gb": 20, # workspace disk, 5-500 GB "exposed_ports": [8888, 7860], # ports proxied over HTTPS "env": {"MY_VAR": "value"}, # optional: additional env vars "use_secrets": true, # inject saved secrets at /run/gs_secrets/env "ssh_pubkey": "ssh-rsa AAAA..." # optional: passwordless SSH }
GET/v1/instances/
List all running instances for your account.
GET/v1/instances/{instance_id}
Get instance status, SSH details, GPU metrics, and billing info.
DELETE/v1/instances/{instance_id}
Stop and terminate an instance. Billing stops within seconds.
# Response example { "id": "57f993b4-c2e9-432e-99c2-2c02f076344a", "status": "running", # provisioning|starting|running|stopped|error "image": "gridshare/jupyter:latest", "gpu_count": 1, "rate_per_hr_inr": 12.0, "total_cost_inr": 2.25, # total so far "ssh": { "host": "relay.gridshare.in", "port": 30042, "user": "root", "command": "ssh -p 30042 root@relay.gridshare.in" }, # null fields + "native_mac":true on Apple-silicon machines (no SSH — use the web apps) "port_map": {"8888": "https://relay.gridshare.in/proxy/57f993b4-.../8888/"}, "created_at": "2026-08-28T17:44:00Z" }
Available templates & custom Docker
Template IDWhat you getUse case
pytorch-jupyterOpen your notebook and start training in 60 seconds.pytorch, jupyter, cuda
tensorflow-jupyterTensorFlow with GPU support, ready instantly.tensorflow, keras, jupyter
huggingfaceTransformers, Diffusers, Datasets — all pre-installed.huggingface, transformers, diffusers
pytorch-barePyTorch over SSH, no notebook. For a notebook pick PyTorch + Jupyter.pytorch, cuda, training
stable-diffusion-webuiThe simplest text-to-image app — type a prompt, get an image.stable-diffusion, automatic1111, image-gen
comfyuiNode-based workflow engine for Stable Diffusion.comfyui, stable-diffusion, workflow
invokeaiProfessional AI art tool with polished UI.invokeai, stable-diffusion, image-gen
ollamaRun Llama 3, Mistral, Gemma locally in minutes.ollama, llama3, mistral
vllmProduction-grade LLM serving — OpenAI API compatible.vllm, llm, inference
tgiHuggingFace's battle-tested LLM inference server.tgi, huggingface, llm
text-gen-webuiOobabooga — the most flexible LLM chat UI.oobabooga, text-gen-webui, llm
whisperOpenAI Whisper — GPU speech transcription in JupyterLab.whisper, asr, transcription
ubuntu-cudaClean slate. Install whatever you need.ubuntu, cuda, custom
ubuntu-cpuLightweight CPU shell. No GPU needed.ubuntu, cpu, shell
indic-asr-whisperTranscribe Hindi, Tamil, Telugu, Bengali & 20+ Indian languages.whisper, asr, hindi
indic-llm-finetuneLoRA-fine-tune an open Indian LLM on your own data.llm, fine-tune, lora
indic-doc-ocrExtract text from Indian documents & scripts.ocr, documents, indic
mlflowTrack every run, metric, and model — auto-starts on :5000.mlflow, mlops, experiment-tracking
code-serverYour VS Code, running on the rented GPU. Feels local.vscode, code-server, ide
llama-factoryFine-tune Llama/Qwen/Mistral from a web UI — no code.llama-factory, fine-tune, lora
label-studioAnnotate text, images, audio — your team's labeling workspace.label-studio, labeling, annotation
flowiseDrag-and-drop LLM apps and agents — no code.flowise, agents, no-code
customYour own Docker image from any registryany framework, any model
🔐 SSH Keys
Upload your SSH public keys once. They're automatically added to ~/.ssh/authorized_keys on every instance you launch — no manual key copy needed.
POST/buyers/ssh-keys/
Add an SSH public key to your account. Max 10 keys.
{"label": "MacBook Pro", "public_key": "ssh-ed25519 AAAA..."}
GET/buyers/ssh-keys/
List all SSH keys on your account (public keys returned, not private).
DELETE/buyers/ssh-keys/{key_id}
Remove an SSH key. Does not affect running instances.
💡 Pro tip: Add your key once, then every gridshare ssh inst_xxx command works without any key flags.
🔑 Key-based auth is the default. When at least one SSH key is registered on your account, new instances are provisioned with password authentication disabled — you log in with your key only. If no key is registered, instances fall back to a generated password (shown in the dashboard). We recommend adding a key: it's both more secure and faster to connect.
🔒 Secrets (Encrypted Env Vars)
Store sensitive values (HuggingFace tokens, API keys, database URLs) encrypted at rest. Inject them into instance containers without hardcoding in requests.
POST/buyers/secrets/
Create a secret. Value is encrypted before storage.
{"name": "HF_TOKEN", "value": "hf_aBcDe12345..."} # Name must be valid env var (A-Z, 0-9, underscore)
GET/buyers/secrets/
List secrets by name (values never returned after creation).
DELETE/buyers/secrets/{secret_id}
Delete a secret.
Enable secret injection when launching:
# With the SDK (the CLI has no --use-secrets flag yet) gridshare.launch(template="pytorch", gpu_vram=24, use_secrets=True) # With API {"image": "gridshare/pytorch:latest", "use_secrets": true}
Where secrets appear inside the instance
Injected secrets are written to a file at /run/gs_secrets/env inside the container — they are not set as environment variables. The file contains plain KEY=VALUE lines:
# Shell — load all secrets into the current session source /run/gs_secrets/env # Python — parse the file directly secrets = dict( line.split("=", 1) for line in open("/run/gs_secrets/env").read().splitlines() if line and not line.startswith("#") ) hf_token = secrets["HF_TOKEN"]
The legacy behaviour (secrets as container environment variables) is still available by launching with GRIDSHARE_LEGACY_ENV_SECRETS=1 in env, but it is discouraged: environment variables are visible to the host machine's owner via docker inspect, while the secrets file is mounted only inside the container.
⚠️ Secret values are shown once at creation. Store them separately. Decryption only happens at instance launch time, never returned via API.
⚠️ Honest security note: GridShare instances run on hardware owned by independent providers. File-based injection protects against casual inspection, but a determined host owner with root access can read container memory. Never inject production credentials into Community-tier instances — use scoped, revocable tokens (e.g. a read-only HuggingFace token) and rotate them after sensitive workloads.
🔮 Serverless API
Deploy models as HTTP endpoints. Scale to zero when idle. Billed per 100ms of active compute (from ₹0.005/sec for RTX 4090 tier).
POST/v1/serverless/endpoints/
Create a serverless endpoint.
{ "name": "my-llama-3-8b", "image": "gridshare/vllm:latest", "min_workers": 0, # 0 = scale to zero "max_workers": 5, "use_secrets": true # inject saved secrets at /run/gs_secrets/env }
POST/v1/serverless/{endpoint_id}/run
Invoke the endpoint. Blocks until result is ready (or use async variant).
{"prompt": "Explain transformers in Hindi", "max_tokens": 512} # Response: {"output": "...", "compute_ms": 2100, "cost_inr": 0.026}
GET/v1/serverless/endpoints/
List your serverless endpoints and their current worker counts.
DELETE/v1/serverless/endpoints/{endpoint_id}
Delete an endpoint. Running workers are stopped.
🔔 Webhooks
Get HTTP callbacks when instance/billing events happen. GridShare signs every request with HMAC-SHA256.
POST/webhooks/
Register a webhook URL and choose which events to subscribe to.
{ "url": "https://myserver.com/gridshare-hook", "label": "production", "events": ["instance.started", "instance.completed", "instance.migrated"] // omit "events" entirely to receive every event }
# Verify webhook signature (Python) import hashlib, hmac def verify_signature(secret: str, body: bytes, sig_header: str) -> bool: expected = "sha256=" + hmac.new( secret.encode(), body, hashlib.sha256 ).hexdigest() return hmac.compare_digest(expected, sig_header) # X-GridShare-Signature header contains: "sha256=<hex>"
Event types
EventTrigger
instance.startedContainer is running, SSH is ready
instance.completedInstance finished and was terminated normally
instance.failedInstance stopped because something went wrong (payload has the reason)
instance.preemption_warningProvider node is going offline — checkpoint/save now (work also auto-saves)
instance.migratedInstance auto-migrated to a new GPU after node failure (payload has new SSH details)
serverless.completedA serverless request finished successfully
serverless.failedA serverless request failed
workspace.createdWorkspace created
workspace.launchedWorkspace started on a GPU
workspace.pausedWorkspace paused — ₹0/hr, state kept
workspace.resumedWorkspace resumed on a GPU, state intact
workspace.updatedWorkspace settings changed
workspace.deletedWorkspace deleted
workspace.self_healedYour agent crashed and was restarted automatically
workspace.spend_limit_reachedWorkspace paused because it hit your spend limit
workspace.heal_circuit_brokenAuto-heal gave up — the workload keeps crashing
workspace.heal_no_capacityAuto-heal could not find a free GPU to move to
💰 Wallet & Billing
GET/buyers/me
Get account info including wallet balance, email, GSTIN, plan.
{"alert_threshold_inr": 200} # When balance < ₹200, you get alerted. Set to 0 to disable.
GET/buyers/wallet/history
Your 50 most recent wallet transactions, newest first. Each entry has id, created_at, amount_inr (negative for charges and refunds), type, description, method, status and notes (extra detail, not on every row). Instance usage is not in this list: GET /buyers/wallet/export?days=30 returns a CSV with both.
GET/invoices/monthly/{year}/{month}
Download a usage statement for a given month (YYYY-MM format) — a breakdown of wallet debits, not a tax invoice. GST is charged once at top-up; the tax invoice for each top-up is at /buyers/invoice/{payment_id} and is the document to claim input tax credit against.
🏢 Organizations (Team Accounts)
Share a single wallet across a team. Up to 5 members, with admin/member roles. All billing under one GST invoice.
POST/orgs/
Create an org. Converts your account to an org admin wallet.
POST/orgs/{org_id}/invite
Invite a member by email. They get a join link.
GET/orgs/{org_id}
List members, their roles, and spend this month.
📓 JupyterLab Guide
Every instance launched with the jupyter template (or any PyTorch/TF template) exposes JupyterLab in-browser.
# Launch Jupyter instance gridshare launch --template jupyter --gpu-vram 16 # Get its URL (open it from the dashboard, or read it off status) gridshare status <id> # OR: open the machine's card at https://gridshare.in/app — the Jupyter # button opens https://relay.gridshare.in/proxy/<instance-id>/8888/
JupyterLab access is proxied through gridshare.in — no port forwarding needed. Works behind corporate firewalls.
🛡 Resilience & Auto-Migration Guide
GridShare runs on consumer hardware owned by independent providers — nodes can and do go offline. The platform is built to make that survivable instead of pretending it never happens.
Auto-checkpointing
Every instance autosaves the files in /workspace automatically — there is nothing to enable:
TriggerBehaviour
intervalAutosave every ~30 seconds while running — files under /workspace, up to 4 GB. Skipped: venv, site-packages, node_modules, models, .cache, .git. Shared network volumes are not offered yet.
shutdown_signalEvent-triggered save when the container receives a shutdown signal — provider stop or node going offline gracefully
Checkpoints are stored off-node, so they survive the death of the machine that produced them.
Auto-migration on node death
If the node running your instance stops responding, GridShare automatically:
1
Re-dispatches your workload

A replacement GPU with matching specs is found and your instance is re-created on it. If a checkpoint exists, work resumes from the last save.

2
Stops billing at the failure

You are not billed for any time after the node's last heartbeat, and your job is automatically moved at no cost — no support ticket needed.

3
Tells you where it went

Email and webhook (instance.migrated) — including the new SSH details, so scripts and humans both know where the instance went.

If no replacement GPU is available, the instance is stopped honestly, billing ends at the node's last heartbeat, and you're told — it never sits showing "running" against a dead node.
Resilience strip in the dashboard
Each instance card in the dashboard shows a resilience strip: checkpointing status, time since last checkpoint, and migration history. Use it to confirm your training run is actually protected before you walk away for the night.
Subscribe to instance.preemption_warning and instance.migrated webhooks (see Webhooks) to checkpoint application state and re-point clients automatically.
⚖️ Acceptable Use
GridShare GPUs are for ML training, inference, rendering, and general compute. Cryptocurrency mining and other prohibited workloads are not allowed on any tier.
⚠️ Workloads are monitored using metadata only (GPU utilisation patterns, power draw, network signatures) — we never inspect your code, data, or container contents. Instances detected running crypto mining or other prohibited workloads are terminated without refund, and repeat offences lead to account closure. See the full list in our Terms of Service.