DEV Community

Tuf Ti
Tuf Ti

Posted on

pip install cinderwright -- give any Python AI agent access to 2,835 paid APIs

Managing API keys for AI agent tools is a solved problem. Here's how.

The standard workflow when your LangChain or CrewAI agent needs to call a paid service -- weather, crypto prices, translation, whatever -- is to sign up for an API account, get a key, add it to your environment variables, install the SDK, read the docs, handle rate limits, and repeat that for every service. It compounds fast.

I built Cinderwright to remove all of that.

What it is

A payment proxy. Your agent makes one call with one key and gets access to 2,835 indexed services. The proxy finds the right service, pays for it via Bitcoin Lightning or USDC on Base, and returns the result. No per-service keys, no subscriptions, no rate limit management.

pip install cinderwright
Enter fullscreen mode Exit fullscreen mode

Zero setup demo

import cinderwright

# No API key needed
print(cinderwright.demo("Bitcoin price"))
# "Bitcoin is $63,476 USD right now."

print(cinderwright.demo("weather in Tokyo"))
# "Tokyo: Partly Cloudy, 24C / 75F. Looks decent out there."
Enter fullscreen mode Exit fullscreen mode

With a free account

# Get a key with $0.10 free credit -- no deposit, no credit card
curl -X POST https://api.ideafactorylab.org/proxy/setup \
     -H "Content-Type: application/json" \
     -d '{"wallet": "your_base_wallet_address"}'
Enter fullscreen mode Exit fullscreen mode
from cinderwright import Cinderwright

cw = Cinderwright(api_key="sk_cw_...")

print(cw.ask("Bitcoin price"))
print(cw.ask("weather in Tokyo"))
print(cw.ask("translate good morning to Spanish"))
print(cw.ask("sentiment of: This is absolutely brilliant"))
print(cw.ask("summarize: [your text here]"))
Enter fullscreen mode Exit fullscreen mode

LangChain

from cinderwright.langchain import CinderwrightTool
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder

tool = CinderwrightTool(api_key="sk_cw_...")

llm = ChatOpenAI(model="gpt-4o-mini")
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant with access to real-time data."),
    ("human", "{input}"),
    MessagesPlaceholder("agent_scratchpad"),
])
agent = create_tool_calling_agent(llm, [tool], prompt)
executor = AgentExecutor(agent=agent, tools=[tool], verbose=True)

result = executor.invoke({"input": "What is the Bitcoin price and weather in Tokyo?"})
print(result["output"])
Enter fullscreen mode Exit fullscreen mode

LangGraph works too:

from langgraph.prebuilt import create_react_agent
agent = create_react_agent(llm, [tool])
Enter fullscreen mode Exit fullscreen mode

CrewAI

from cinderwright.crewai import CinderwrightTool
from crewai import Agent

tool = CinderwrightTool(api_key="sk_cw_...")

researcher = Agent(
    role="Research Analyst",
    goal="Find real-time information",
    tools=[tool],
)
Enter fullscreen mode Exit fullscreen mode

OpenAI Agents SDK, smolagents, Pydantic AI

# OpenAI Agents SDK
from cinderwright.openai_agents import make_cinderwright_tool
tool = make_cinderwright_tool(api_key="sk_cw_...")

# smolagents
from cinderwright.tools import CinderwrightSmolTool
tool = CinderwrightSmolTool(api_key="sk_cw_...")

# Any framework -- plain callable
from cinderwright.tools import make_tool_fn
fn = make_tool_fn(api_key="sk_cw_...")
Enter fullscreen mode Exit fullscreen mode

Fund with Lightning

If you want to fund your account with Bitcoin instead of USDC:

invoice = cw.deposit_lightning(amount_sats=5000)
print(invoice["payment_request"])  # lnbc50u...
# Pay it from any Lightning wallet
# Balance credited within 30 seconds
Enter fullscreen mode Exit fullscreen mode

What's in the index

2,835 services across crypto prices, weather, translation, summarization, sentiment, geocoding, news, domain lookups, and general AI. Browse at api.ideafactorylab.org/discover.

Colab notebook

Full working examples for every framework, including free demo cells that need no API key:

Open in Colab

Links

Top comments (0)