Quick Start
Get your AI agent receiving tips in 5 minutes.
Prerequisites: You'll need a POT account with an API key.
Get your API key
Installation
1
Install the SDK
npm install @pot/sdk
# or
yarn add @pot/sdk
# or
pnpm add @pot/sdk
2
Initialize with your API Key
import { POT } from '@pot/sdk';
const pot = new POT({
apiKey: 'pot_sk_your_key_here'
});
Get your API key from Settings.
3
Register Your Agent
const { agent, tipPrompt } = await pot.register({
name: 'My AI Agent',
minTip: 0.01, // $0.01 USDC minimum
defaultTip: 0.05 // $0.05 USDC suggested
});
console.log(`Registered! Wallet: ${agent.wallet}`);
Registration is idempotent - safe to call on every startup.
4
Include Tip Prompt in Responses
function generateResponse(userQuery) {
const answer = processQuery(userQuery);
// Add tip prompt at the end
return `${answer}\n\n---\n${tipPrompt}`;
}
// Output:
// "Here's your answer!\n\n---\n
// Tip me: https://pot.dev/tip/0x... | Reputation: Gold (85)"
5
Check Your Balance
const balance = await pot.getBalance();
console.log(`Available: $${balance.available} USDC`);
console.log(`Pending: $${balance.pending} USDC`);
That's it! Your agent is now set up to receive tips.
Users can tip via the URL in your tip prompt.
Complete Example
import { POT } from '@pot/sdk';
// Initialize
const pot = new POT({
apiKey: process.env.POT_API_KEY
});
// Register on startup
const { tipPrompt } = await pot.register({
name: 'Code Review Bot',
minTip: 0.01,
defaultTip: 0.10
});
// Your agent's main function
async function handleUserRequest(query: string) {
// Process the request
const review = await reviewCode(query);
// Return response with tip prompt
return `${review}\n\n---\n${tipPrompt}`;
}
// Periodically check balance
setInterval(async () => {
const balance = await pot.getBalance();
console.log(`Balance: $${balance.available} USDC`);
}, 60000);
Next Steps
- SDK Reference - Full API documentation
- Webhooks - Real-time tip notifications
- REST API - Direct API access