run.pay Documentation
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.
https://runpay-backend-visibility-production.up.railway.app| Role | What you do | Time to production |
|---|---|---|
| Agent developer | Create wallet → call services → agents pay autonomously | ~5 minutes |
| API provider | Register → publish endpoint → receive per-call payments | ~10 minutes |
Quickstart — Agent Developer
The fastest path from zero to a paid API call.
Install the SDK
pip install runpay # Python npm install runpay # JavaScript
Create your agent wallet
Go to getrunpay.com/signup or use the API directly:
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"}'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.
Call your first service
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:
X-RunPay-Agent: agt_your_agent_id
{ "agent_id": "agt_your_agent_id", "payload": { ... } }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:
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:
| Parameter | Type | Description |
|---|---|---|
| required string | Your email address for notifications and billing | |
| name | optional string | Your name or organization |
| use_case | optional string | How you'll use run.pay (helps us improve) |
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.
| Parameter | Type | Description |
|---|---|---|
| agent_id | required string | Any 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
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.
| Parameter | Type | Description |
|---|---|---|
| need | required string | Plain-text description of the task, e.g. "extract text from a scanned image" |
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"}'Already know the task type? Get the ranked provider list directly, without the natural-language matching step.
curl https://runpay-backend-visibility-production.up.railway.app/api/services/by-task/hallucination-detection
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.
| Parameter | Type | Description |
|---|---|---|
| agent_id | required string | Your agent wallet ID |
| task_type | required string | One of the recognized task types (see /api/discover to find yours) |
| payload | required object | Service-specific input |
| max_attempts | integer | How many ranked providers to try before giving up (default 3, max 5) |
Call a Service
Replace :service_id with the service UUID from the catalog.
| Parameter | Type | Description |
|---|---|---|
| agent_id | required string | Your agent wallet ID (agt_...) |
| payload | required object | Service-specific input, nested under this key (see each service's schema) |
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
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
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:
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:
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:
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
| Status | Error code | Meaning |
|---|---|---|
| 400 | invalid_payload | Missing required field or wrong format |
| 401 | invalid_agent | Agent ID not found or inactive |
| 402 | insufficient_balance | Wallet balance too low — add funds |
| 429 | rate_limited | Too many requests — retry with backoff |
| 500 | service_error | Service temporarily unavailable |
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.
Register as a vendor
curl -X POST .../api/vendors/register \
-d '{"email": "you@company.com", "name": "My Service"}'
# Returns: {"vendor_id": "...", "api_key": "vnd_xxxxxxxxxx", "stripe_onboarding_url": "..."}Publish your service
There's no SDK method for this yet — publish directly via the API, or from your vendor dashboard:
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.
| Model | What happens |
|---|---|
You set price_per_call | Any amount from $0.001 to $1000, whatever your service is worth |
| Agent pays | Full price_per_call, charged automatically per call |
| You receive | 98% of each call, added to your Stripe balance |
| Payouts | Automatic every 7 days, or request one manually from your vendor dashboard |
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:
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... }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' });
}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
| Query param | Type | Description |
|---|---|---|
| limit | optional number | Max results (default: 50, max: 200) |
| category | optional string | Filter by: AI, DATA, MEDIA |
| search | optional string | Search by name or description |
API Reference — Call Service
The service ID is the UUID from GET /api/services. Your agent's card on file is charged directly for this specific call.
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... }
}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.API Reference — Wallet
"agent_id": "agt_abc123xyz",
"balance": 4.99,
"total_spent": 0.12,
"mode": "production"
}
API Reference — Vendors
See the Publishing a Service section above for the full signup + publish flow.
Requires your x-api-key header. Powers the vendor dashboard Overview tab — same data.
Services — AI Safety
| Service | Price | Key output |
|---|---|---|
| Hallucination Detector | $0.01 | hallucination_score, risk_level |
| PII Scanner | $0.01 | pii_found, findings[] |
| GDPR Compliance Checker | $0.02 | gdpr_compliant, issues[] |
| AI Act Compliance | $0.02 | risk_category, obligations[] |
| Bias Detector | $0.02 | bias_score, biases[] |
| Sycophancy Detector | $0.01 | sycophancy_score, signals[] |
| Logical Fallacy Detector | $0.01 | fallacies[], count |
| Ethical Red Teamer | $0.02 | attack_vectors[], severity |
Services — Data
| Service | Price | Key output |
|---|---|---|
| Statistics Calculator | $0.005 | mean, std, percentiles |
| Synthetic Data Generator | $0.01 | records[], count |
| Monte Carlo Simulator | $0.02 | mean, percentiles.p95, histogram |
| CSV Validator | $0.005 | valid, errors[] |
| Data Profiler | $0.01 | quality_score, columns |
| Hypothesis Tester | $0.005 | p_value, conclusion |
| Semantic Diff | $0.01 | similarity, change_magnitude |
Services — Reasoning
| Service | Price | Key output |
|---|---|---|
| Moral Reasoning Engine | $0.02 | consensus, recommendation |
| Simulation Sandbox | $0.01 | safe_to_execute, risk_score |
| Goal Decomposer | $0.01 | subtasks[], critical_path |
| Argument Extractor | $0.01 | pros[], cons[], balance |
| Chain of Thought Validator | $0.005 | is_coherent, issues[] |
| Counterfactual Generator | $0.01 | scenarios[], probability |
| Error Propagation Analyzer | $0.01 | blast_radius, impacted_steps_detail[] |