DEV Community

Alfred Zhang
Alfred Zhang

Posted on

How to Give Your AI Agent Access to 57 APIs in 3 Lines of Code

How to Give Your AI Agent Access to 57 APIs in 3 Lines of Code

Part of the httpay.xyz build series — permissionless infrastructure for autonomous AI agents.


The Problem Every Agent Builder Hits

You've got your ElizaOS agent running. Your Swarms workflow is orchestrating multiple LLMs. Your CrewAI crew is ready to research and act.

Then reality hits.

Your agent needs to check the weather. Simple, right? Except:

  1. Sign up at weather.gov or OpenWeatherMap
  2. Generate an API key
  3. Store it in .env
  4. Handle rate limits
  5. Write the fetch logic
  6. Hope it doesn't expire

Now multiply that by every data source your agent might need: crypto prices, GitHub repos, news headlines, Wikipedia summaries, Notion docs, Slack channels...

The average production agent needs 5–10 API integrations. Each one costs you 30–60 minutes of setup. And your agent still can't do any of this autonomously — it can't sign up for accounts, pass CAPTCHAs, or enter credit card numbers. You're doing all the credential management manually, upfront, for every API your agent might ever need.

This doesn't scale.


The Solution: One URL, 57 Services, Pay-Per-Call

We built httpay.xyz/api/gateway — a universal API gateway that gives your agent instant access to 57 services through a single URL pattern:

https://httpay.xyz/api/gateway/{service}/{path}
Enter fullscreen mode Exit fullscreen mode

Your agent pays $0.001 USDC per request via the x402 payment protocol. No accounts. No API keys for the services themselves. No upfront credential setup. Just send USDC and get data.

Why x402?

The x402 protocol lets HTTP servers request micropayments inline — the client pays, the server responds, all in a single round-trip. It's the native payment layer for autonomous agents: no human needs to be in the loop.

Previous articles in this series if you're new to x402:


3-Line Integration Examples

Python (requests) — Weather + Crypto Data

import requests

weather = requests.get("https://httpay.xyz/api/gateway/weather/points/40.7128,-74.0060").json()
btc = requests.get("https://httpay.xyz/api/gateway/coingecko/api/v3/simple/price?ids=bitcoin&vs_currencies=usd").json()
print(f"NYC Weather: {weather['properties']['forecast']} | BTC: ${btc['bitcoin']['usd']:,}")
Enter fullscreen mode Exit fullscreen mode

Demo mode: Add ?demo=true to either URL for a free test response — no wallet needed.

JavaScript (fetch) — GitHub + Wikipedia

const repo = await fetch("https://httpay.xyz/api/gateway/github/repos/elizaos/eliza").then(r => r.json());
const wiki = await fetch("https://httpay.xyz/api/gateway/wikipedia/api/rest_v1/page/summary/Autonomous_agent").then(r => r.json());
console.log(`ElizaOS: ${repo.stargazers_count}⭐ | Wiki: ${wiki.extract.slice(0,100)}...`);
Enter fullscreen mode Exit fullscreen mode

MCP Server — Use in Any Agent Framework

npx httpay-mcp
Enter fullscreen mode Exit fullscreen mode

The httpay MCP server exposes all 57 gateway services as MCP tools. Any agent that supports the Model Context Protocol can instantly call any of these APIs without additional configuration.


ElizaOS Integration

ElizaOS is the leading open-source AI agent operating system. We're building a native ElizaOS plugin for httpay — @elizaos/plugin-httpay — that will:

  • Register all 57 gateway services as ElizaOS actions
  • Handle x402 payment signing transparently using the agent's wallet
  • Enable natural language access: "What's the Bitcoin price?" → agent calls coingecko action → returns formatted data

Preview of what the plugin architecture looks like:

// @elizaos/plugin-httpay (coming soon)
import { httpayPlugin } from "@elizaos/plugin-httpay";

const agent = new AgentRuntime({
  plugins: [httpayPlugin],
  // Your agent's wallet private key handles x402 payments
  settings: {
    HTTPAY_WALLET_PRIVATE_KEY: process.env.AGENT_WALLET_KEY,
  },
});

