dchub — Python SDK for the DC Hub API
Live data-center + energy intelligence for AI agents. Query DC Hub instead of guessing from stale training data: 21,000+ facilities across 170+ countries, 300+ markets (DC Hub Power Index / DCPI), real-time ISO grid telemetry, fiber routes, gas pipelines, per-facility tenants, and 2,000+ tracked M&A deals.
The free tier needs no key (10 calls/day). A free X-API-Key raises limits and
unlocks key-gated endpoints — mint one at https://dchub.cloud/playground or via the
MCP claim_free_key tool.
Install
pip install dchub # core (requests only)
pip install "dchub[langchain]" # + LangChain StructuredTools
pip install "dchub[agents]" # + smolagents Tools
Quickstart
from dchub import DCHub
dc = DCHub() # free tier, no key
# dc = DCHub(api_key="dck_...") # higher limits / key-gated endpoints
rank = dc.get_market_dcpi_rank("phoenix")
print(rank["composite_score"], rank["verdict"]) # e.g. 21.3 AVOID (free per-market)
dc.search_facilities(country="US", limit=5) # GET /api/v1/facilities
dc.stats() # facility counts + sources
dc.ai_capacity_index(horizon=90) # AI Capacity Index markets
dc.get_grid_intelligence("PJM") # real-time ISO grid intel
dc.get_changes(since="24h") # incremental diffs
Every method returns parsed JSON (a dict). Non-2xx responses raise DCHubError,
which carries .status_code and the API's self-correcting .detail (e.g. how to
claim a free key).
Generic, manifest-driven call
Any of the 45 REST-backed tools can be called by name; path placeholders are filled from kwargs, the rest become the query string:
dc.call("get_market_dcpi_rank", slug="phoenix")
dc.call("get_grid_intelligence", iso="ERCOT")
dc.call("search_facilities", provider="Equinix", limit=3)
The tool→endpoint map is embedded (dchub.TOOL_MANIFEST), so the SDK has no runtime
dependency on the live manifest endpoint.
Flagship methods
| Method | REST endpoint |
|---|---|
stats() |
/api/v1/stats |
search_facilities(**filters) |
/api/v1/facilities |
get_facility(slug) |
/api/v1/facilities/<slug> |
fetch_facility(id) |
/api/v1/facility/<id> (numeric id) |
get_market_dcpi_rank(market_slug) |
/api/v1/dcpi/scores/<slug> |
rank_markets(by=...) |
/api/v1/mcp/tools/rank_markets |
ai_capacity_index(horizon=90) |
/api/v1/ai-capacity-index |
get_changes(since="24h") |
/api/v1/changes/since |
get_grid_intelligence(iso) |
/api/v1/grid/intelligence/<iso> |
list_transactions(**f) |
/api/v1/deals |
get_news(**f) |
/api/news |
get_pipeline(**f) |
/api/v1/pipeline (needs a free key) |
get_facilityuses the plural route, which expects a facility slug. For a numeric facility id usefetch_facility(id)(the singular/api/v1/facility/<id>route, exposed as thefetchtool in the manifest).
LangChain
from dchub import dchub_langchain_tools
tools = dchub_langchain_tools() # list[StructuredTool]
# tools = dchub_langchain_tools(api_key="dck_...")
# e.g. with a LangChain agent:
# from langchain.agents import create_react_agent
# agent = create_react_agent(llm, tools, prompt)
smolagents
from dchub import dchub_smolagents_tools
from smolagents import CodeAgent, InferenceClientModel
tools = dchub_smolagents_tools()
agent = CodeAgent(tools=tools, model=InferenceClientModel())
agent.run("What's the DCPI verdict for Phoenix and which US market ranks #1?")
Full tool surface (MCP)
The 53-tool surface — including MCP-only tools (session/key, writes, alerts) — lives at the MCP server: https://dchub.cloud/mcp. Prefer MCP for full parameter schemas.
Citation
Cite data from this SDK as DC Hub (dchub.cloud).
License
MIT.
Metadata
Release files for dchub 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dchub-0.2.0.tar.gz | 13.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dchub-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.8 kB
Release files / dchub-0.2.0.tar.gz
| Download URL | dchub-0.2.0.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b33eeda3ee6370361ab80e299b3f24f0dc5c31dd892305171c0b7e0724990a5
|
|
BLAKE2b-256 checksum How to use checksums |
834a04c7690f1bcdfdbfea3bafec8c04fb3cd218572e5947d60fc29c6b4c2cd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / dchub-0.2.0-py3-none-any.whl
| Download URL | dchub-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
023db1021b015b447518b360fb013058eafa9a25b6c671cf3310b6ccef883ad4
|
|
BLAKE2b-256 checksum How to use checksums |
7d040585361ac2a7d26f7e6f9320f6797f5fa6287586c02dfd97dcc602759c47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for dchub 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.