MoltsPayTool - Let your LangChain agent pay for AI services

  Hey everyone! 👋                                                                                             
                                                                                                               
  I built a LangChain tool that lets agents pay for AI services autonomously using crypto (USDC on Base).      
                                                                                                               
  ## Quick Setup                                                                                               
                                                                                                               
  ```python                                                                                                    
  from langchain.agents import initialize_agent, AgentType                                                     
  from langchain_openai import ChatOpenAI                                                                      
  from moltspay.integrations.langchain import MoltsPayTool                                                     
                                                                                                               
  llm = ChatOpenAI(model="gpt-4")                                                                              
  tools = [MoltsPayTool()]                                                                                     
                                                                                                               
  agent = initialize_agent(tools, llm, agent=AgentType.OPENAI_FUNCTIONS)                                       
  result = agent.run("Generate a video of a cat dancing")                                                      

What it does

  • Agent discovers available services (video generation, transcription, etc.)
  • Checks prices
  • Pays with USDC (gasless - no ETH needed, uses x402 protocol)
  • Returns results

Install

  pip install moltspay[langchain]                                                                              

Links

Also works with CrewAI out of the box since CrewAI uses LangChain tools.

Would love feedback! What services would you want your agents to be able to pay for?