// Now your agent can call any of 57 services via natural language
// "Check the weather in San Francisco" → weather action
// "Get Ethereum price" → coingecko action
// "Search GitHub for ElizaOS plugins" → github action
Enter fullscreen mode Exit fullscreen mode

Until the plugin ships, ElizaOS agents can use the gateway directly via the ACTIONS or custom providers:

// Custom ElizaOS action using the gateway
export const getWeatherAction: Action = {
  name: "GET_WEATHER",
  description: "Get weather for a location using httpay gateway",
  handler: async (runtime, message) => {
    // Extract location from message using NLP
    const coords = await geocodeLocation(message.content.text);
    const response = await fetch(
      `https://httpay.xyz/api/gateway/weather/points/${coords.lat},${coords.lon}`
    );
    return response.json();
  },
};
Enter fullscreen mode Exit fullscreen mode

Join the discussion — if you're building ElizaOS plugins and want early access to @elizaos/plugin-httpay, drop a comment below or reach out on the ElizaOS Discord.


Swarms Integration

Swarms enables multi-agent orchestration where specialized agents collaborate on complex tasks. The httpay gateway is a natural fit because different agents in a swarm can pull different data sources, all from one endpoint.

from swarms import Agent, SequentialWorkflow
import requests

# Research agent — pulls data from multiple sources
def research_tool(query: str) -> str:
    """Multi-source research using httpay gateway"""
    results = {}

    # Crypto data
    if "bitcoin" in query.lower() or "crypto" in query.lower():
        btc = requests.get(
            "https://httpay.xyz/api/gateway/coingecko/api/v3/simple/price"
            "?ids=bitcoin,ethereum&vs_currencies=usd,eur"
        ).json()
        results["crypto"] = btc

    # DeFi analytics
    if "defi" in query.lower() or "tvl" in query.lower():
        defi = requests.get(
            "https://httpay.xyz/api/gateway/defillama/api/protocols"
        ).json()
        results["defi_protocols"] = defi[:5]  # Top 5 by TVL

    # GitHub activity
    if "github" in query.lower() or "code" in query.lower():
        repos = requests.get(
            "https://httpay.xyz/api/gateway/github/search/repositories"
            "?q=ai+agents&sort=stars&order=desc&per_page=5"
        ).json()
        results["repos"] = repos.get("items", [])

    return str(results)

# Monitoring agent — checks news + blockchain
def monitor_tool(topic: str) -> str:
    """Real-time monitoring using httpay gateway"""
    news = requests.get(
        f"https://httpay.xyz/api/gateway/newsapi/v2/everything"
        f"?q={topic}&sortBy=publishedAt&pageSize=5"
    ).json()

    # Check on-chain activity via Etherscan
    eth = requests.get(
        "https://httpay.xyz/api/gateway/etherscan/api"
        "?module=stats&action=ethsupply"
    ).json()

    return f"News: {len(news.get('articles', []))} articles | ETH Supply: {eth.get('result', 'N/A')}"

# Build the swarm
research_agent = Agent(
    agent_name="ResearchAgent",
    system_prompt="You are a research specialist. Use tools to gather data.",
    tools=[research_tool],
)

monitor_agent = Agent(
    agent_name="MonitorAgent", 
    system_prompt="You monitor markets and news. Use tools to get real-time data.",
    tools=[monitor_tool],
)

# Sequential workflow: research → monitor → synthesize
workflow = SequentialWorkflow(
    agents=[research_agent, monitor_agent],
    max_loops=1,
)

result = workflow.run("Analyze the current AI agent ecosystem: GitHub activity, DeFi TVL, and latest news")
print(result)
Enter fullscreen mode Exit fullscreen mode

The key insight for Swarms: Instead of each agent needing its own API key configuration, the entire swarm accesses 57 data sources through one gateway URL. No credential management per agent.


All 57 Services

