For AI agents
This page is for an AI agent (or its developer) that has been pointed at Green Compute and needs to use it without a human clicking through a dashboard.
What Green Compute is
GPU compute on Bittensor subnet 110, run on renewable and biogas power. Two products, both over one HTTP API:
- GPU rental: an SSH-accessible container on an RTX 4090, billed per minute. See Quickstart.
- Inference: OpenAI-compatible chat completions. See Inference.
Machine-readable entry points
| What | URL | Auth |
|---|---|---|
| This documentation, as one file | https://www.green-compute.com/llms-full.txt | none |
| Documentation index | https://www.green-compute.com/llms.txt | none |
| Any docs page as Markdown | append .md, e.g. https://www.green-compute.com/docs/quickstart.md | none |
| OpenAPI spec | https://api.green-compute.com/openapi.json | none |
| API index | https://api.green-compute.com/ | none |
| Prices | https://api.green-compute.com/platform/pricing | none |
| GPU ids you can rent right now | https://api.green-compute.com/platform/nodes/supported | none |
| Your balance / billing history | /platform/billing/balance, /platform/billing/ledger | API key |
What needs a human, once
Creating the account and the API key happen in the browser. After that, everything is API, including adding credit if you can pay in crypto (see below). If you have no key, ask your user for one. Point them at green-compute.com/settings, and at green-compute.com/billing if they'd rather pay by card.
Adding credit over the API
An agent with its own wallet can fund the account without a person. There are two ways; a verified wallet is the simpler one. Adding credit covers the same ground for people, including what to do when a payment isn't credited.
Option A: verify your wallet once, then just pay
1. Ask for a message to sign for the wallet you'll pay from. chain is bittensor (for TAO and alpha) or evm (for USDC and USDT on Ethereum and Base):
curl -s -X POST https://api.green-compute.com/platform/billing/wallets/challenge \
-H "Authorization: Bearer $GC_KEY" -H "Content-Type: application/json" \
-d '{"chain": "bittensor", "address": "<your coldkey address>"}'
{
"chain": "bittensor",
"address": "<your coldkey address>",
"issued_at": "2026-10-12T12:00:00Z",
"message": "Green Compute: link wallet <address> to account <you>. Issued 2026-10-12T12:00:00Z. Payments from this wallet will be credited to this account."
}
2. Sign message with that wallet's key, and send the signature back within 15 minutes:
# A Bittensor coldkey, with substrate-interface
from substrateinterface import Keypair
signature = Keypair.create_from_mnemonic(MNEMONIC).sign(challenge["message"]).hex()
# An Ethereum / Base account, with eth-account
from eth_account import Account
from eth_account.messages import encode_defunct
signature = Account.sign_message(encode_defunct(text=challenge["message"]), private_key=KEY).signature.hex()
From a terminal, btcli wallet sign --wallet-name <name> --no-use-hotkey --message '<message>' prints the same signature.
curl -s -X POST https://api.green-compute.com/platform/billing/wallets \
-H "Authorization: Bearer $GC_KEY" -H "Content-Type: application/json" \
-d '{"chain": "bittensor", "address": "<your coldkey address>", "issued_at": "<from step 1>", "signature": "<hex>"}'
3. Pay any amount, any time. Send from that wallet to the address for the currency, listed by GET /platform/billing/crypto/addresses. It is credited at the current price a few minutes after the transfer confirms, and GET /platform/billing/crypto/deposits lists every credited payment.
Linking a wallet also credits anything it sent us in the last 30 days that wasn't credited to anyone. Each wallet can be verified by one account. Exchange accounts and smart-contract wallets can't sign messages; pay those with an invoice.
Option B: an invoice for an exact amount
1. Create an invoice for the amount you want to add, in US dollars ($1 to $50,000):
curl -s -X POST https://api.green-compute.com/platform/billing/topup/crypto \
-H "Authorization: Bearer $GC_KEY" -H "Content-Type: application/json" \
-d '{"currency": "usdc-base", "amount_usd": 20}'
{
"invoice_id": "<id>",
"currency": "usdc-base",
"amount_crypto": 20.003817,
"amount_to_send": "20.003817",
"amount_usd": 20.0,
"bonus_pct": 0.0,
"total_credits": 2000,
"deposit_address": "<address to send to>",
"expires_at": "2026-10-12T12:30:00+00:00"
}
2. Send exactly amount_to_send of that currency to deposit_address before expires_at, 30 minutes after you create the invoice. Everyone pays to the same address, so the last digits are what identify your invoice: send that exact string as one transfer, and don't round it. Paying up to 5% more is accepted when no other open invoice could match, and credits the full value received. The exact amount arriving after the invoice expired is still matched for 24 hours, at the price when it arrives. For TAO, use a normal transfer, not transfer_all, which deducts the fee and arrives short. A smaller amount or a split payment isn't matched automatically: verify the wallet it came from (Option A), which credits it, or request a review with POST /platform/billing/crypto/{invoice_id}/review and {"tx_hash": "...", "note": "..."}, which support checks by hand.
3. Wait for the credit. Poll GET /platform/billing/crypto/invoices until your invoice's status is confirmed, or watch GET /platform/billing/balance. An account can have five unpaid invoices open at once.
currency | What to send | Bonus |
|---|---|---|
usdc-base, usdt-base | USDC or USDT on Base | none |
usdc-eth, usdt-eth | USDC or USDT on Ethereum | none |
tao | TAO, as a plain transfer on Bittensor | none |
alpha | Subnet 110 alpha, moved to the deposit address with transfer_stake (btcli stake transfer) | 10% extra credit |
ETH itself and other tokens aren't accepted. To pay by card instead, POST /platform/billing/topup/stripe with {"amount_usd": 20} returns a checkout_url that a person has to open and pay.
Rules of thumb
- Use your own SSH public key in
metadata.ssh_public_keys. Then you never need to fetch, store or log a private key. - Budget from the API, not from prose.
hourly_rate_centson a new deployment is the most it can cost per GPU-hour;/platform/pricingis what billing charges. - Let a fleet keep your rentals running.
POST /platform/fleets{"workload_id": "…", "target": 8}replaces any rental that stops, under the same name, and waits for GPUs or credit by itself; see Fleets. - Watch your credit.
GET /platform/billing/forecastgiveshours_leftat the current burn; the account owner is emailed under 24 hours and under 2 hours. Create saved pods withresume_on_topup: trueand they come back by themselves after a top-up, so your loop never has to notice a pause. - Always clean up, and set a backstop.
DELETE /platform/deployments/{id}stops billing; wrap your work so it runs even on failure. Also passmax_runtime_minuteswhen you create the deployment, so it stops by itself if you crash. To confirm,GET /platform/deployments/{id}showsterminated, and/platform/billing/ledgershows what was charged. - Use MCP if your client speaks it.
https://api.green-compute.com/mcpexposes renting, status, logs, stats and events as tools; see MCP. - Don't poll every deployment.
GET /platform/events?after=<cursor>returns every change on the account since the last call (ready, failed, suspended, terminated, balance low), or register a webhook. See Events and webhooks. - Change a card without SSH.
POST /platform/deployments/{id}/execruns a command in it and returns the exit code and output; loop over your rentals to update them all. Withrestart_policy, stopping the job restarts it on the new version. - Check a card without SSH.
GET /platform/deployments/{id}/statshas each GPU's use, temperature, power and clocks;GET /platform/deployments/{id}/logshas the job's recent output. - Run jobs without SSH. Put the job in the workload's
metadata.commandand its settings inmetadata.env; it starts on its own when the pod is ready, logging to/workspace/greencompute-command.log. Add"restart_policy": "on-failure"(or"always") to have it run again if it exits, instead of watching for crashes yourself. Pair it withmax_runtime_minutes. - Make creates retry-safe. Send an
Idempotency-Keyheader onPOST /platform/workloadsandPOST /platform/deployments. If a request times out, resend it with the same key: you get the first result back instead of a second rental. - Check
available_gpusbefore you create, and respectRetry-After./platform/pricingsays how many GPUs are free this instant, andmax_gpus_per_deploymenthow many one deployment can get together; if either is below what you need, wait rather than create. A503 no_capacity(fleet full) or a429(rate limit) says how many seconds to wait in itsRetry-Afterheader; neither creates anything. - Poll, don't sleep blindly.
GET /platform/deployments/{id}every 5–10 s untilstateisready; stop onfailedand readlast_error. - Branch on
error.code. Every error haserror.code(stable),error.retryableand, when it applies,error.retry_after_seconds; see Errors. Don't match message text. - Errors are actionable. A
400for an unavailable GPU lists the GPUs that are available; a402gives the exact amount to top up, which you can pay with a crypto invoice. See Errors. - For an RTX 5090, use a CUDA 12.8+ image.
pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtimeworks on both cards. - One-off commands work over SSH.
ssh root@host -p port 'python train.py'uses the image'sPATH, so conda/PyTorch images behave as documented.
Give your agent a limited key
A key can be limited to some of these scopes, so a leaked or prompt-injected key can only do what you allowed:
| Scope | Allows |
|---|---|
read | Seeing deployments, workloads, balance, invoices and other account data |
inference | Calling models through /v1 |
rentals | Starting, changing and stopping rentals, and getting SSH access |
billing | Adding credit: crypto invoices, verified wallets, payment reviews |
keys | Creating and revoking keys, never broader than itself |
Create one under Settings → API Keys → Limited, or with an existing key:
curl -s -X POST https://api.green-compute.com/platform/api-keys \
-H "Authorization: Bearer $GC_KEY" -H "Content-Type: application/json" \
-d '{"name": "my-agent", "scopes": ["read", "rentals"], "max_active_rentals": 2, "daily_spend_limit_usd": 10}'
Add limits so a leaked or runaway key can't drain the account: "max_active_rentals": 2 caps how many rentals it may have running at once, and "daily_spend_limit_usd": 10 caps what it may spend on rentals and inference in any 24 hours. At the spend limit the key can't start rentals or call models, and rentals it started are stopped. A key created by a limited key inherits its limits and can only tighten them.
The response holds the new key's secret, shown only once. A key with no scopes has full access, like the one your dashboard uses. A request outside a key's scopes returns 403 with required_scope in the body; a request over a key's limits returns 403 with "code": "key_limit".
Minimal loop (Python, standard library only)
import json, os, time, urllib.request
API = "https://api.green-compute.com"
KEY = os.environ["GC_KEY"]
def call(method, path, body=None):
req = urllib.request.Request(
API + path, method=method,
data=json.dumps(body).encode() if body is not None else None,
headers={"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"},
)
with urllib.request.urlopen(req) as r:
return json.loads(r.read() or b"null")
pubkey = open(os.path.expanduser("~/.ssh/id_ed25519.pub")).read().strip()
wl = call("POST", "/platform/workloads", {
"name": "agent-job", "kind": "pod",
"image": "pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime",
"requirements": {"gpu_count": 1, "supported_gpu_models": ["rtx4090"],
"min_vram_gb_per_gpu": 24, "cpu_cores": 8, "memory_gb": 32},
"metadata": {"ssh_public_keys": [pubkey]},
})
dep = call("POST", "/platform/deployments", {"workload_id": wl["workload_id"], "max_runtime_minutes": 60})
try:
while (d := call("GET", f"/platform/deployments/{dep['deployment_id']}"))["state"] not in ("ready", "failed"):
time.sleep(10)
if d["state"] == "failed":
raise RuntimeError(d.get("last_error"))
ssh = call("GET", f"/platform/deployments/{dep['deployment_id']}/ssh")
print("connect with:", ssh["ssh_command"])
# ... do the work over SSH ...
finally:
call("DELETE", f"/platform/deployments/{dep['deployment_id']}")
Green Compute