@itzannetos/x402-tools
v1.0.6
Published
Developed and managed by [402box.io](https://402box.io) | Contact: [email protected]
Maintainers
Readme
X402 Tools Plugin
Developed and managed by 402box.io | Contact: [email protected]
An OpenCode AI plugin that provides payment-gated AI tools via the X402 payment protocol. This plugin enables real-time access to specialized AI agents for Twitter/X search and OSINT (Open Source Intelligence) research, with payments handled automatically through blockchain microtransactions.
Overview
X402 Tools integrates premium AI capabilities into OpenCode through a pay-per-use model. Each tool invocation triggers a micropayment on the Base blockchain, enabling access to advanced AI services without requiring subscriptions or API keys for the underlying services.
What is X402?
X402 is a payment protocol that enables micropayments for API calls using blockchain technology. When you use this plugin, each API request is automatically paid for using your Ethereum wallet on the Base network. This allows service providers to monetize their AI tools on a per-request basis.
Available Tools
Costs (Base, USDC):
x_searcher: 0.05 USDC per requestfind_people: 0.15 USDC per requestalpha_finder: 0.03 USDC per request
🔍 x_searcher
Price: 0.05 USDC per request
AI-powered X/Twitter search agent that provides real-time trends, news, and social media insights.
Use cases:
- Monitor trending topics and conversations
- Research public sentiment on specific topics
- Track breaking news and viral content
- Analyze social media discussions
- Discover influencer opinions and threads
Example queries:
- "Latest discussions about AI regulation"
- "Trending topics in cryptocurrency today"
- "What are people saying about the new iPhone?"
👤 find_people
Price: 0.15 USDC per request
Real-time Open Source Intelligence (OSINT) agent specialized in researching individuals and professional entities.
What it does:
- Identifies people by name, role, or company affiliation
- Retrieves verified career timelines and professional backgrounds
- Finds similar professionals in any industry or domain
- Synthesizes biographical information with source citations
- Validates identities across LinkedIn, company sites, and public records
Best for:
- Due diligence research on potential hires or partners
- Competitive intelligence on industry leaders
- Journalist & researcher background verification
- Sales prospecting and lead enrichment
- Investor research on startup founders and executives
Powered by: Neural and deep search capabilities that go beyond standard search engines to find hard-to-reach biographical details, executive profiles, and professional networks.
Output format: Returns structured summaries with key details (career, education, notable works) and numbered source citations for verification.
📊 alpha_finder
Price: 0.03 USDC per request
Market Oracle that searches the web, GitHub, Reddit, and X to gather intelligence on prediction market events.
Use cases:
- Evaluate Polymarket and Kalshi event outcomes
- Track market-moving narratives and rumors
- Compare sentiment across community sources
- Surface relevant links and sources fast
Example queries:
- "Polymarket odds on the 2026 US election"
- "Kalshi contract chatter around CPI release"
- "Narratives driving ETH ETF approval odds"
Prerequisites
Before installing this plugin, ensure you have:
- OpenCode - The AI coding assistant (https://opencode.ai)
- Bun - JavaScript runtime (https://bun.sh) - Required for local plugin development
- Ethereum Wallet - A private key with funds on the Base network
- Base Network ETH - Small amount of USDC on Base for payment transactions (NO gas needed)
Installation
Option 1: Install from npm (Recommended)
- Add the plugin to your
opencode.jsonconfiguration file:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@itzannetos/x402-tools"]
}- Create a configuration file at
.opencode/x402-tools.jsonwith your private key:
{
"private_key": "0x..."
}OR set it in .env at the project root (necessary on Windows):
X402_PRIVATE_KEY=0x...- Restart OpenCode to load the plugin.
Option 2: Local Development Installation
Clone or download this repository
Install dependencies for local plugins:
cd .opencode
bun install- Create
.opencode/x402-tools.jsonwith your private key:
{
"private_key": "0x..."
}OR set it in .env at the project root (necessary on Windows):
X402_PRIVATE_KEY=0x...- Restart OpenCode so the plugin is loaded from
.opencode/plugins/x402-tools.ts
Configuration
Private Key Setup
The plugin needs your Ethereum private key to sign payment transactions. The key is read in this order:
- First:
.opencode/x402-tools.jsonfile (preferred, keeps config local) - Fallback:
X402_PRIVATE_KEYenvironment variable in.envfile
Security Notes:
- Never commit your private key to version control
- The
.gitignoreis configured to exclude.opencode/x402-tools.jsonand.env - Only use wallets with small amounts of ETH for testing
- The private key must be for the Base network
Configuration File Format
.opencode/x402-tools.json:
{
"private_key": "0x1234567890abcdef..."
}The 0x prefix is optional - the plugin will add it automatically if missing.
Usage
Once installed, you can invoke the tools directly in OpenCode conversations:
Using X Searcher
Use the x_searcher tool to search for "AI breakthroughs in 2026"Search X for discussions about "climate change policy"Using Find People
Use the find_people tool to research "Jane Doe, head of AI at ExampleCorp"Find information about "Elon Musk, CEO of Tesla"Using Market Oracle
Use the alpha_finder tool to analyze "Polymarket odds on the next Fed rate decision"Analyze "Kalshi event chatter around the next CPI release"The AI will automatically use the appropriate tool, handle the payment, and return the results.
How It Works
Architecture
OpenCode → Plugin → X402 Payment Client → AI Service API
↓
Wallet (Base Chain)- Plugin Registration: When OpenCode starts, it loads the plugin and registers the tools
- Tool Invocation: When you request a tool, OpenCode calls the plugin's execute function
- Private Key Loading: The plugin reads your private key from config or environment
- Payment Client Setup: Creates a wallet client using viem on the Base blockchain
- Payment Interceptor: x402-axios wraps Axios to handle payment headers automatically
- API Request: Makes HTTP POST to the AI service endpoint with your query
- Payment Processing: The interceptor signs the payment transaction and includes it in the request
- Response: The service validates payment and returns the AI-generated response
Technical Details
- Base URL:
https://agents.402box.io - Endpoints:
/x_searcher- X/Twitter search agent/find_people- OSINT research agent/alpha_finder- Market Oracle for prediction market intelligence
- Timeout: 300 seconds (5 minutes) per request
- Blockchain: Base (Ethereum L2)
- Payment Protocol: X402 (blockchain-based micropayments)
Dependencies
@opencode-ai/plugin- OpenCode plugin SDKaxios- HTTP clientx402-axios- X402 payment interceptor for Axiosviem- Ethereum library for wallet and transaction signingdotenv- Environment variable management
Publishing and Updates
Publishing to npm
The package is published as @itzannetos/x402-tools on npm. To publish updates:
npm version patch # or minor, or major
npm publishVersion Management
- Use semantic versioning (semver) for releases
- Reference the package in
opencode.jsonusing a version range:"@itzannetos/x402-tools": "^1.0.0" - OpenCode installs npm plugins at startup and picks up compatible updates automatically
- Pin an exact version if you want to control upgrades manually
Troubleshooting
"X402 private key missing" Error
Problem: The plugin can't find your private key.
Solution:
- Ensure either
.opencode/x402-tools.jsonexists with a validprivate_keyfield - OR set
X402_PRIVATE_KEYin your.envfile - Verify the private key starts with
0xor let the plugin add it automatically
Payment Failures
Problem: Transactions are failing or timing out.
Solution:
- Ensure your wallet has sufficient USDC on the Base network
- Check Base network status (https://status.base.org)
- Verify your private key is valid
- Try with a smaller query first to test connectivity
"Unexpected response" Errors
Problem: API returns unexpected data format.
Solution:
- Check your internet connection
- Verify the API service is operational
- Ensure you're using the latest plugin version
- Check if the query format is valid
Plugin Not Loading
Problem: Tools don't appear in OpenCode.
Solution:
- Restart OpenCode after installation
- Check
opencode.jsonsyntax is valid JSON - For local development, verify
.opencode/plugins/x402-tools.tsexists - Check OpenCode logs for error messages
Development
Project Structure
x402-tools/
├── .opencode/
│ ├── plugins/
│ │ └── x402-tools.ts # Main plugin implementation
│ ├── package.json # Local plugin dependencies
│ └── x402-tools.json # Config file (gitignored)
├── index.ts # Package entry point
├── package.json # npm package metadata
├── README.md # This file
└── .gitignore # Git ignore rulesLocal Development Workflow
- Make changes to
.opencode/plugins/x402-tools.ts - Restart OpenCode to reload the plugin
- Test the tools in OpenCode conversations
- Commit changes (config files are gitignored automatically)
Security Considerations
- Private Keys: Never commit private keys to version control
- Wallet Security: Use a dedicated wallet with limited funds for API payments
- Network: Transactions occur on Base mainnet - be aware of gas costs
- API Trust: You're trusting the API provider (402box.io) to deliver services
- Code Review: Review the plugin code before using to understand what it does with your private key
License
Check the package repository for license information.
Coming Soon
We are actively adding more agents and tools in the coming days. Stay tuned for updates!
Add Your Own Agent
Want to add your own x402 agent to this package? Contact us at [email protected] to discuss integration.
Support
For issues, questions, or contributions:
- GitHub Issues: Report an issue
- Package: @itzannetos/x402-tools
Changelog
v1.0.0
- Initial release
- X Searcher tool for X/Twitter search
- Find People tool for OSINT research
- X402 payment integration
- Base network support
