Documentation

run.pay Documentation

💰 Pricing: $0.005–$0.10/call · 2% commission · No monthly fee See full pricing →

run.pay is the discovery, routing and payment layer for autonomous AI agents. Your agent describes what it needs, run.pay matches it to the right service among 205 specialized providers, ranks the matches on real price/latency/reliability, and pays autonomously — no account creation, no API key provisioning, no subscriptions. Stripe handles billing autonomously.

Base URL: https://runpay-backend-visibility-production.up.railway.app
RoleWhat you doTime to production
Agent developerCreate wallet → call services → agents pay autonomously~5 minutes
API providerRegister → publish endpoint → receive per-call payments~10 minutes

Quickstart — Agent Developer

The fastest path from zero to a paid API call.

1

Install the SDK

bash
pip install runpay          # Python
npm install runpay        # JavaScript
2

Create your agent wallet

Go to getrunpay.com/signup or use the API directly:

bash
curl -X POST https://runpay-backend-visibility-production.up.railway.app/api/agents/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "name": "My Agent"}'
"agent_id": "agt_abc123def456"

Save your agent_id — this is your agent's identity across all services. A welcome email also arrives with a private link to manage your wallet.

3

Call your first service

Python
import runpay

runpay.configure(agent_id="agt_abc123def456")

result = runpay.call("halludetect", {
    "response": "According to Einstein, E=mc² was published in 2003"
})

print(result["hallucination_score"])  # 0-100
{
"success": true,
"hallucination_score": 72,
"risk_level": "HIGH",
"signals": ["..."],
"recommendation": "...",
"_meta": { "cost": 0.01, "balance_after": 4.99 }
}

Authentication

The SDK sends your agent ID as a header automatically (runpay.configure() handles this). If you're calling the API directly instead of using the SDK, the exact mechanism depends on the endpoint:

Direct call via /x402/:serviceId (what the SDK uses)
X-RunPay-Agent: agt_your_agent_id
Direct call via /api/call/:service_id
{ "agent_id": "agt_your_agent_id", "payload": { ... } }
Trial mode: Use x-runpay-trial: your_trial_id header for the 3 free calls in the playground. Production calls require a funded wallet.

Base URL

All API requests go to:

Base URL
https://runpay-backend-visibility-production.up.railway.app

No versioning prefix yet — all endpoints shown in this documentation are relative to this base URL.

Create Agent Wallet

Two ways to get a wallet, depending on whether a human is involved in the setup:

POST /api/agents/signup With a human present
ParameterTypeDescription
emailrequired stringYour email address for notifications and billing
nameoptional stringYour name or organization
use_caseoptional stringHow you'll use run.pay (helps us improve)
POST /api/agents/register Fully autonomous — no human or email required

An agent generates its own agent_id and registers it directly — no email, no human step. Useful for agent-to-agent commerce where nobody's watching.

ParameterTypeDescription
agent_idrequired stringAny unused agt_... string the agent generates itself
{
"agent_id": "agt_yourownrandomid123",
"wallet_id": "...",
"wallet_secret": "wsec_...",
"client_secret": "seti_..._secret_..."
}
wallet_secret is shown only this once — store it. Trial calls (3 per service) work immediately, no funding needed. Attaching real money to the wallet still needs a human to enter a card via Stripe at some point — no payment system can skip that step entirely.

Discover a Service

POST /api/discover

Describe a need in plain text — run.pay matches it to the right task type and returns every active provider, ranked on real price/latency/error rate from the last 7 days. No need to already know the exact service or category.

ParameterTypeDescription
needrequired stringPlain-text description of the task, e.g. "extract text from a scanned image"
Example — cURL
curl -X POST https://runpay-backend-visibility-production.up.railway.app/api/discover \
  -H "Content-Type: application/json" \
  -d '{"need": "detect hallucinations in this LLM output"}'
GET /api/services/by-task/:taskType

Already know the task type? Get the ranked provider list directly, without the natural-language matching step.

Example — cURL
curl https://runpay-backend-visibility-production.up.railway.app/api/services/by-task/hallucination-detection
POST /internal/smartroute

Skip picking a provider yourself — this calls the top-ranked one automatically, and falls through to the next-best on failure (network error or non-2xx response). Each attempt is independently safe: a failed call is refunded before the next provider is tried, never double-charged.

ParameterTypeDescription
agent_idrequired stringYour agent wallet ID
task_typerequired stringOne of the recognized task types (see /api/discover to find yours)
payloadrequired objectService-specific input
max_attemptsintegerHow many ranked providers to try before giving up (default 3, max 5)

