@flopsindex/sdk
v0.9.2
Published
TypeScript/JavaScript SDK for the FLOPS Index — live GPU compute pricing reference rates with verifiable provenance.
Maintainers
Readme
@flopsindex/sdk
npm release mirror. Source of truth:
flopsindexmonorepo (sdk/typescript/). Refresh withflopsindex/scripts/sync-publish.ps1, thennpm run build, before publishing.
TypeScript/JavaScript SDK for the FLOPS Index — GPU compute reference rates with verifiable citations.
Zero runtime dependencies. Uses global fetch — Node ≥ 18, Deno, Bun,
Cloudflare Workers, browsers. Same method names as the
Python SDK so you can swap languages
without relearning the API.
Monorepo — flopsindex · Public access overview
Public access
This package exposes the public FLOPS index surface only: citeable reference rates with verify and permalink URLs. Index construction methodology is not published in this repository — see flopsindex.com and the public access overview.
| Access | What you get | How (this package) |
|---|---|---|
| Anonymous (default) | Delayed public price (~6h grid; indicative, not for settlement) for the FLOPS family (FLOPS-SPOT, FLOPS-OD, FLOPS-DEPIN). | new Client() with no API key |
| Keyed | Same endpoints at real-time, full precision. | FLOPSINDEX_API_KEY or new Client({ apiKey }) → X-FLOPS-Api-Key |
| Partner | Higher fidelity, expanded coverage, and additional detail beyond the public delayed surface. | [email protected] |
If you need more than delayed public rates — e.g. production-grade latency, broader index families, or deeper commercial terms — reach out to [email protected] to discuss partner options.
Install
npm install @flopsindex/sdkQuick start
import { Client } from "@flopsindex/sdk";
const flops = new Client(); // optional FLOPSINDEX_API_KEY upgrades to real-time
const h100 = await flops.getPrice("FLOPS-H100-OD");
console.log(`${h100.value} ${h100.unit}`); // e.g. 2.40 USD/GPU-hr
const check = await flops.verifyHandshake("FLOPS-H100-OD", h100.value ?? 0);
if ("ok" in check && check.ok === false) {
// upstream pending / error — your call
} else {
// verified — cite https://app.flopsindex.com/i/FLOPS-H100-OD
}Methods
| Method | Endpoint | Returns |
|---|---|---|
| getPrice(id) | /v1/price/{id} | Latest public price envelope |
| search(q, limit?) | /v1/search | NL → canonical slug |
| verify(id, value) | /v1/verify | Citation check (throws on error) |
| verifyHandshake(id, value?) | /v1/verify | Same as verify, but returns errors instead of throwing |
| listIndices() | /v2/catalog/public | Live public catalog |
Anonymous callers get the delayed public price; an API key upgrades to real-time — see Public access.
MCP hosts (Claude, Cursor, Windsurf, etc.) should use flopsindex-mcp instead of this package.
Error handling
import { FlopsNotFoundError, FlopsRateLimitError } from "@flopsindex/sdk";
try {
await flops.getPrice("NOT-A-REAL-SLUG");
} catch (e) {
if (e instanceof FlopsNotFoundError) { /* unknown slug */ }
if (e instanceof FlopsRateLimitError) { /* back off e.retryAfterSeconds */ }
}verifyHandshake never throws on HTTP errors — it returns
{ ok: false, reason, upstream_status } instead, matching the MCP server's
defensive envelope.
Build & test
npm install
npm run build # tsc → dist/ (ESM + .d.ts)
npm run smoke # typed live smoke (smoke.ts, needs a TS-aware Node)
node smoke.mjs # dependency-free live contract smoke (no build needed)Citation
When citing a FLOPS value, include the verify URL from the response:
FLOPS Index (2026). {index_name}. https://app.flopsindex.com/i/{index_id}
