Use Paykit with LangChain
Add payment capabilities to your LangChain applications using Paykit.
npm install @langchain/anthropic @langchain/core payman-paykit
import { ChatAnthropic } from "@langchain/anthropic"; import { paykit } from 'payman-paykit'; // Initialize Paykit const tools = paykit({ apiSecret: process.env.PAYMAN_API_SECRET!, environment: process.env.PAYMAN_ENVIRONMENT as 'sandbox' | 'production' }); // Setup LangChain model const llm = new ChatAnthropic({ model: "claude-3-sonnet-20240229", temperature: 0 }); async function callModel(userMessage: string) { const response = await llm.invoke([ ["system", "You are a payment assistant that can help send money and manage transactions."], ["human", userMessage] ], { tools: tools }); return response; }
ANTHROPIC_API_KEY=sk-ant-... PAYMAN_API_SECRET=your_api_secret PAYMAN_ENVIRONMENT=sandbox
const response = await callModel('Send $50 to John for consulting');
See a complete implementation
View all payment capabilities