Call a Service

POST /api/call/:service_id

Replace :service_id with the service UUID from the catalog.

ParameterTypeDescription
agent_idrequired stringYour agent wallet ID (agt_...)
payloadrequired objectService-specific input, nested under this key (see each service's schema)
Example — cURL
curl -X POST https://runpay-backend-visibility-production.up.railway.app/api/call/14783c94-915e-4054-83eb-af6b22c542c3 \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agt_your_agent",
    "payload": {
      "response": "The Eiffel Tower was built in 1850 according to French records."
    }
  }'

SDK Reference

Python

pip install runpay
import runpay

runpay.configure(agent_id="agt_your_agent")

# Call any service by ID
result = runpay.call("halludetect", {"response": "..."})

# List available services
services = runpay.services(category="AI")

# Check wallet balance
balance = runpay.wallet()

JavaScript

npm install runpay
const { configure, call, services, wallet } = require('runpay')
// or: import { configure, call, services, wallet } from 'runpay'

configure('agt_your_agent')

// Call any service by ID
const result = await call('halludetect', { response: '...' })

// List available services
const allServices = await services('AI')

// Check wallet balance
const balance = await wallet()

Framework Guides

LangChain

Generate all 205 services as ready-to-use LangChain tools in one line — no manual wrapping needed:

Python — pip install runpay[langchain]
from runpay.langchain import get_tools

tools = get_tools(agent_id="agt_your_agent")                      # all your available services
tools = get_tools(agent_id="agt_your_agent", category="Security")  # just one category

from langchain.agents import initialize_agent
agent = initialize_agent(tools, llm, agent="zero-shot-react-description")

CrewAI

Same idea — generated automatically from the live catalog:

Python — pip install runpay[crewai]
from runpay.crewai import get_tools

tools = get_tools(agent_id="agt_your_agent")

from crewai import Agent
researcher = Agent(role="Researcher", goal="...", tools=tools)

AutoGen

No dedicated integration yet — wrap the function you need directly:

Python
import autogen
import runpay

runpay.configure(agent_id="agt_your_agent")

def check_hallucination(response: str) -> dict:
    """Check if an LLM response contains hallucinations."""
    return runpay.call("halludetect", {"response": response})

assistant = autogen.AssistantAgent(
    name="assistant",
    llm_config={
        "functions": [{
            "name": "check_hallucination",
            "description": "Check LLM output for hallucination risk",
            "parameters": {"type": "object", "properties": {"response": {"type": "string"}}}
        }]
    }
)
autogen.register_function(check_hallucination, caller=assistant)

Error Handling

StatusError codeMeaning
400invalid_payloadMissing required field or wrong format
401invalid_agentAgent ID not found or inactive
402insufficient_balanceWallet balance too low — add funds
429rate_limitedToo many requests — retry with backoff
500service_errorService temporarily unavailable
Python — error handling
import runpay
from runpay import RunpayError, InsufficientBalanceError

try:
    result = runpay.call("halludetect", payload)
except InsufficientBalanceError as e:
    print(f"Need ${e.required}, have ${e.balance}")
    add_funds_to_wallet()
except RunpayError as e:
    print(f"Call failed: {e}")

Publishing a Service (Providers)

Publish your API on run.pay and every AI agent developer becomes a potential customer. You keep 98% of every call.

1

Register as a vendor

bash
curl -X POST .../api/vendors/register \
  -d '{"email": "you@company.com", "name": "My Service"}'

# Returns: {"vendor_id": "...", "api_key": "vnd_xxxxxxxxxx", "stripe_onboarding_url": "..."}
2

Publish your service

There's no SDK method for this yet — publish directly via the API, or from your vendor dashboard:

bash
curl -X POST .../api/services \
  -H "x-api-key: vnd_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Web Scraper",
    "description": "Scrape any URL, returns clean markdown",
    "price_per_call": 0.05,
    "endpoint_url": "https://api.yoursite.com/scrape",
    "category": "DATA",
    "schema_input": {
      "url": "URL to scrape"
    }
  }'

Pricing Guide

You set your own price per call — run.pay takes a flat 2% commission, no subscription, no listing fee. Payouts go to your connected Stripe account.

ModelWhat happens
You set price_per_callAny amount from $0.001 to $1000, whatever your service is worth
Agent paysFull price_per_call, charged automatically per call
You receive98% of each call, added to your Stripe balance
PayoutsAutomatic every 7 days, or request one manually from your vendor dashboard
There's no minimum price, but very low prices (under ~$0.01) mean you'll rarely see a payout on its own — most vendors batch several cheap services under one Stripe account.

