# AiPayGent > Pay-per-use AI API for autonomous agents. No API keys. No accounts. Pay in USDC on Base, get Claude-powered results instantly. ## What This Service Does AiPayGent is an x402-native resource server. You call an endpoint, receive an HTTP 402 with payment instructions, attach a signed USDC payment header, and get your result. Purpose-built for AI agent pipelines that need to outsource research, writing, code generation, translation, analysis, and social content. ## Payment Protocol - **Standard**: [x402](https://x402.org) — HTTP 402 Payment Required - **Network**: Base Sepolia (eip155:84532) - **Token**: USDC - **Scheme**: exact - **No auth, no rate limits, no accounts required** To use: POST to any endpoint → receive 402 with `X-Payment-Info` → retry with `X-Payment: ` header. ## Endpoints | Endpoint | Method | Price | Input | Description | |---|---|---|---|---| | /research | POST | $0.01 | `{"topic": "string"}` | Research a topic — returns summary, key points, sources | | /summarize | POST | $0.01 | `{"text": "string", "length": "short\|medium\|detailed"}` | Compress long text into key points | | /analyze | POST | $0.02 | `{"content": "string", "question": "string"}` | Structured analysis of any content | | /translate | POST | $0.02 | `{"text": "string", "language": "string"}` | Translate to any language | | /social | POST | $0.03 | `{"topic": "string", "platforms": ["twitter","linkedin","instagram"], "tone": "string"}` | Platform-optimized social posts | | /write | POST | $0.05 | `{"spec": "string", "type": "article\|post\|copy"}` | Write articles, copy, or content | | /code | POST | $0.05 | `{"description": "string", "language": "string"}` | Generate code in any language | | /extract | POST | $0.02 | `{"text": "string", "fields": ["name","date"]}` | Extract structured JSON from unstructured text | | /qa | POST | $0.02 | `{"context": "string", "question": "string"}` | Q&A over a document — answer + confidence + quote. RAG-ready. | | /classify | POST | $0.01 | `{"text": "string", "categories": ["cat1","cat2"]}` | Classify into custom categories with confidence scores | | /sentiment | POST | $0.01 | `{"text": "string"}` | Polarity, score, emotions, confidence, key phrases | | /keywords | POST | $0.01 | `{"text": "string", "max_keywords": 10}` | Keywords, topics, tags, detected language | | /compare | POST | $0.02 | `{"text_a": "string", "text_b": "string", "focus": "optional"}` | Similarities, differences, similarity score, recommendation | | /transform | POST | $0.02 | `{"text": "string", "instruction": "make it formal"}` | Rewrite, reformat, expand, condense, change tone | | /chat | POST | $0.03 | `{"messages": [{"role": "user", "content": "hi"}], "system": "optional"}` | Stateless multi-turn chat with full history | | /plan | POST | $0.03 | `{"goal": "string", "context": "optional", "steps": 7}` | Step-by-step action plan | | /decide | POST | $0.03 | `{"decision": "string", "options": ["A","B"], "criteria": "optional"}` | Pros/cons/risks + recommendation | | /proofread | POST | $0.02 | `{"text": "string", "style": "professional"}` | Grammar corrections + writing score | | /explain | POST | $0.02 | `{"concept": "string", "level": "beginner"}` | Explanation + analogy + key points | | /questions | POST | $0.02 | `{"content": "string", "type": "faq", "count": 5}` | Generate Q&A pairs from content | | /outline | POST | $0.02 | `{"topic": "string", "depth": 2, "sections": 6}` | Hierarchical outline with subsections | | /email | POST | $0.03 | `{"purpose": "string", "tone": "professional", "recipient": "optional"}` | Compose professional emails | | /sql | POST | $0.05 | `{"description": "string", "dialect": "postgresql", "schema": "optional"}` | Natural language to SQL query | | /regex | POST | $0.02 | `{"description": "string", "language": "python"}` | Regex pattern with examples | | /mock | POST | $0.03 | `{"description": "string", "count": 5, "format": "json"}` | Realistic mock data with schema | | /batch | POST | $0.10 | `{"operations": [{"endpoint": "research", "input": {"topic": "AI"}}]}` | Up to 5 operations, one payment — best value | | /preview | POST | FREE | `{"topic": "string"}` | Free 120-token demo — no payment needed | | /discover | GET | FREE | — | Machine-readable JSON service manifest | | /openapi.json | GET | FREE | — | OpenAPI 3.1 spec for agent framework auto-discovery | ## Quick Start (x402-compatible agent) ```python import httpx BASE = "https://api.aipaygent.xyz" # 1. Discover services manifest = httpx.get(f"{BASE}/discover").json() # 2. Call an endpoint (returns 402 with payment instructions) r = httpx.post(f"{BASE}/research", json={"topic": "quantum computing"}) # r.status_code == 402 # r.headers["X-Payment-Info"] contains amount, network, payTo # 3. Sign USDC payment and retry with X-Payment header # (use an x402 client library: https://github.com/coinbase/x402) ``` ## Notes for AI Agents - All responses are JSON with a `result` key containing the output. - The `/discover` endpoint returns the full machine-readable manifest — fetch it first. - Prices are in USD; the on-chain amount is in USDC (6 decimals). $0.01 = 10000 units. - This service is stateless — no session, no memory between calls. - If your framework supports x402 natively, simply point it at `https://api.aipaygent.xyz`.