@minia2a/langchain
v0.1.7
Published
LangChain tools for the minia2a.uk marketplace — discover, try, and pay for 1,680+ x402 APIs, and audit smart-contract source code ($2 static / $20 AI). USDC on Base.
Maintainers
Readme
@minia2a/langchain
The marketplace toolkit for LangChain agents — discover, try, and pay for 1,680+ x402 APIs across crypto, web, AI, and data, plus smart-contract auditing. USDC on Base.
Give your LangChain agent access to the entire minia2a.uk marketplace — live discovery, 5 free trial calls per wallet, and transparent per-call pricing.
Why This Toolkit
| Feature | Other API Tools | This Toolkit | |---------|----------------|-------------| | Services | Usually 1 API at a time | 1,600+ across categories | | Discovery | Hardcoded endpoints | Live marketplace search | | Free trials | Sometimes | 5 free trial calls per wallet | | New services | Wait for tool update | Available instantly | | Provider diversity | Single vendor | Dozens of providers | | Payment | API keys | USDC on Base, no KYC |
Install
npm install @minia2a/langchain zod @langchain/coreQuick Start
import { Minia2aToolkit } from "@minia2a/langchain";
import { ChatOpenAI } from "@langchain/openai";
import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";
// Create toolkit with auto-trial
const toolkit = new Minia2aToolkit({
config: {
autoTrial: true, // Use free trials automatically
maxPricePerCall: 0.10, // Max $0.10 per paid call
}
});
const llm = new ChatOpenAI({ model: "gpt-4o" });
const prompt = ChatPromptTemplate.fromMessages([
["system", "You are a helpful agent with access to the minia2a API marketplace. Use the tools to discover and call APIs for the user."],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
]);
const agent = await createOpenAIFunctionsAgent({
llm,
tools: toolkit.getTools(),
prompt,
});
const executor = new AgentExecutor({
agent,
tools: toolkit.getTools(),
verbose: true,
});
// Use it!
const result = await executor.invoke({
input: "Find an API that can tell me the current gas price on Ethereum and try it out"
});
console.log(result.output);Tools
| Tool | What it does | Example query |
|------|-------------|---------------|
| search_minia2a_apis | Search 1,680+ APIs by keyword | "Find APIs for web scraping" |
| call_minia2a_api | Call any endpoint with auto-trial | Call /x402/gas to get gas prices |
| list_popular_minia2a_apis | Browse trending services | "What APIs are most popular?" |
| audit_smart_contract | Audit contract source ($2 static / $20 AI) | "Audit this Solidity contract for reentrancy" |
search_minia2a_apis
// Search by keyword
await executor.invoke({ input: "Find crypto price APIs" });
// Search by category
await executor.invoke({ input: "What AI services are available?" });call_minia2a_api
// GET request with auto-trial
await executor.invoke({
input: "Call /x402/gas to check current Ethereum gas prices"
});
// POST request with body
await executor.invoke({
input: "Scrape https://example.com using the web-scrape endpoint"
});list_popular_minia2a_apis
// Browse trending
await executor.invoke({ input: "Show me the most popular APIs on minia2a" });audit_smart_contract
Give your agent the ability to audit Solidity, Rust, and Move source code — pay per call, no API keys.
// Requires a funded Base wallet in the environment:
// MINIA2A_PRIVATE_KEY=0x... (signs the x402 payment locally, never sent anywhere)
await executor.invoke({
input: "Audit this contract for vulnerabilities:\n\n" + contractSource
});
// The agent will call audit_smart_contract with tier 'static' ($2, 10 patterns)
// or tier 'ai' ($20, 3x-sampled deep audit) and act on the findings.Two tiers:
| Tier | Price | Coverage |
|------|-------|----------|
| static | $2 / call | 10 deterministic patterns (reentrancy, access-control, integer overflow, tx.origin, delegatecall, selfdestruct, block.timestamp, assert misuse, owner-change) — Solidity only |
| ai | $20 / call | 3×-sampled AI deep audit — business-logic, economic, and cross-contract flaws — Solidity, Rust, Move |
Honest limits: output is guidance for manual review, not proof of safety. The AI tier is probabilistic. The audit reads source code, not a deployed address.
Configuration
| Option | Default | Description |
|--------|---------|-------------|
| baseUrl | https://minia2a.uk | minia2a marketplace URL |
| autoTrial | true | Use free trials (5 free trial calls per wallet) |
| maxPricePerCall | 0 | Max USD per paid call (0 = trials only) |
| timeout | 15000 | Request timeout in ms |
x402 Payment Flow
- Agent requests endpoint → gets
HTTP 402 Payment Requiredwith price + wallet - Agent auto-signs USDC on Base (if
maxPricePerCall > 0and wallet configured) - Agent retries with signed transaction → receives result
- Receipt returned for audit trail
Default: trials only. Set maxPricePerCall > 0 and configure wallet for paid calls.
Categories
- 🤖 AI/LLM — text generation, classification, translation, summarization
- 🔗 Web — scraping, search, email verification, DNS, HTTP analysis
- 💰 Crypto — gas prices, wallet intel, token security, DEX data, Polymarket
- 🔐 Security — CAPTCHA solving, domain intel, SSL checks, OSINT
- 📊 Data — enrichment, validation, formatting, CSV/JSON conversion
- 🛠️ Dev Tools — code review, regex, UUID, hashing, JWT decode
Pricing
- Free trial: 5 free trial calls per signed wallet — no registration needed
- Paid calls: Priced per endpoint (typically $0.01–$0.10)
- Platform fee: 5% (transparent)
- Settlement: USDC on Base (
eip155:8453) — the only rail the gateway offers. Other chains are recognised but not settleable:/x402/chain/<other>/<id>answers400 unsupported chain.
LangGraph Integration
import { StateGraph, MessagesAnnotation } from "@langchain/langgraph";
import { ToolNode } from "@langchain/langgraph/prebuilt";
import { Minia2aToolkit } from "@minia2a/langchain";
const toolkit = new Minia2aToolkit();
const tools = toolkit.getTools();
const toolNode = new ToolNode(tools);
const graph = new StateGraph(MessagesAnnotation)
.addNode("agent", agentNode)
.addNode("tools", toolNode)
.addEdge("__start__", "agent")
.addConditionalEdges("agent", shouldContinue)
.addEdge("tools", "agent")
.compile();Companion Packages
- @minia2a/sdk — CLI for x402 developers
- @minia2a/elizaos-plugin-minia2a — ElizaOS plugin
- minia2a-mcp — MCP server for Claude/Cursor
- minia2a-audit — standalone audit CLI/library (powers
audit_smart_contract)
Related
- minia2a.uk — The marketplace (live stats at /api/stats)
- x402.org — The payment protocol
- LangChain Tools — LangChain tool docs
License
MIT
