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

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.1.0.tar.gz (14.1 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.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flopsindex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 85b0b00f1c77dedd61d2a9c342fde2d4d159492eb21a0d3e518ff999433d5518
MD5 65ad72d443b203ad01ae0c32617de86c
BLAKE2b-256 d299085869fafbf3b0727618d7127b51fcdbfdd14a81acddea4babe45c21eea3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flopsindex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 774646b721b4e4e1badb564f93d17fa0a7ca9058bf956967b697ef70af0e01fc
MD5 aff11dfdfb9a0b1186deeb52bb115721
BLAKE2b-256 3b7f8c1e6ac068f6e6058aecddf5049ec9b432bd835cfff496b02b63a1c1415f

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