langchain-spraay
LangChain tools for Spraay — multi-chain batch payments and x402 payment gateway for AI agents.
Overview
langchain-spraay provides LangChain-compatible tools that let AI agents:
- Send batch payments to up to 200 recipients in a single transaction across 13+ chains
- Access 200+ AI models via pay-per-request (no API keys needed)
- Query price oracles, execute DeFi swaps, manage payroll, and more
- Pay with USDC on Base via the x402 payment protocol — no accounts, no API keys
Installation
# Gateway tools (HTTP-based, no web3 needed)
pip install langchain-spraay
# Include on-chain smart contract tools
pip install langchain-spraay[onchain]
Quick Start
Gateway Tools (Recommended)
import os
from langchain_spraay import SpraayGatewayTool, SpraayToolkit
os.environ["SPRAAY_PRIVATE_KEY"] = "your-private-key-with-usdc-on-base"
# Use individual tools
tool = SpraayGatewayTool()
result = tool.invoke({
"endpoint": "/price/eth",
"method": "GET"
})
# Or load all tools via toolkit
toolkit = SpraayToolkit()
tools = toolkit.get_tools() # 4 gateway tools ready to use
Batch Payments
from langchain_spraay import SpraayBatchPaymentTool
tool = SpraayBatchPaymentTool()
result = tool.invoke({
"chain": "base",
"token": "USDC",
"recipients": ["0xAbc...", "0xDef...", "0x123..."],
"amounts": ["100", "250", "50"]
})
AI Inference
from langchain_spraay import SpraayAIInferenceTool
tool = SpraayAIInferenceTool()
result = tool.invoke({
"prompt": "Explain quantum computing in one paragraph",
"model": "gpt-4o-mini",
"provider": "openrouter"
})
On-Chain Tools
from langchain_spraay import SpraayBatchSendETH
tool = SpraayBatchSendETH()
result = tool.invoke({
"recipients": ["0xAbc...", "0xDef..."],
"amount_per_recipient_eth": "0.01"
})
With LangChain Agents
from langchain_spraay import SpraayToolkit
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
llm = ChatOpenAI(model="gpt-4o-mini")
toolkit = SpraayToolkit(include_onchain=True)
tools = toolkit.get_tools()
agent = create_react_agent(llm, tools)
result = agent.invoke({
"messages": [{"role": "user", "content": "Send 0.01 ETH to 0xAbc... and 0xDef..."}]
})
Environment Variables
| Variable | Required | Description |
|---|---|---|
SPRAAY_PRIVATE_KEY |
Yes | Private key of wallet with USDC on Base |
SPRAAY_GATEWAY_URL |
No | Gateway URL (default: https://gateway.spraay.app) |
SPRAAY_RPC_URL |
No | RPC URL for on-chain tools (default: https://mainnet.base.org) |
SPRAAY_CONTRACT_ADDRESS |
No | Spraay V2 contract address (default: mainnet) |
Available Tools
Gateway Tools
| Tool | Description |
|---|---|
SpraayGatewayTool |
Generic access to all 76+ gateway endpoints |
SpraayBatchPaymentTool |
Multi-chain batch payments (13+ chains) |
SpraayAIInferenceTool |
AI inference (200+ models, 3 providers) |
SpraayPriceOracleTool |
Real-time crypto price lookups |
On-Chain Tools (require web3)
| Tool | Description |
|---|---|
SpraayBatchSendETH |
Batch send equal ETH amounts |
SpraayBatchSendToken |
Batch send equal ERC-20 amounts |
SpraayBatchSendETHVariable |
Batch send variable ETH amounts |
SpraayBatchSendTokenVariable |
Batch send variable ERC-20 amounts |
Supported Chains
Base, Ethereum, Arbitrum, Polygon, BNB Chain, Avalanche, Optimism, Solana, Bitcoin (PSBT), XRP Ledger, Bittensor, Stacks, BOB
Links
License
MIT
Metadata
Release files for langchain-spraay 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_spraay-0.3.0.tar.gz | 14.2 kB | Without provenance | Details for langchain_spraay-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_spraay-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_spraay-0.3.0-py3-none-any.whl |
Total release size: 27.3 kB
Release files / langchain_spraay-0.3.0.tar.gz
| Download URL | langchain_spraay-0.3.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
374850c2dd8e6420f189f10570a3cabe675fb51859132c26693b83eeec1613bc
|
|
BLAKE2b-256 checksum How to use checksums |
b1f4594fb4fc8bbfa8af7d3d749c8f5119fcc853cfde8bbda6054a15fa70c69c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / langchain_spraay-0.3.0-py3-none-any.whl
| Download URL | langchain_spraay-0.3.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13c534ab1d8ce56483385979e91e492d88456d58038c6feea9f893a714efc9cc
|
|
BLAKE2b-256 checksum How to use checksums |
8f6a19394a18e43fc1ce53429f0987a82d9e0fe95730f6cb0a2822709d260248
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for langchain-spraay 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.