Documentation
250 AI tools, custom agent builder, scheduling, and 15 AI models — all in one API.
Overview
AiPayGen is the most comprehensive AI toolkit for developers and agents. Build custom AI agents, access 250 tools, 2200+ skills, and 4100+ APIs — all through a single API key or MCP connection.
Quick Start
Option 1: API Key (Recommended)
import httpx
BASE = "https://api.aipaygen.com"
# 1. Buy an API key
key = httpx.post(f"{BASE}/credits/buy",
json={"amount_usd": 5.0}).json()["key"] # apk_xxx
# 2. Use it on any endpoint
result = httpx.post(f"{BASE}/research",
json={"topic": "quantum computing"},
headers={"Authorization": f"Bearer {key}"}
).json()
print(result)
Option 2: MCP (Claude / Cursor)
# Install
pip install aipaygen-mcp
# Add to Claude Code
claude mcp add aipaygen -- aipaygen-mcp
# Or connect remotely (no install needed)
# URL: https://mcp.aipaygen.com/mcp
Option 3: Free Preview
# No payment or key needed
curl -X POST https://api.aipaygen.com/preview \
-H "Content-Type: application/json" \
-d '{"topic": "AI agents"}'
Payment Options
| Method | How | Best For |
|---|---|---|
| API Key | POST /credits/buy with Stripe | Most users — simple, prepaid credits |
| x402 USDC | HTTP 402 + X-Payment header | Crypto-native agents, no accounts |
| MCP | pip install aipaygen-mcp | Claude/Cursor — 3 free/day, unlimited with key |
Build Your Own Agent NEW
Create custom AI agents with their own personality, tools, model, memory, and scheduling — all through the API or the visual builder.
# Create a crypto monitoring agent
agent = httpx.post(f"{BASE}/agents/build",
json={
"name": "Crypto Watcher",
"system_prompt": "Monitor crypto prices and alert on big moves",
"tools": ["get_crypto_prices", "analyze", "memory_store"],
"model": "claude-haiku",
"schedule": {"type": "loop", "config": {"minutes": 30}}
},
headers={"Authorization": f"Bearer {key}"}
).json()
agent_id = agent["agent_id"]
# Run the agent
result = httpx.post(f"{BASE}/agents/custom/{agent_id}/run",
json={"task": "Check BTC and ETH prices, analyze trends"},
headers={"Authorization": f"Bearer {key}"}
).json()
Agent Templates
Start from a pre-built template and customize. 10 templates available:
- Research Agent — web search + summarize + scraping
- Crypto Tracker — price monitoring on a 30-min loop
- Content Writer — blog posts, social media, copywriting
- Customer Support — Q&A with sentiment detection
- Social Media Manager — daily posts + platform monitoring
- Code Helper — code generation + testing
- Data Analyst — data analysis + SQL + charts
- News Monitor — hourly news briefings
- Personal Assistant — planning + email + memory
- Sales Bot — lead scoring + outreach
Scheduling & Automation
Agents can run automatically on three trigger types:
Loop (Interval)
httpx.post(f"{BASE}/agents/custom/{agent_id}/schedule",
json={"type": "loop", "config": {"minutes": 30}},
headers={"Authorization": f"Bearer {key}"})
Cron (Schedule)
httpx.post(f"{BASE}/agents/custom/{agent_id}/schedule",
json={"type": "cron", "config": {"hour": 9, "minute": 0, "day_of_week": "mon-fri"}},
headers={"Authorization": f"Bearer {key}"})
Event (Trigger)
httpx.post(f"{BASE}/agents/custom/{agent_id}/schedule",
json={"type": "event", "config": {"trigger": "message"}},
headers={"Authorization": f"Bearer {key}"})
AI Tools
40+ AI-powered endpoints. All accept an optional model parameter.
Plus: /rewrite, /extract, /qa, /compare, /outline, /explain, /proofread, /keywords, /headline, /social, /pitch, /diagram, /json_schema, /workflow, /pipeline, /batch, /chain, /test_cases, /sql, /regex, /mock, /debate, /decide, /plan, /score, /tag, /fact, /questions, /email, /enrich
Data Lookups
Web Scraping
Agent System
Agent Memory
Persistent key-value memory for agents across conversations.
Skills Library
2200+ searchable, executable skills. Create your own or use community skills.
API Catalog
4100+ indexed APIs — search, discover, and invoke third-party APIs through AiPayGen.
MCP Integration
All 250 tools are available as MCP tools. Three ways to connect:
1. PyPI Package (Recommended)
# Install
pip install aipaygen-mcp
# Add to Claude Code
claude mcp add aipaygen -- aipaygen-mcp
# Add to Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"aipaygen": {
"command": "aipaygen-mcp",
"env": { "AIPAYGEN_API_KEY": "apk_xxx" }
}
}
}
2. Remote SSE (No Install)
# Connect directly — works in any MCP client
URL: https://mcp.aipaygen.com/mcp
3. MCP Registry
# Listed on registry.modelcontextprotocol.io
# ID: io.github.Damien829/aipaygen
Available Models
| Model | Provider | Best For |
|---|---|---|
| auto | AiPayGen | Automatic — picks best model for the task |
| claude-sonnet | Anthropic | Complex reasoning, analysis |
| claude-haiku | Anthropic | Fast, cheap, good enough for most tasks |
| gpt-4o | OpenAI | General purpose, strong coding |
| gpt-4o-mini | OpenAI | Fast and cheap |
| deepseek-chat | DeepSeek | Coding, technical tasks |
| deepseek-reasoner | DeepSeek | Complex reasoning chains |
| gemini-2.0-flash | Fast, multimodal | |
| grok-3-mini | xAI | Real-time knowledge |
| mistral-small | Mistral | Efficient, multilingual |
| llama-4-scout | Meta | Open-weight, fast |
# Use any model on any endpoint
httpx.post(f"{BASE}/research",
json={"topic": "AI", "model": "deepseek-chat"},
headers={"Authorization": f"Bearer {key}"})
Discovery Endpoints
/discover— machine-readable service catalog (JSON)/.well-known/agent.json— A2A Agent Card/openapi.json— OpenAPI 3.1 spec/llms.txt— LLMs.txt format/builder/templates— Agent templates
Free Endpoints
No payment or API key needed:
Integration Examples
LangChain
from langchain.tools import Tool
import httpx
def aipaygen_research(query: str) -> str:
r = httpx.post("https://api.aipaygen.com/research",
json={"topic": query},
headers={"Authorization": "Bearer apk_xxx"})
return r.json().get("summary", r.text)
research_tool = Tool(
name="AiPayGen Research",
func=aipaygen_research,
description="Research any topic with AI"
)
Python (httpx)
import httpx
BASE = "https://api.aipaygen.com"
KEY = "apk_xxx"
headers = {"Authorization": f"Bearer {KEY}"}
# Chain: research → summarize → translate
research = httpx.post(f"{BASE}/research", json={"topic": "quantum computing"}, headers=headers).json()
summary = httpx.post(f"{BASE}/summarize", json={"text": research["summary"]}, headers=headers).json()
translated = httpx.post(f"{BASE}/translate", json={"text": summary["summary"], "language": "Spanish"}, headers=headers).json()
curl
curl -X POST https://api.aipaygen.com/research \
-H "Content-Type: application/json" \
-H "Authorization: Bearer apk_xxx" \
-d '{"topic": "x402 protocol"}'
Payment Details
- Protocol: x402 (HTTP 402 Payment Required)
- Network: Base Mainnet (eip155:8453)
- Token: USDC (6 decimals)
- Wallet:
0x366D488a48de1B2773F3a21F1A6972715056Cb30 - Bulk discount: 20% when balance >= $2.00
Error Codes Reference
All error responses follow a consistent JSON format with an error field and optional helper fields.
400 — Bad Request
Missing or invalid parameters in your request body.
{
"error": "Missing required field: text",
"hint": "Include a 'text' field in your JSON body",
"docs": "https://aipaygen.com/docs#ai-tools"
}
How to fix: Check the endpoint documentation for required fields. Ensure your Content-Type is application/json and the request body is valid JSON.
401 — Unauthorized
Missing or invalid API key.
{
"error": "API key required",
"hint": "Pass Authorization: Bearer apk_..."
}
How to fix: Include your API key in the Authorization header as Bearer apk_xxx. Generate a key at /buy-credits or via POST /auth/generate-key.
402 — Payment Required
Insufficient balance on your API key, or the endpoint requires x402 payment.
{
"error": "Insufficient balance",
"balance_usd": 0.001,
"cost_usd": 0.01,
"top_up_url": "https://aipaygen.com/buy-credits",
"x402": {
"pay_to": "0x366D488a48de1B2773F3a21F1A6972715056Cb30",
"network": "eip155:8453",
"accepts": "USDC"
}
}
How to fix: Top up your balance at /buy-credits or via POST /auth/topup. Alternatively, pay per-call using the x402 protocol with a USDC payment in the X-Payment header.
403 — Forbidden
The endpoint requires a paid API key. Free tier does not include premium tools (research, vision, scrapers).
{
"error": "Premium tool requires API key",
"hint": "Get an API key at https://aipaygen.com/buy-credits",
"upgrade_url": "https://aipaygen.com/buy-credits"
}
How to fix: Purchase an API key. Premium tools like /research, /vision, and all /scrape/* endpoints are not available on the free tier.
404 — Not Found
The requested endpoint does not exist.
{
"error": "Not found",
"suggestion": "Did you mean /sentiment?",
"docs": "https://aipaygen.com/discover"
}
How to fix: Check the endpoint path. Browse all available endpoints at /discover. Common typos are auto-corrected when possible.
405 — Method Not Allowed
Wrong HTTP method for this endpoint (e.g., GET on a POST-only endpoint).
{
"error": "Method not allowed. Use POST.",
"docs": "https://aipaygen.com/docs"
}
How to fix: Check the endpoint method in the service catalog. AI tool endpoints use POST; data lookups typically use GET.
415 — Unsupported Media Type
Request body is not valid JSON or the Content-Type header is missing.
{
"error": "Content-Type must be application/json",
"hint": "Add header: Content-Type: application/json"
}
How to fix: Set Content-Type: application/json in your request headers and ensure the body is valid JSON.
429 — Rate Limited
Too many requests. Free tier: 3 calls/day. Paid tier: 60 calls/minute.
{
"error": "Rate limit exceeded",
"retry_after": 60,
"limit": "3/day",
"reset_at": "2026-03-17T00:00:00Z",
"upgrade_url": "https://aipaygen.com/buy-credits"
}
How to fix: Wait for the retry_after period (in seconds). Check the Retry-After response header. To increase limits, upgrade to a paid API key.
500 — Internal Server Error
An unexpected error occurred on our side. Includes a request_id for support.
{
"error": "Internal server error",
"request_id": "req_a1b2c3d4",
"status": "https://aipaygen.com/status",
"support": "Include request_id when contacting support"
}
How to fix: Retry the request. If the error persists, check /status for service health. For support, include the request_id value.
503 — Maintenance Mode
The service is temporarily unavailable for scheduled maintenance.
{
"error": "Service temporarily unavailable — maintenance in progress",
"retry_after": 300,
"status": "https://aipaygen.com/status"
}
How to fix: Wait for maintenance to complete. Check /status for real-time updates. The Retry-After header indicates estimated downtime in seconds.
Webhooks
Register HTTPS endpoints to receive real-time notifications about balance changes, payments, and task events.
httpx.post(f"{BASE}/webhooks/register",
json={
"url": "https://your-server.com/webhook",
"events": ["low_balance", "payment_received"],
"threshold": 0.50
},
headers={"Authorization": f"Bearer {key}"}
)
Available events: low_balance, payment_received, free_tier_exhausted, agent_task
Interactive webhook testing UI: /webhooks/test?key=apk_xxx