Credence

Developers

Read any agent's record over HTTP or MCP, borrow and repay from your own agent through the SDK, and pay x402 endpoints with a line as float.

REST API

Base URL /api

Free, no key. Amounts are USDC base units (6 decimals) as decimal strings; keys are base58. Balance and score endpoints read the chain on every request; history endpoints read the finalized index.

GET/v1/statsPool accounting, utilization, share price, agent count.
GET/v1/agents?q=&limit=&offset=Directory with line status and score.
GET/v1/agents/:idIdentity, credit record, loans, sponsor and score.
GET/v1/agents/:id/scoreScore with every component, penalty and the loans it did and did not count.
GET/v1/agents/:id/loansLoans with derived phase (active, overdue, defaultable, repaid, defaulted).
GET/v1/agents/:id/activityIndexed events for one agent.
GET/v1/quote?amount=&termDays=&premiumBps=Exact fee, computed with the program's own rounding.
GET/v1/sponsors · /v1/sponsors/:authoritySponsors, free backing, lines and pending consent requests.
GET/v1/lenders/:ownerA lender's position, value and withdrawable amount.
GET/v1/activity · /v1/loans · /v1/analyticsFinalized history and aggregates.
GET/v1/treasury · /v1/tokenTreasury accounting and revenue deposits; token facts read from chain.
curl /api/v1/agents/1/score

How scores work

Version 1.0.0

A score is a pure function of public accounts, so anyone can recompute it. It counts only risk someone else took:

  • Risk time, up to 300: USDC × days actually held on loans repaid on time, 1 point per 10 USDC-days.
  • Seasoned loans, up to 200: loans held their full scoring term (7 days), 20 each at 50 USDC or more, less in proportion below.
  • Backing at risk, up to 150: the current line, 1 point per 5 USDC.
  • History, up to 100: 2 points per day since the first counted repayment.
  • −10 per late repayment, which itself earns nothing. Any default, by the agent or its owner's wallet, scores 0.

Loans backed by the borrower's own sponsor count for nothing, and so do loans from sponsors younger than 30 days (the treasury excepted). A change of owner restarts the history. The engine and weights live in packages/shared/src/score.ts.

SDK

@credence/sdk

Builds unsigned instructions; your wallet, multisig or agent key signs. It never holds a key.

import { Connection, PublicKey } from "@solana/web3.js";
import { CredenceClient } from "@credence/sdk";

const client = new CredenceClient({
  connection: new Connection("https://api.mainnet-beta.solana.com"),
  usdcMint: new PublicKey("<pool USDC mint>"),
});

const profile = await client.getAgentProfile(1);       // identity, line, loans, score
const quote = await client.quote(5_000_000n, 7 * 86_400); // 5 USDC for 7 days

const agent = (await client.getAgent(1))!;
const credit = (await client.getCredit(agent.address))!;
const { ix, loan } = await client.borrowIx({
  signer: agentKey.publicKey, agent, credit,
  amount: 5_000_000n, termSeconds: 7 * 86_400, maxFee: quote.fee,
});
const tx = await client.transaction([ix], agentKey.publicKey); // sign and send with your wallet

MCP server

@credence/mcp

Read tools work with no key. Money tools return an unsigned transaction for the owner to sign, unless you start the server with the agent's signing key (never the owner's) and a spending policy, in which case it signs within those limits.

# Claude Code
claude mcp add credence -- npx tsx packages/mcp/src/main.ts

# environment
CREDENCE_RPC_URL=https://api.mainnet-beta.solana.com
CREDENCE_USDC_MINT=<pool USDC mint>
# optional: let the agent sign borrows/repays itself, within limits
CREDENCE_AGENT_KEYPAIR=./agent-signing-key.json
CREDENCE_POLICY='{"maxLoan":"25000000","dailyBorrowLimit":"50000000","maxTermDays":14}'

Tools: view_pool_stats, get_agent, get_credit_score, get_credit_line, list_loans, calculate_loan_quote, register_agent, request_borrow, request_repay.

x402 payments

@credence/x402

Pay x402 endpoints in USDC on Solana. When the agent's balance is short, the payer can borrow just the shortfall from its line, within a per-call cap, a daily budget and a maximum loan, after simulating every transaction. Each purchase has an idempotency key so a retry never pays twice, every action is written to an audit log, and a kill switch stops all spending.

import { createCreditPayer } from "@credence/x402";

const payer = createCreditPayer({
  client, agentId: 1, signer: agentSigningKey,
  policy: { maxPricePerCall: 100_000n, dailyBudget: 5_000_000n, maxBorrow: 5_000_000n, borrowTermDays: 7 },
  auditLog: "./x402-audit.jsonl",
});

const res = await payer.fetch("https://merchant.example/api/report", { idempotencyKey: "report-2026-10-10" });
await payer.settleLoans(); // later: repay open loans, earliest due first

Programs

Three Anchor programs: agent_registry (identity), credit_pool (lenders, sponsors, lines, loans) and treasury (a rule-bound sponsor). IDLs ship in packages/sdk/src/idl. The repository's docs describe every invariant and the tests that check them.