AI agents are starting to pay for API calls autonomously. Protocols like L402 (Lightning Network), x402 (Coinbase/Base), and MPP (Stripe/Tempo) let APIs charge per request using HTTP 402 — the "Payment Required" status code that's been reserved since the 1990s.
But here's the problem: how does your agent know the endpoint is actually worth paying for?
An endpoint might be listed in a directory. It might have been healthy yesterday. But right now, at the moment your agent is about to commit funds — is it live? Is the SSL valid? Is the payment handshake properly configured? Or is your agent about to send money into a broken endpoint?
The pre-flight check pattern
Before any paid API call, run a pre-flight check. Think of it like a pilot checking instruments before takeoff — you don't skip it just because the plane flew fine yesterday.
We built paid-api-preflight as a Strale capability that does exactly this. Pass it any URL, and it returns:
- Whether the endpoint is reachable
- Response time
- SSL validity
- Which payment protocol it uses (L402, x402, MPP, or unknown)
- Whether the payment handshake is properly formed
- For x402: whether the facilitator is reachable
- A simple recommendation: proceed, caution, or avoid
Using it via MCP
If your agent is connected to Strale's MCP server, the tool is already available:
{
"tool": "paid-api-preflight",
"arguments": {
"url": "https://some-paid-api.com/data"
}
}
Response:
{
"output": {
"url": "https://some-paid-api.com/data",
"is_reachable": true,
"response_time_ms": 180,
"status_code": 402,
"ssl_valid": true,
"payment_protocol": "x402",
"payment_handshake_valid": true,
"facilitator_reachable": true,
"recommendation": "proceed",
"issues": []
}
}
Your agent reads "proceed" and goes ahead with the payment. If it had returned "avoid", the agent skips that endpoint and saves the money.
Using it via the REST API
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"capability_slug": "paid-api-preflight",
"inputs": { "url": "https://some-paid-api.com/data" },
"max_price_cents": 10
}'
Costs €0.02 per check. New accounts get €2.00 in trial credits — that's 100 pre-flight checks for free.
What it checks per protocol
L402 (Lightning): Validates the WWW-Authenticate: L402 header, checks for a valid macaroon and BOLT11 invoice.
x402 (Base/Solana): Decodes the PAYMENT-REQUIRED header, checks for an accepts[] array, a payTo address, and tests whether the facilitator URL is reachable.
MPP (Stripe/Tempo): Parses the WWW-Authenticate: Payment header for required fields — id, realm, method, and payment intent.
If the endpoint doesn't return 402 at all, the tool reports protocol: "unknown" — it might not be a paid API, or it might need specific request parameters to trigger the paywall.
The agent workflow
The pattern we recommend for any agent making paid API calls:
- Discover an endpoint (from a directory, browsing, or a tool suggestion)
- Call
paid-api-preflightwith the URL - If
recommendationis"proceed"→ make the paid call - If
"caution"→ check theissuesarray and decide - If
"avoid"→ skip it, find an alternative
This adds ~200ms and €0.02 to each new endpoint your agent encounters. After the first check, your agent can cache the result and skip the pre-flight for repeat calls.
Getting started
Connect to Strale's MCP server — no installation needed:
{
"mcpServers": {
"strale": {
"type": "streamableHttp",
"url": "https://api.strale.io/mcp"
}
}
}
The strale_search tool works without an API key, so your agent can browse the full catalog of 225+ capabilities. For executing tools including paid-api-preflight, sign up at strale.dev for an API key and €2.00 in trial credits.
Full trust methodology: strale.dev/trust
Strale gives AI agents access to 225+ quality-scored capabilities via MCP, REST API, or SDK. Every capability is independently tested and scored. Get started free — €2 credit, no card required.
Top comments (0)