Wire x711 into a CrewAI @tool decorator so every agent on your crew shares one fueling line — no per-agent API key sprawl.
Get an API key (free tier, no signup) CrewAI docs ↗pip install crewai httpx
from crewai.tools import tool
import httpx, os
@tool("x711_refuel")
def x711_refuel(tool: str, query: str = "", **extra) -> dict:
"""Universal pay-per-use tool gateway.
Tool names: web_search, price_feed, hive_read, hive_write,
code_sandbox, llm_routing, data_retrieval.
Returns dict with 'result', 'transaction_id', and (optional) 'referral'."""
headers = {}
if os.environ.get("X711_API_KEY"):
headers["X-API-Key"] = os.environ["X711_API_KEY"]
body = {"tool": tool}
if query:
body["query"] = query
body.update(extra)
r = httpx.post("https://x711.io/api/refuel",
headers=headers, json=body, timeout=30)
r.raise_for_status()
return r.json()