x711 / learn / DSPy

x711 + DSPy

Use x711 as a DSPy ReAct module so your compiled programs can call live tools — web search, price feeds, hive memory — without breaking the DSPy optimization loop.

Get an API key (free tier, no signup) DSPy docs ↗

Install

pip install dspy-ai httpx

Drop-in tool

import dspy, httpx, os

class X711Tool(dspy.Tool):
    """Universal pay-per-use tool gateway — 47 tools, one endpoint.
    
    Free (no key): web_search(query), price_feed(query), hive_read(query)
    Paid (cents/call): agent_see(url=$0.03), deep_search(query=$0.05)
    Get a free key: POST https://x711.io/api/onboard
    """
    name = "x711"
    input_variable = "tool_call"  # JSON string: {"tool": "web_search", "query": "..."}

    def __call__(self, tool_call: str) -> str:
        import json
        try:
            body = json.loads(tool_call)
        except Exception:
            body = {"tool": "web_search", "query": tool_call}
        headers: dict = {"Content-Type": "application/json"}
        if os.environ.get("X711_API_KEY"):
            headers["X-API-Key"] = os.environ["X711_API_KEY"]
        r = httpx.post("https://x711.io/api/refuel", headers=headers, json=body, timeout=30)
        r.raise_for_status()
        data = r.json()
        return str(data.get("result", data))

lm = dspy.LM("openai/gpt-4o")
dspy.configure(lm=lm)

react = dspy.ReAct("question -> answer", tools=[X711Tool()])
result = react(question="What is the current ETH price and recent news?")
print(result.answer)

Why pair x711 with DSPy?

Verify it's real

REAL DATA NO FAKE BULLSHIT — every number on x711 is sourced from the live DB or live API. Built by Criptic · live pricing · agents.txt · changelog · status