Skip to main content

Python SDK for FLOPS Index — live GPU compute and inference token pricing reference rates

Project description

flopsindex — Python SDK

PyPI version PyPI - Python Version PyPI Downloads License: MIT Live API Spec Docs

See also — full docs docs.flopsindex.com · partner write SDK flopsindex-partner · MCP server flopsindex-mcp (v0.6.0, mcp-publisher ready) · spec schema.flopsindex.com · adopters schema.flopsindex.com/adopters

pip install flopsindex

Live GPU compute pricing + LLM inference token pricing reference rates from the FLOPS Index. Single dependency-free SDK over the FLOPS HTTP API.

30-second example

from flopsindex import Client

c = Client()  # picks up FLOPSINDEX_API_KEY if set; works auth-free for public methods

# Public, auth-free — works with no API key
print(c.price("FLCI-H100"))
# {'index_id': 'FLCI-H100', 'value': 2.45, 'unit': 'USD/GPU-hr',
#  'ts': '2026-05-17T14:00:00+00:00', 'tier': 'LIVE',
#  'confidence': 'HIGH', 'verify_url': '...', 'citation_url': '...'}

print(c.timeseries("FLCI-H100", "7d"))   # ≤200 decimated points
print(c.search("h100 spot"))             # NL → canonical slugs
print(c.methodology("flci-h100", "v0.9"))  # versioned methodology + frontmatter

Authentication

The SDK reads an API key from FLOPSINDEX_API_KEY:

export FLOPSINDEX_API_KEY="flops_xxxxxxxxx"

Or pass directly:

c = Client(api_key="flops_xxxxxxxxx")

Auth-free methods (work without a key): price, timeseries, search, methodology, methodologies, verify.

Partner-tier methods (require a key): catalog, index_current, index_history, compute_margin, recompute_audit.

If you call a partner-tier method without a key, you'll get FlopsAuthError. Public methods always work — the API key just unlocks higher rate-limit tiers when you have one.

Citation in code

When citing a FLOPS price in code, contracts, or research, ALWAYS include the methodology version (every response carries it under methodology_version):

tick = c.index_current("FLCI-H100")
print(f"Settled at ${tick['current_value']:.2f}/GPU-hr per "
      f"{tick['methodology_version']}")
# Settled at $2.45/GPU-hr per flci-h100@v0.9

The version is the contract anchor — partner replays + recompute audits pin against it.

Methods

Method Auth Returns
price(index_id) none latest tick
timeseries(id, range) none decimated points (≤200)
search(q) none NL → slug results
methodologies() none list of all methodologies
methodology(slug, version) none one methodology doc (markdown + JSON)
verify(id, value) none does the value match our tick?
catalog() partner full envelope w/ methodology_version
index_current(id) partner partner-tier per-index lookup
index_history(id) partner up to 720 historical ticks
compute_margin(...) partner derived: price − power − rack
recompute_audit(...) partner audit receipts (IOSCO substrate)

Naming conventions

  • FLCI-{model} — composite spot+OD+DePIN
  • FLOPS-{model}-{OD|SPOT|DEPIN} — single-tier specific
  • ITPI-{model_id}-{INPUT|OUTPUT} — inference token pricing
  • CLRI-{model}-{tenor} — forward / term rates (partner-tier only)

Use c.search() if you don't know the exact slug.

Errors

from flopsindex import Client, FlopsNotFoundError, FlopsAuthError

c = Client()
try:
    tick = c.price("FLCI-UNKNOWN")
except FlopsNotFoundError as e:
    print(f"index not found: {e.detail}")

Hierarchy: FlopsErrorFlopsAuthError / FlopsNotFoundError / FlopsRateLimitError / FlopsServerError. All errors carry .status_code and .detail.

Not the MCP server

flopsindex (this package) is a HTTP client SDK. The MCP server for AI agents is a separate package: pip install flopsindex-mcp. See https://github.com/zeroatflops/flopsindex-mcp for that one.

Methodology

Every published price is backed by a versioned methodology document. Citation hooks live at:

https://app.flopsindex.com/v1/methodology/{slug}/{version}

For example, https://app.flopsindex.com/v1/methodology/flci-h100/v0.9.

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

flopsindex-0.6.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flopsindex-0.6.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file flopsindex-0.6.0.tar.gz.

File metadata

  • Download URL: flopsindex-0.6.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for flopsindex-0.6.0.tar.gz
Algorithm Hash digest
SHA256 fa49046b2ad7dcd5846d55c177e44057042e33bd7036331891306c6534e21e41
MD5 3ec4b3acbfe636016d672431edeb4936
BLAKE2b-256 1cb87df8b4d900d2c974c050bdc640b6c094d76fb3d154c2b7dee9562d2bcf75

See more details on using hashes here.

File details

Details for the file flopsindex-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: flopsindex-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for flopsindex-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 462833d6a5ff03977b3c67fb9d0e26076dfb1de263255586d6406992b0a82223
MD5 8117a80467a9b8eb6919d1b3939d59de
BLAKE2b-256 308085417eb87edc12e134b85697d79ade35ba5fdf7010e245acf1534e72760c

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