@zeromodern/eliza-plugin-0mod
v2.0.1
Published
ElizaOS plugin that exposes 0mod API Gateway tools as Eliza actions
Maintainers
Readme
@zeromodern/eliza-plugin-0mod
ElizaOS plugin that exposes 0mod API Gateway edge tools as Eliza bot actions. HTTP 402 micropayments on Base EVM are handled automatically.
Wallet & Network Prerequisites
0mod gateway utilities use x402 HTTP 402 micropayments on Base EVM:
- Network: Base Mainnet (
eip155:8453) - Asset: USDC on Base
- Environment Variable:
PAYER_PRIVATE_KEY=0x...(orEVM_PRIVATE_KEY/X402_PRIVATE_KEY)
When PAYER_PRIVATE_KEY is present in your bot's environment, actions transparently sign payment authorizations and execute with zero manual intervention.
Requirements
- Node.js >= 18
- npm >= 9
Install
npm install @zeromodern/eliza-plugin-0modSetup & Usage
1. Register Plugin in Eliza Character Config
Add the plugin to your ElizaOS character JSON file:
{
"name": "MyAgent",
"plugins": ["@zeromodern/eliza-plugin-0mod"]
}2. Environment Configuration
Set your wallet private key in your .env file:
PAYER_PRIVATE_KEY=0x_your_private_key_here3. Programmatic Usage Example
import { zeroModPlugin, domainCheckAction } from "@zeromodern/eliza-plugin-0mod";
// The plugin automatically handles x402 payment signing when PAYER_PRIVATE_KEY is set in process.env
const result = await domainCheckAction.handler(
runtime,
{ content: { text: "check domain example.com" } },
state,
options,
(response) => {
console.log("Domain Check Output:", response.text);
}
);Practical Real-World Example: Autonomous DeFi Swap Guard ($1k/mo Execution Feed Alternative)
DeFi agents executing swaps on Base (Aerodrome, Uniswap) are vulnerable to toxic price divergence and MEV sandwiching. Traditional institutional execution protection feeds cost $1,000+/month.
Using @zeromodern/eliza-plugin-0mod, an agent can inspect live CEX-DEX spread candles and dislocation ticks via dynamic HTTP 402 micropayments on Base (see api.0mod.com for live pricing) prior to execution, halting or adjusting limit orders if adverse spread conditions are active.
See examples/dislocation_swap_guard.ts for the full runnable script.
Available Actions
💡 Pricing: For live per-call pricing and endpoint status across all actions, visit api.0mod.com or fetch
https://api.0mod.com/api/v1/discovery.
| Action Name | Description | Price | Input Payload Example |
| :--- | :--- | :--- | :--- |
| STEALTH_DOM_FETCH | Headless web page fetch from Cloudflare edge | dynamic | { "text": "https://example.com" } |
| AIRGAP_PII_SCRUB | Redact SSN, phone, email, ZIP via Workers AI | dynamic | { "text": "Call me at 555-0199" } |
| DOMAIN_CHECK | Query RDAP registry for domain availability | dynamic | { "text": "example.com" } |
| DEX_PRICE_SUMMARY | Real-time DEX token price, volume, liquidity | dynamic | { "text": "USDC" } |
| IMAGE_OCR_SHRINK | Vision OCR text and table extraction | dynamic | { "text": "https://..." } |
| CRYPTO_COVERAGE | Check data coverage, supported pairs, and date boundaries | dynamic | { "text": "coverage for AERO/USD" } |
| CRYPTO_SPREAD_CANDLES | Fetch cross-venue CEX-DEX spread candles (OHLC) | dynamic | { "text": "spread candles AERO/USD 2026-09-14" } |
| CRYPTO_DISLOCATIONS | Fetch cross-venue market dislocation and spread arbitrage events | dynamic | { "text": "dislocations AERO/USD 2026-09-14" } |
| CRYPTO_EXECUTION_LATENCY | Benchmark cross-venue execution speed, venue latencies, and fill rates | dynamic | { "text": "latency benchmarks 2026-09-14" } |
| CRYPTO_IMPACT_SIMULATION | Pre-trade impact sim vs LIVE L2 book (VWAP, slippage, fill probability) | $0.075/call | { "text": "simulate buy $25000 impact on AERO/USD" } |
ℹ️ Prices are set dynamically by the gateway's HTTP 402 challenge. Every action above maps 1:1 to a live
/api/v1/*route in the gateway discovery document. All prices are per HTTP 402 micropayment and are settled automatically whenPAYER_PRIVATE_KEYis set.
Usage Example: CRYPTO_IMPACT_SIMULATION
Pre-flight every swap: ask the gateway what a hypothetical order would actually do to the live L2 book before touching custody. executable: false (or a low fill_ratio) means the order would sweep too deep and should be resized.
import { zeroModPlugin } from "@zeromodern/eliza-plugin-0mod";
const action = zeroModPlugin.actions.find(a => a.name === "CRYPTO_IMPACT_SIMULATION")!;
// "buy" + "$25000" are parsed into { side: "buy", size_usd: 25000 } by the action's handler.
await action.handler(
{},
{ content: { text: "simulate buy $25000 impact on AERO/USD" } },
undefined,
undefined,
(response: any) => {
const sim = JSON.parse(response.text);
console.log(`VWAP ${sim.expected_fill_price} · slippage ${sim.slippage_bps} bps · fill ratio ${sim.fill_ratio}`);
if (!sim.executable || sim.fill_ratio < 0.9) {
throw new Error(`Order too large: only ${sim.fillable_size_usd} USD fillable. Resize before executing.`);
}
}
);Ecosystem Packages
- 🤖 MCP Server (Any AI Agent):
@zeromodern/mcp-server-0mod - 🟣 ElizaOS Plugin:
@zeromodern/eliza-plugin-0mod - 🔵 Coinbase AgentKit Provider:
@zeromodern/agentkit-provider-0mod - ⚡️ Live Gateway Service: api.0mod.com
Troubleshooting
- Actions not loading: Verify the plugin string matches exactly:
"@zeromodern/eliza-plugin-0mod"in your character config. - Payment / Auth errors: Ensure
PAYER_PRIVATE_KEYis set with a valid Base EVM private key holding a USDC balance for x402 micropayments.
Release Process
Releases are cut manually by the owner via a GitHub Release. Creating the
Release publishes to npm; the owner chooses the major/minor/patch bump. Pushing
to master does not publish or create tags.
npm version major|minor|patch(updatespackage.json/package-lock.json, creates thevX.Y.Zcommit + tag).git push origin master --follow-tags.- Create a GitHub Release on the matching
vX.Y.Ztag. .github/workflows/publish.ymlverifies the tag matchespackage.jsonand runsnpm publish --access public --provenanceexactly once.
See RELEASING.md for full details, including the required
NPM_TOKEN GitHub secret.
License
MIT
