mastra-gate402
v0.2.0
Published
Mastra tools for Gate402: pay-per-call GPU/CPU compute + open-model LLM inference, plus Base market data (token-risk, DEX, momentum, launches, best-swap, onchain), over x402 (USDC). No API keys — the agent pays the 402.
Maintainers
Readme
mastra-gate402
Mastra tools for Gate402 — pay-per-call GPU/CPU compute + open-model LLM inference, plus Base market data, over x402 (USDC). No vendor API keys: the agent pays the HTTP 402, and a free-tier key is auto-claimed on first use.
Install
npm install mastra-gate402Use
import { Agent } from '@mastra/core/agent';
import { gate402Tools } from 'mastra-gate402';
export const defiAgent = new Agent({
id: 'defi-agent',
name: 'DeFi Agent',
instructions: 'Vet Base tokens before acting: check risk, liquidity, and momentum.',
model: 'openai/gpt-5.5',
tools: { ...gate402Tools }
});Or import individual tools:
import { gate402TokenRisk, gate402Infer } from 'mastra-gate402';Tools
| Tool | What it does |
|---|---|
| gate402_compute | Rent metered GPU/CPU to run a container job, per-second; signed execution receipt |
| gate402_token_risk | Rug/tradeability verdict + live honeypot sim for a Base token |
| gate402_dex | Live DEX price / liquidity / 24h volume |
| gate402_momentum | Momentum + order-flow signal |
| gate402_best_swap | Best pool + estimated price impact for a trade size |
| gate402_onchain | Wallet/token intel (balances, EOA/contract, tx count) |
| gate402_launches | Freshest Base token launches |
| gate402_infer | Per-token open-model LLM inference (Llama 3.1 / Qwen / mistral-small) |
Config (optional)
| Env | Default | Purpose |
|---|---|---|
| GATE402_API_KEY | (auto free tier) | Funded Gate402 account key to skip the free tier |
| GATE402_BASE_URL | https://gate402.app | Override the gateway |
Each tool is a pay-per-call Gate402 endpoint settled over x402 (USDC on Base) — the payment is the auth. Full catalog: https://gate402.app/v1.
MIT.
