pqs-verify
v0.1.0
Published
Verify x402 API endpoints before payment. Trust primitive for the agent economy.
Maintainers
Readme
pqs-verify
Verify x402 API endpoints before payment. Trust primitive for the agent economy.
PQS (Protocol Quality Standard) is a Certificate Authority for AI agents. Before your agent pays for an API endpoint via x402 micropayments, check if the endpoint is PQS-verified — trusted, attested on-chain, and meeting quality standards.
Think of it as Let's Encrypt for AI Agents.
Install
npm install pqs-verifyQuick Start
const { verifyEndpoint, shouldPay } = require('pqs-verify');
// Check if an endpoint is trusted
const result = await verifyEndpoint('https://api.example.com/data');
console.log(result.trusted); // true or false
// One-liner: should my agent pay this endpoint?
const safe = await shouldPay('https://api.example.com/data');Integration Examples
Basic Verification
const { verifyEndpoint } = require('pqs-verify');
const check = await verifyEndpoint('https://api.example.com/signal');
if (check.trusted) {
console.log('Endpoint is PQS-verified');
console.log('On-chain attestation:', check.eas_uid);
// proceed with request/payment
} else {
console.log('NOT verified — do not pay');
}x402 Payment Flow
Check PQS trust before sending x402 payment:
const { verifyEndpoint } = require('pqs-verify');
async function payIfTrusted(endpointUrl) {
const check = await verifyEndpoint(endpointUrl);
if (!check.trusted) {
console.log('Blocked: endpoint not PQS-verified');
return;
}
// Safe to pay via x402
const response = await fetch(endpointUrl, {
headers: { 'X-PAYMENT': x402PaymentToken }
});
return response.json();
}Agent Middleware
Auto-check every endpoint before payment — drop into any agent framework:
const { shouldPay } = require('pqs-verify');
async function agentRequest(url, paymentFn) {
if (!await shouldPay(url)) {
throw new Error(`PQS: ${url} not verified`);
}
return paymentFn(url);
}Python (CrewAI / LangChain)
Equivalent pattern using requests:
import requests
def pqs_verify(endpoint_url):
r = requests.get(
'https://api.smartflowproai.com/pqs/verify',
params={'endpoint': endpoint_url},
timeout=5
)
data = r.json()
return data.get('valid', False)
# Use in your agent's tool
if pqs_verify('https://api.example.com/data'):
# safe to pay
passAPI Reference
verifyEndpoint(url, options?)
Verify a single endpoint against PQS CA.
Returns: { trusted, cert, score, tier, eas_uid, raw }
| Field | Type | Description |
|-------|------|-------------|
| trusted | boolean | Whether the endpoint is PQS-verified |
| cert | object\|null | Certificate details if verified |
| score | number\|null | PQS quality score |
| tier | string\|null | PQS tier (e.g. "standard", "premium") |
| eas_uid | string\|null | On-chain EAS attestation UID |
| raw | object | Full API response |
shouldPay(url, options?)
Quick boolean: should an agent pay this endpoint?
Returns false on network errors (fail-safe).
Options: { baseUrl, timeout, minScore }
listVerified(options?)
Get all verified endpoints from PQS CA.
Returns: { total, ca_public_key, certs: [...] }
health(options?)
Check PQS CA health status.
stats(options?)
Get PQS CA statistics.
Options (all functions)
| Option | Default | Description |
|--------|---------|-------------|
| baseUrl | https://api.smartflowproai.com/pqs | PQS CA server URL |
| timeout | 5000 | Request timeout in ms |
| minScore | 0 | Minimum PQS score (shouldPay only) |
PQS Leaderboard
See verified endpoints and their scores: pqs-leaderboard.pages.dev
License
MIT
