New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

rwagenthub-sdk

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rwagenthub-sdk

JS SDK for AgentHub — call 32 AI APIs with automatic USDC payment on Base via x402

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

agenthub-sdk

JS SDK for AgentHub — call 24 AI APIs with automatic USDC micropayment on Base via the x402 protocol.

No subscriptions. No API keys. Your wallet pays per call.

Install

npm install rwagenthub-sdk

Requires Node ≥ 22. You'll need a wallet with USDC on Base Mainnet.

Usage

import { AgentHub } from "rwagenthub-sdk";

const hub = new AgentHub({ privateKey: process.env.WALLET_PRIVATE_KEY });

// Execute any API — payment handled automatically
const result = await hub.call("stock_quote", { symbol: "NVDA" });
console.log(result.price); // 134.20

// Check price before calling (free, no payment)
const { price_usd } = await hub.estimate("flight_search");
console.log(price_usd); // 0.01

// List all available APIs with prices (free)
const { apis } = await hub.listApis();

// Get JSON Schema for any API (free)
const schema = await hub.schema("weather_forecast");

Constructor

new AgentHub({ privateKey, gateway? })
OptionTypeRequiredDescription
privateKeystringyesPrivate key of a Base Mainnet wallet with USDC (0x...)
gatewaystringnoGateway base URL (defaults to the hosted instance)

Methods

hub.call(api, inputs) → Promise<object>

Calls an API and returns the data field directly. Payment is handled transparently via x402. Throws on payment failure or API error.

const weather = await hub.call("weather_forecast", { location: "Tokyo", days: 3 });
const flights = await hub.call("flight_search", { from: "JFK", to: "LAX", date: "2026-06-01" });
const prices  = await hub.call("crypto_price", { coins: "btc,eth,sol" });

hub.estimate(api) → Promise<{ success, api, price_usd }>

Returns the cost of an API call without executing it. Free — no payment required.

hub.listApis() → Promise<{ apis }>

Lists all 24 available APIs with their names and prices. Free.

hub.schema(api?) → Promise<object>

Returns the JSON Schema (inputs + outputs) for one API or all APIs. Free.

Available APIs

APIDescriptionPrice
flight_searchOne-way flight search$0.01
flight_statusReal-time flight status$0.01
seat_mapSeat map for a flight offer$0.01
airport_searchAirport lookup by name/IATA$0.01
hotel_searchHotels by city and dates$0.06
activities_searchTours and experiences by GPS$0.01
web_searchGoogle web/news search$0.02
web_search_aiAI-optimized semantic search$0.02
places_searchLocal businesses and POIs$0.02
image_searchGoogle image search$0.01
shopping_searchGoogle Shopping results$0.02
url_extractFetch URL as clean Markdown$0.02
weather_forecast15-day forecast via Visual Crossing$0.01
crypto_priceReal-time crypto prices$0.01
exchange_rateForex rates for 160+ currencies$0.01
defi_market_snapshotDeFi TVL, DEX volume, top protocols$0.02
defi_yieldsBest yield farming pools$0.02
stock_quoteReal-time stock quote$0.01
stock_profileCompany profile and market cap$0.01
stock_searchSymbol search by company name$0.01
market_newsFinancial news by symbol or category$0.01
earnings_calendarUpcoming earnings announcements$0.01
email_sendSend transactional email via Resend$0.01
code_execExecute code in isolated sandbox$0.05

Requirements

  • Node ≥ 22
  • Wallet with USDC on Base Mainnet
  • Bridge USDC to Base: bridge.base.org

License

MIT

Keywords

agenthub

FAQs

Package last updated on 03 Mar 2026

Related posts