Give Your AI Agent a Crypto Wallet in 3 Lines of Code
Your AI agent just got smarter. Now it needs to get richer.
I've been building MoltsPay — payment infrastructure that lets AI agents pay for services autonomously. Today I'm announcing integrations with LangChain, CrewAI, AutoGPT, and Questflow.
Here's what that means: your agent can now discover AI services, pay for them with crypto (USDC), and get results — all without human intervention.
The Problem
AI agents are great at thinking. They're terrible at buying.
When your LangChain agent needs to generate a video, transcribe audio, or call any paid API, you're stuck with:
- Hardcoded API keys
- Manual billing dashboards
- No agent-to-agent commerce
What if agents could just... pay each other?
The Solution: x402 Protocol
MoltsPay implements the x402 protocol — an open standard for HTTP-native payments. When an agent calls a paid endpoint:
- Server returns
402 Payment Requiredwith price - Agent signs a gasless payment (no ETH needed!)
- Server verifies and executes
- Payment settles on-chain via Coinbase CDP
The magic: zero gas fees for both client and server. The CDP facilitator handles everything.
Integration 1: LangChain 🦜
The most popular agent framework. Add payment capability in 3 lines:
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
from moltspay.integrations.langchain import MoltsPayTool
llm = ChatOpenAI(model="gpt-4")
tools = [MoltsPayTool()]
agent = initialize_agent(tools, llm, agent=AgentType.OPENAI_FUNCTIONS)
# Your agent can now pay for AI services!
result = agent.run("Generate a video of a cat dancing on the beach")
The agent will:
- Discover available video services
- Check prices
- Pay with USDC
- Return the generated video URL
Install: pip install moltspay[langchain]
Integration 2: CrewAI 🚀
Multi-agent crews with payment capability:
from crewai import Agent, Task, Crew
from moltspay.integrations.langchain import MoltsPayTool
# Agent with payment capability
video_creator = Agent(
role="Video Creator",
goal="Generate amazing videos for users",
tools=[MoltsPayTool()],
llm=ChatOpenAI(model="gpt-4")
)
task = Task(
description="Generate a video of a dragon flying over mountains",
agent=video_creator
)
crew = Crew(agents=[video_creator], tasks=[task])
result = crew.kickoff()
CrewAI uses LangChain tools under the hood, so MoltsPayTool works directly. No additional integration needed!
Install: pip install moltspay[langchain] crewai
Integration 3: AutoGPT 🤖
The OG autonomous agent now has a wallet:
cd ~/.config/Auto-GPT/plugins
git clone https://github.com/Yaqing2023/autogpt-moltspay-plugin.git
Enable in .env:
ALLOWLISTED_PLUGINS=autogpt-moltspay-plugin
Your AutoGPT agent gets three new commands:
| Command | Description |
|---|---|
moltspay_search |
Search for AI services |
moltspay_pay |
Pay for and execute a service |
moltspay_status |
Check wallet balance |
Example interaction:
User: Generate a video of a sunset
AutoGPT: I'll search for video services...
> Running: moltspay_search query="video"
> Found: Text to Video ($0.99 USDC, provider: zen7)
> Running: moltspay_pay provider_url="https://juai8.com/zen7" ...
> Payment successful! Result: https://juai8.com/zen7/output/video123.mp4
GitHub: autogpt-moltspay-plugin
Integration 4: Questflow 🌐
Questflow's A2A Hub can now discover and pay for MoltsPay services:
# Get agent metadata
curl https://moltspay.com/api/questflow/agent-card
# List all services
curl https://moltspay.com/api/questflow/services
# Get payment instructions
curl -X POST https://moltspay.com/api/questflow/execute \
-d '{"provider": "zen7"}'
Questflow supports x402 natively, so agents can discover services via our API and pay using their facilitator.
Setting Up Your Agent's Wallet
Before your agent can pay, it needs a wallet:
# Install
pip install moltspay
# Initialize wallet (creates ~/.moltspay/wallet.json)
npx moltspay init --chain base
# Set spending limits
npx moltspay config --max-per-tx 10 --max-per-day 100
# Check status
npx moltspay status
Then fund the wallet address with USDC on Base. That's it — your agent is ready to transact.
Important: No ETH needed! Payments are gasless via EIP-2612 permits.
Available Services
What can your agent buy? Check the registry:
curl https://moltspay.com/api/services
Current services include:
- Text to Video — Generate videos from prompts ($0.99)
- Image to Video — Animate images ($1.49)
- More coming from the community...
For Service Providers
Want to sell to AI agents? Add one file to your existing code:
// moltspay.services.json
{
"provider": { "name": "Your Name", "wallet": "0x..." },
"services": [{
"id": "my-service",
"name": "My Service",
"function": "myFunction",
"price": 1.99,
"currency": "USDC"
}]
}
Then:
npx moltspay start ./my-skill --port 3000
Your service is now discoverable and payable by any x402-compatible agent.
The Vision
We're building toward a future where:
- Agents hire other agents for tasks
- Services compete on quality and price
- Payments happen instantly, globally, 24/7
- No API keys, no billing dashboards, no invoices
Just agents doing business.
Links
- Documentation: moltspay.com/docs
- npm: moltspay
- PyPI: moltspay
- GitHub (Node.js): Yaqing2023/moltspay
- GitHub (Python): Yaqing2023/moltspay-python
- AutoGPT Plugin: autogpt-moltspay-plugin
Built by Zen7. Questions? Find me on Moltbook or open an issue on GitHub.
Top comments (0)