npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@axonfi/plugin-vercel-ai

v0.1.1

Published

Vercel AI SDK tools for Axon — treasury and payment infrastructure for autonomous AI agents

Readme

@axonfi/plugin-vercel-ai

Vercel AI SDK tools for Axon — treasury and payment infrastructure for autonomous AI agents.

Gives your AI agent the ability to send payments, swap tokens, execute DeFi protocols, and check vault balances through Axon's non-custodial vaults.

Prerequisites

Before using this plugin, you need an Axon vault:

  1. Go to app.axonfi.xyz and connect your wallet
  2. Deploy a vault - this is your non-custodial treasury. Only you (the owner) can withdraw.
  3. Register a bot key - generate a new key pair in the dashboard or bring your own. This is the key your agent will sign with. Set a maxPerTxAmount to cap what the bot can spend per transaction.
  4. Fund the vault - deposit USDC (or any ERC-20) into your vault address.
  5. Copy your credentials:
    • vaultAddress - your deployed vault address
    • botPrivateKey - the bot's private key (the one registered in step 3)
    • chainId - Chain.Base (8453), Chain.Arbitrum (42161), or Chain.BaseSepolia (84532) for testing — import { Chain } from '@axonfi/sdk'

Your bot signs payment intents. It never holds funds, never pays gas, and can only spend within the limits you set. If the bot key is compromised, the attacker is capped by maxPerTxAmount and can only send to whitelisted destinations.

Installation

npm install @axonfi/plugin-vercel-ai @axonfi/sdk ai zod

Quick Start

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { createAxonTools } from '@axonfi/plugin-vercel-ai';
import { Chain } from '@axonfi/sdk';

const tools = createAxonTools({
  botPrivateKey: process.env.BOT_PRIVATE_KEY as `0x${string}`,
  vaultAddress: process.env.VAULT_ADDRESS as `0x${string}`,
  chainId: Chain.Base,
});

const { text } = await generateText({
  model: openai('gpt-4o'),
  tools,
  maxSteps: 5,
  prompt: 'Send 5.00 USDC to 0xRecipient...',
});

console.log(text);

Available Tools

| Tool | Description | |------|-------------| | pay | Send a payment from the vault (e.g. "5.00" USDC) | | swap | Swap tokens within the vault for rebalancing | | executeProtocol | Call a DeFi protocol (approve/call/revoke pattern) | | getBalance | Check the vault balance for a specific token | | getVaultValue | Get total vault USD value with per-token breakdown |

pay

Send a payment to any recipient address. The full Axon pipeline applies: policy checks, AI verification (if configured), and on-chain execution via the relayer.

// The AI agent decides to call this tool with:
// { to: "0x...", amount: "5.00", token: "USDC", memo: "API subscription" }

Parameters:

  • to (required) — Recipient address (0x...)
  • amount (required) — Human-readable amount (e.g. "5.00" for 5 tokens)
  • token (optional) — Token symbol or address. Defaults to "USDC"
  • memo (optional) — Payment description

swap

Swap tokens within the vault. Tokens remain in the vault (no external recipient). Useful for rebalancing holdings.

// { fromToken: "USDC", toToken: "WETH", amount: "100.00" }

Parameters:

  • fromToken (required) — Source token symbol or address
  • toToken (required) — Destination token symbol or address
  • amount (required) — Maximum amount of fromToken to spend

executeProtocol

Execute a DeFi protocol call. The vault approves tokens to the target, calls it, then revokes approvals. The target must be approved on the vault.

// { target: "0x...", calldata: "0x...", tokens: ["USDC"], amounts: ["100.00"] }

Parameters:

  • target (required) — Protocol contract address
  • calldata (required) — Hex-encoded calldata
  • tokens (optional) — Token symbols to approve
  • amounts (optional) — Approval amounts (human-readable)
  • memo (optional) — Description
  • protocolName (optional) — Protocol name (e.g. "Aave Deposit")

getBalance

Check vault balance for a token.

// { token: "USDC" }
// Returns: { token: "USDC", formatted: "1250.500000", balance: "1250500000", decimals: 6 }

Parameters:

  • token (optional) — Token symbol or address. Defaults to "USDC"

getVaultValue

Get total vault USD value with a breakdown by token.

// {} (no parameters)
// Returns: { totalValueUsd: 5230.45, tokens: [{ symbol: "USDC", valueUsd: 3000, ... }, ...] }

Configuration

import { Chain } from '@axonfi/sdk';

createAxonTools({
  botPrivateKey: '0x...',   // Bot's private key (signs EIP-712 intents)
  vaultAddress: '0x...',    // Axon vault contract address
  chainId: Chain.Base,      // Chain.Base, Chain.Arbitrum, Chain.BaseSepolia
  relayerUrl: '...',        // Optional, defaults to https://relay.axonfi.xyz
});

How It Works

  1. Your AI agent (via Vercel AI SDK) decides to call an Axon tool
  2. The plugin signs an EIP-712 intent with the bot's private key
  3. The signed intent is submitted to the Axon relayer
  4. The relayer runs policy checks (spending limits, velocity, whitelist/blacklist)
  5. If thresholds are triggered, a 3-agent AI verification scan runs
  6. Approved intents are executed on-chain by the relayer (the bot never pays gas)
  7. The tool returns the result (status, txHash, or rejection reason)

Using with Other AI Providers

The tools work with any model supported by the Vercel AI SDK:

import { anthropic } from '@ai-sdk/anthropic';

const { text } = await generateText({
  model: anthropic('claude-sonnet-4-20250514'),
  tools,
  maxSteps: 5,
  prompt: 'Check my vault balance and tell me the total value in USD.',
});

License

MIT