OceanAltOceanAlt

INTEGRATION GUIDE

Pre-payment checks for Vercel AI SDK agents

Before an agent pays, ask OceanAlt whether the payee is sanctioned or high-risk and whether the payment page is impersonating someone. Each check returns one of three results: allow (no blocking findings), review (a human has to agree first) or decline (don't pay). If a check can't run, the result is review, never allow. The package holds no keys and moves no funds.

Install

npm install @oceanalt/vercel-ai ai zod

No API key is needed for the free endpoints. Tested with ai 7, 6 and 5.

1. Tools for the model (advisory)

checkPayee screens the payee (POST /api/decide) and checkPaymentEndpoint screens the payment URL (GET /api/endpoint). The model decides whether to call them and whether to follow the answer, so they are advisory.

import { generateText } from "ai";
import { oceanaltTools } from "@oceanalt/vercel-ai";

const result = await generateText({
  model,
  tools: { ...oceanaltTools(), ...yourTools },
  prompt: "Pay 2 USDC to 0x... for the weather API",
});

2. Guard your payment tool (enforced)

guardPaymentTool wraps your own payment tool and checks before the original execute runs. decline means it does not run; review runs only if your onReview returns true after a human agreed; a failed check is treated as review.

import { generateText, tool } from "ai";
import { z } from "zod";
import { guardPaymentTool } from "@oceanalt/vercel-ai";

const transfer = tool({
  description: "Send USDC on Base",
  inputSchema: z.object({ recipient: z.string(), amount: z.number() }),
  execute: async ({ recipient, amount }) => sendUsdc(recipient, amount),
});

// Runs POST /api/decide before the original execute. decline -> not executed.
// review -> not executed unless onReview returns true (after a human agreed).
const guardedTransfer = guardPaymentTool(transfer, {
  getPayment: (input) => ({ to: input.recipient, amountUsdc: input.amount, network: "base" }),
  onReview: async (result, input) => askAHuman(result, input),
});

await generateText({ model, tools: { transfer: guardedTransfer }, prompt });

What comes back

decision, verdict, reason_code, retry, advice, signal_keys and evidence, plus a one-line instruction for the model. Results are screening conclusions over public data, not a guarantee.

npm: @oceanalt/vercel-ai · API reference · All integration options

Not affiliated with Vercel.