DEVELOPERS / SAMPLE CLIENTS

Small clients. Readable code.

Download self-contained JavaScript and Python examples. No package signup, hidden dependencies, or secret keys.

JavaScript module

An ES module with a seven-second request timeout, resource allowlist, and sample-contract validation. Use a runtime that provides fetch.

Download .mjs client ↓

Python client

A standard-library client with typed arguments, finite request timeouts, and a small command-line interface.

Download .py client ↓

Contract files

Keep the sample response shape next to your tests. These definitions describe static fixture resources only.

Download OpenAPI JSON ↓Download JSON Schema ↓

JavaScript usage

JAVASCRIPT
import { getSample } from "./minerapi-demo-client.mjs";

const sample = await getSample("asic");
console.log(sample.worker.hashrate_th_s);

Pass your local server origin as the second argument when previewing.

Python usage

PYTHON
python minerapi-demo-client.py asic

# Preview an extracted site on a local server:
python minerapi-demo-client.py gpu \
  --base-url http://localhost:8000

Run from the folder where you saved the downloaded client.

What these examples include

The clients fetch one of the public sample files, verify that it is a version-1.0 demo record, and return its JSON object. They do not create a session, collect device data, manage a fleet, or invoke a model. The source is short enough to review before use.

What to change for your own integration

Start by replacing the sample contract only after you have defined and tested your real collector. Keep authorization and private credentials in an appropriate private runtime. Add tests for the failure paths your environment exposes instead of treating these educational clients as a complete production SDK.

Local preview

Serve the extracted website from a static web server. Directly opening an HTML file from disk is not the deployment model: root-relative routes and fetch requests require an HTTP origin. See the deployment instructions included in the ZIP for a simple local command.