TypeScript SDK
Manage agent wallets and handle payments in code. Coming soon.
Coming Soon
The @indiegent/sdk TypeScript package is in development. It will provide a clean, type-safe interface for everything the API offers — plus built-in 402 payment handling.
Preview: What It Will Look Like
Installation
npm install @indiegent/sdkManaging Wallets
import { IndieGent } from "@indiegent/sdk";
const ig = new IndieGent({ apiKey: process.env.INDIEGENT_API_KEY });
// Create a wallet for your agent
const agent = await ig.agents.create({
name: "Research Bot",
spendingCap: 50, // $50 USDC
});
console.log(agent.walletAddress); // 0x7a3f...
// Fund it
await ig.agents.fund(agent.id, { amount: 25 });
// Get env vars for injection
const env = await ig.agents.env(agent.id);
// { INDIEGENT_AGENT_KEY: "0x...", INDIEGENT_AGENT_ADDRESS: "0x..." }Auto-Paying 402 Responses
import { createPaymentFetch } from "@indiegent/sdk";
// Wraps fetch() with automatic 402 payment handling
const payFetch = createPaymentFetch({
agentKey: process.env.INDIEGENT_AGENT_KEY,
agentAddress: process.env.INDIEGENT_AGENT_ADDRESS,
});
// Just use it like fetch — payments happen automatically
const response = await payFetch("https://api.example.com/search?q=hello");
const data = await response.json();
// If the service returned 402, the SDK:
// 1. Parsed the payment requirements
// 2. Sent USDC to the recipient
// 3. Retried the request with the tx hash
// All transparent to your codeMonitoring
// Check balances
const balance = await ig.balance();
console.log(`Total: $${balance.totalUsdc / 1_000_000}`);
// Transaction history
const txns = await ig.transactions.list({ limit: 20 });
// Per-agent transactions
const agentTxns = await ig.agents.transactions(agent.id);In the Meantime
Everything the SDK will do, you can do today:
- REST API — Full programmatic access with
fetch() - CLI — Terminal-based management
- Agent Pay — The
fetchWithPayment()pattern for handling 402 responses
Get Notified
Want to know when the SDK ships? Star the repo or follow @indiegent for updates.