Category Service Description Price/call
AI/ML openai OpenAI API $0.005
anthropic Anthropic Claude API $0.005
gemini Google Gemini API $0.005
openrouter OpenRouter API $0.003
groq Groq LLM API (fast inference) $0.003
replicate Replicate AI API $0.005
togetherai Together AI API $0.005
perplexity Perplexity AI API $0.005
mistral Mistral AI API $0.005
huggingface Hugging Face Hub API $0.001
Blockchain eth-ankr Ethereum RPC (Ankr) $0.001
eth-cloudflare Ethereum RPC (Cloudflare) $0.001
eth-publicnode Ethereum RPC (PublicNode) $0.001
eth-base Base chain RPC $0.001
eth-optimism Optimism RPC $0.001
eth-arbitrum Arbitrum RPC $0.001
eth-polygon Polygon RPC $0.001
etherscan Etherscan blockchain explorer $0.001
basescan BaseScan Base chain explorer $0.001
thegraph The Graph decentralized indexing $0.002
alchemy Alchemy blockchain API $0.002
infura Infura Ethereum API $0.002
Crypto Data coingecko CoinGecko crypto prices $0.001
coinmarketcap CoinMarketCap data $0.002
defillama DefiLlama DeFi analytics $0.001
dune Dune Analytics $0.005
Developer Tools github GitHub REST API $0.001
gitlab GitLab API $0.001
vercel Vercel API $0.001
postman Postman API $0.001
Cloud cloudflare Cloudflare API $0.002
digitalocean DigitalOcean API $0.002
flyio Fly.io Machines API $0.001
render Render API $0.001
Communication discord Discord HTTP API $0.001
slack Slack Web API $0.001
twilio Twilio REST API $0.002
Email resend Resend email API $0.001
sendgrid SendGrid email delivery $0.001
Data weather US Weather (NWS) API $0.001
wikipedia Wikimedia REST API $0.001
newsapi NewsAPI news aggregator $0.001
Database supabase Supabase API $0.001
turso Turso Platform API $0.001
neon Neon serverless Postgres API $0.001
Productivity notion Notion API $0.001
asana Asana API $0.001
jira Jira Cloud API $0.001
Monitoring sentry Sentry error tracking $0.001
datadog Datadog metrics/logs $0.002
DevOps pagerduty PagerDuty incident management $0.001
circleci CircleCI CI/CD API $0.001
Payments stripe Stripe payments API $0.002
Storage pinata Pinata IPFS pinning $0.001
Media spotify Spotify Web API $0.001
Geospatial mapbox Mapbox maps & location $0.001
Demo petstore Swagger Petstore (testing) $0.001

307 total proxied endpoints across all 57 services.


Demo Mode — Free Testing, No Wallet

Not ready to set up x402 payments? Every gateway endpoint supports a free demo mode:

# Free demo — returns sample data, no payment required
curl "https://httpay.xyz/api/gateway/coingecko/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&demo=true"

curl "https://httpay.xyz/api/gateway/github/repos/elizaos/eliza?demo=true"

curl "https://httpay.xyz/api/gateway/weather/points/37.7749,-122.4194?demo=true"
Enter fullscreen mode Exit fullscreen mode

Demo mode returns realistic sample data so you can test your integration end-to-end before setting up a wallet. Perfect for CI/CD pipelines and development.


Why This Matters for Agent Builders

The core insight: API access is a solved problem for humans, but a hard problem for agents.

Humans can:

  • Sign up for accounts
  • Manage API keys in a password manager
  • Re-authenticate when tokens expire
  • Accept ToS agreements

Agents can't do any of this. So the traditional API model requires a human to pre-provision every credential the agent might ever need.

The httpay gateway inverts this. Agents pay for what they use, when they use it — exactly the same model as electricity or compute. No upfront setup. No human in the loop for credential management.

For ElizaOS and Swarms specifically:

  • ElizaOS agents become capable out of the box — the plugin provides 57 data sources as first-class actions
  • Swarms multi-agent workflows can have each agent fetch exactly the data it needs without a configuration explosion

What's Next

  • 🔌 @elizaos/plugin-httpay — native ElizaOS plugin (in progress, star the repo for updates)
  • 🌐 More services — community votes on what gets added next
  • Streaming responses — real-time data streams for monitoring agents
  • 🔗 LangChain toolHttpayTool for LangChain agents

Try it now:

Questions? Drop them in the comments — especially if you're building with ElizaOS or Swarms and want to share your use case.


Built with x402 — the payment protocol for autonomous agents.

Top comments (0)