Analytics

Your vendor dashboard shows live revenue, calls per service, error rates, and a breakdown by agent — no separate analytics API needed for normal use. If you're building your own reporting, the same data is available at GET /api/vendors/stats and GET /api/vendors/analytics (both require your x-api-key header).

Webhook Format

When an agent calls your service, run.pay forwards the agent's payload directly to your endpoint — no wrapper object, just the raw payload the agent sent:

Incoming request to your endpoint
POST https://api.yoursite.com/your-endpoint
Content-Type: application/json
X-RunPay-Call-Id: 1735689600.a1b2c3d4e5f6...
X-RunPay-Agent: agt_caller_agent
X-RunPay-Protocol: x402
X-RunPay-Signature: sha256=...

{ ...agent's raw input, exactly as they sent it... }
Verify the signature: find your signing secret in your vendor dashboard → Settings → Security, then verify each incoming call:
Node.js
const crypto = require('crypto');
const expected = 'sha256=' + crypto.createHmac('sha256', SIGNING_SECRET)
  .update(rawRequestBody).digest('hex');
if (expected !== req.headers['x-runpay-signature']) {
  return res.status(401).json({ error: 'Invalid signature' });
}
Note: the agent's identity is in the X-RunPay-Agent header, not in the request body — your endpoint receives only the payload fields your service expects (e.g. {"text": "..."}), not a wrapper object.

API Reference — List Services

GET /api/services List all available services
Query paramTypeDescription
limitoptional numberMax results (default: 50, max: 200)
categoryoptional stringFilter by: AI, DATA, MEDIA
searchoptional stringSearch by name or description

API Reference — Call Service

POST /api/call/:service_id

The service ID is the UUID from GET /api/services. Your agent's card on file is charged directly for this specific call.

Request
POST https://runpay-backend-visibility-production.up.railway.app/api/call/<service_id>
Content-Type: application/json

{
  "agent_id": "agt_your_agent_id",
  "payload": { ...whatever this specific service expects... }
}
Most agents use the SDK instead (runpay.call()), which talks to the newer /x402/:serviceId endpoint and handles wallet balance + auto top-up automatically. This endpoint charges your card directly per call — useful if you're not using the SDK.
Try any service for free in the interactive playground — first 3 calls free, no credit card.

API Reference — Wallet

GET /api/agents/wallet/:agentId Check balance and spending history
X-Wallet-Secret required for agents created after this protection was added — find yours in your agent dashboard. Older agents can still access their wallet without it.
{
"agent_id": "agt_abc123xyz",
"balance": 4.99,
"total_spent": 0.12,
"mode": "production"
}

API Reference — Vendors

POST /api/vendors/register Create a vendor account

See the Publishing a Service section above for the full signup + publish flow.

GET /api/vendors/stats Revenue, calls, and balance for your account

Requires your x-api-key header. Powers the vendor dashboard Overview tab — same data.

Services — AI Safety

ServicePriceKey output
Hallucination Detector$0.01hallucination_score, risk_level
PII Scanner$0.01pii_found, findings[]
GDPR Compliance Checker$0.02gdpr_compliant, issues[]
AI Act Compliance$0.02risk_category, obligations[]
Bias Detector$0.02bias_score, biases[]
Sycophancy Detector$0.01sycophancy_score, signals[]
Logical Fallacy Detector$0.01fallacies[], count
Ethical Red Teamer$0.02attack_vectors[], severity

Services — Data

ServicePriceKey output
Statistics Calculator$0.005mean, std, percentiles
Synthetic Data Generator$0.01records[], count
Monte Carlo Simulator$0.02mean, percentiles.p95, histogram
CSV Validator$0.005valid, errors[]
Data Profiler$0.01quality_score, columns
Hypothesis Tester$0.005p_value, conclusion
Semantic Diff$0.01similarity, change_magnitude

Services — Reasoning

ServicePriceKey output
Moral Reasoning Engine$0.02consensus, recommendation
Simulation Sandbox$0.01safe_to_execute, risk_score
Goal Decomposer$0.01subtasks[], critical_path
Argument Extractor$0.01pros[], cons[], balance
Chain of Thought Validator$0.005is_coherent, issues[]
Counterfactual Generator$0.01scenarios[], probability
Error Propagation Analyzer$0.01blast_radius, impacted_steps_detail[]
Ready to start?
Test any service free in the playground — no credit card needed.
Open playground →