Skip to main content

Python SDK + LangChain/smolagents tools for the DC Hub data-center & energy intelligence API.

Project description

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_facility uses the plural route, which expects a facility slug. For a numeric facility id use fetch_facility(id) (the singular /api/v1/facility/<id> route, exposed as the fetch tool 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.

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

dchub-0.2.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

dchub-0.2.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file dchub-0.2.0.tar.gz.

File metadata

  • Download URL: dchub-0.2.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for dchub-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7b33eeda3ee6370361ab80e299b3f24f0dc5c31dd892305171c0b7e0724990a5
MD5 b35364c680b7bd48e0c8f5a9d7fce22c
BLAKE2b-256 834a04c7690f1bcdfdbfea3bafec8c04fb3cd218572e5947d60fc29c6b4c2cd0

See more details on using hashes here.

File details

Details for the file dchub-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dchub-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for dchub-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 023db1021b015b447518b360fb013058eafa9a25b6c671cf3310b6ccef883ad4
MD5 ac1265970eaf6aaa7ee8177ac015c343
BLAKE2b-256 7d040585361ac2a7d26f7e6f9320f6797f5fa6287586c02dfd97dcc602759c47

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