@paydirectv2/ai-sdk
v0.1.0
Published
Vercel AI SDK tools for PayDirect — enable AI agents to make payments, check balances, swap tokens, and manage wallets
Maintainers
Readme
/ai-sdk
Vercel AI SDK tool bindings for the PayDirect API.
Lets AI agents create payments, check balances, send payouts, and swap tokens
through the standard ai tool interface.
Install
npm install @paydirectv2/ai-sdk ai @ai-sdk/openai zodPeer deps: ai >= 3.0.0, zod >= 3.0.0.
Quick start
import { generateText } from "ai"
import { openai } from "@ai-sdk/openai"
import { createPayDirectTools } from "@paydirectv2/ai-sdk"
const tools = createPayDirectTools({
apiKey: process.env.PAYDIRECT_API_KEY!,
})
const result = await generateText({
model: openai("gpt-4o"),
tools,
prompt: "Charge user_42 $25 USDC for the Pro plan and tell me the payment id.",
})The tools wrap the same REST endpoints documented at paydirect.com/developers/api:
| Tool | Endpoint |
| --------------------- | ------------------------------------ |
| createPayment | POST /api/v1/payments |
| getPayment | GET /api/v1/payments/:id |
| getWalletBalance | GET /api/v1/wallet/balance |
| getWalletStats | GET /api/v1/wallet/stats |
| sendPayout | POST /api/v1/payouts |
| getSwapQuote | GET /api/v1/swap/quote |
| executeSwap | POST /api/v1/swap |
| listPayments | GET /api/v1/payments |
Built on top of @paydirectv2/sdk.
For other agent frameworks, see
@paydirectv2/langchain or the
CLI.
License
MIT
