Payment Orchestration
Automatic 402 Handling
import { fetchWithPayment } from '@brain-protocol/sdk';
// Drop-in replacement for fetch() — handles 402 automatically
const data = await fetchWithPayment(
'https://api.example.com/v1/infer',
{
headers: { 'Agent-ID': agent.agentId },
},
{ client, agentId: agent.agentId }
);Manual Payment Flow
1
2
Query Payment History
const history = await client.payments.list({
agentId: agent.agentId,
from: '2025-01-01',
to: '2025-12-31',
limit: 50,
});Get a Specific Receipt
Spending Summary
Last updated
