Hive Intelligence

SDKs

Python Integration

Use Hive from scripts, notebooks, workers, and backend services with requests.


Installation

pip install requests

Quick Start

import os
import requests

BASE_URL = "https://mcp.hiveintelligence.xyz"
API_KEY = os.environ["HIVE_API_KEY"]

def execute(tool: str, args: dict | None = None) -> dict:
    response = requests.post(
        f"{BASE_URL}/api/v1/execute",
        headers={"x-api-key": API_KEY},
        json={"tool": tool, "args": args or {}},
        timeout=30,
    )
    response.raise_for_status()
    return response.json()

price = execute("get_price", {
    "ids": "bitcoin",
    "vs_currencies": "usd",
})

print(price["bitcoin"]["usd"])

Reusable Client

from __future__ import annotations

import requests


class HiveClient:
    def __init__(self, api_key: str, base_url: str = "https://mcp.hiveintelligence.xyz") -> None:
        self.base_url = base_url
        self.session = requests.Session()
        self.session.headers.update({"x-api-key": api_key})

    def execute(self, tool: str, args: dict | None = None) -> dict:
        response = self.session.post(
            f"{self.base_url}/api/v1/execute",
            json={"tool": tool, "args": args or {}},
            timeout=30,
        )
        response.raise_for_status()
        return response.json()

    def list_tools(self, limit: int = 50) -> dict:
        response = self.session.get(
            f"{self.base_url}/api/v1/tools",
            params={"limit": limit},
            timeout=30,
        )
        response.raise_for_status()
        return response.json()


client = HiveClient(api_key="YOUR_HIVE_API_KEY")

market = client.execute("get_coins_market_data", {
    "vs_currency": "usd",
    "order": "market_cap_desc",
    "per_page": 5,
})

wallet = client.execute("moralis_get_wallet_net_worth", {
    "address": "0x1234...",
    "chain": "eth",
})

Common Patterns

Security review

security = client.execute("get_token_security", {
    "contract_addresses": "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
    "chain_id": "1",
})

DeFi analytics

pools = client.execute("get_yield_pools", {
    "chain": "ethereum",
})

Wallet intelligence

positions = client.execute("moralis_get_wallet_defi_positions", {
    "address": "0x1234...",
    "chain": "eth",
})

Prediction markets

markets = client.execute("codex_prediction_markets", {
    "networkId": 1,
})

Notes

  • The current REST payload keys are tool and args.
  • Tool schemas are available from GET /api/v1/tools.
  • Older docs using toolName and arguments are legacy and should not be copied into new integrations.

Previous
SDK Overview