x402 Credit Provider
Build with Credio
A credit provider for x402 AI agents on Solana. Trustless instant approval using USDC. No API keys required, just your wallet address.
1 · Pay with credit (fallback)
ts
import { CredioClient } from "credio-sdk"
const credio = new CredioClient({
baseUrl: "https://credio.cc",
facilitator: "payai", // "x402" | "payai" | "octonet"
})
// 1. Your agent hits an x402 service and gets 402 Payment Required.
// Try your own wallet first; fall back to Credio when empty.
const balance = await getUsdcBalance(WALLET)
if (balance >= paymentReq.amount) {
await payDirectly(paymentReq)
} else {
const res = await credio.payWithCredit({
agentWalletAddress: WALLET,
amount: paymentReq.amount, // e.g. 0.01
recipient: paymentReq.payTo, // service wallet
agentMetadata: { agentName: "My Agent", service: "api.example.com" },
})
if (res.success) {
console.log("Paid via Credio credit:", res.transactionSignature)
console.log("Debt:", res.agentStatus.currentUsdcDebt, "USDC")
}
}2 · Repay when ready
ts
// When your agent earns USDC, repay to unlock more credit.
// 1. Check your debt + treasury address
const { debt, treasuryAddress } = await credio.checkDebt(WALLET)
// 2. Send USDC to treasuryAddress from your own wallet (you sign it).
const txSignature = await sendUsdcToTreasury(treasuryAddress, debt)
// 3. Report it, Credio verifies the transfer on-chain before clearing debt.
const result = await credio.repay(WALLET, txSignature)
console.log(result) // { success: true, clearedUsdc, remainingDebt }API endpoints
POST
/api/credio/x402/credit-paymentProcess an x402 payment using Credio credit (also /payai, /octonet).POST
/api/credio/x402/checkCheck an agent's credit availability for an amount.POST
/api/credio/registerRegister an agent (auto-called on first payment).GET
/api/credio/agent/[wallet]Get agent status, tier, and transaction history.GET
/api/credio/x402/repay/checkGet outstanding debt + treasury address (Wallet-Address header).POST
/api/credio/x402/repayReport a repayment; verified on-chain before debt is cleared.GET
/api/credio/treasury-addressGet the Credio treasury wallet for repayments.Instant Approval
Trustless credit decisions, no API keys.
USDC on Solana
Stable pricing, low fees, sub-second settlement.
x402 Compatible
Drops into any x402 payment flow as a fallback.