← All guides · SDK guides · Markdown: /guides/sdk/vercel-ai-sdk.md

Lordevo tools for the Vercel AI SDK

Needs lordevo-x402 0.1.5 or later (on npm and PyPI; 0.1.3 lacks toolDefs() and trial).

Five web tools for generateText / streamText, paid per call with x402 (USDC on Base). No account and no API key.

ToolWhat it doesPrice per call
page_markdownA web page as clean, LLM-ready Markdown$0.003
can_fetchrobots.txt + AI-crawler permission check for a URL$0.003
tech_stackWhat a site is built with (CMS, frameworks, analytics)$0.003
dns_lookupDNS records (A, AAAA, CNAME, MX, TXT, NS, SOA, CAA)$0.003
email_validateEmail syntax + domain + MX (no mailbox probing)$0.003

Prices are from the shop's price table (checked 20 Nov 2026, after the price floor moved to $0.003; lordevo-x402 package READMEs before 0.1.7 show older prices). The live price is always the one in the HTTP 402 and in https://shop.lordevo.com/catalog.json.

Tool names in the table use underscores (page_markdown), as in MCP and the SDK; only= lists and catalogue slugs use hyphens (page-markdown).

Install

npm i "lordevo-x402@>=0.1.5" ai @ai-sdk/openai     # or any other AI SDK provider
npm i @x402/fetch @x402/evm viem         # only for paid calls

Copy lordevo-ai-sdk.mjs next to your code.

Use (5 lines)

import { generateText, isStepCount } from 'ai';
import { fromPrivateKey } from 'lordevo-x402';
import { lordevoTools } from './lordevo-ai-sdk.mjs';
const lordevo = await fromPrivateKey(process.env.AGENT_WALLET_KEY, { trial: true, maxPriceUsd: 0.01 });
const { text } = await generateText({ model, tools: lordevoTools(lordevo), stopWhen: isStepCount(5), prompt: 'Is https://example.com/blog/post allowed for AI crawlers?' });

model is any tool-calling model of your provider, e.g. openai('<model id>'). lordevoTools(lordevo, ['dns-lookup']) picks other tools.

Free trial

With { trial: true } the first calls of the day are free: 3 calls per IP per UTC day on tools priced up to $0.005 (all five tools here). After that the client pays. Without a wallet key, use createLordevo({ trial: true }): free calls only; when they are used up the tool returns { error: 'payment_required', ... } to the model instead of throwing.

How payment works

An unpaid request gets HTTP 402 with the price. The x402 fetch signs a USDC payment from your agent wallet on Base and retries; the shop's facilitator settles it, so the wallet needs USDC but no ETH for gas. maxPriceUsd refuses any tool priced above it before a request is made. Answers of 400 or higher are not charged. Use a separate agent wallet with a small balance, and keep its key in an environment variable, never in code.

Errors

The tools never throw: errors reach the model as an object with error, message and charged (always false for errors).

Run the example

node example.mjs                       # free trial calls only
AGENT_WALLET_KEY=0x... node example.mjs # free first, then paid

It executes each tool once without an LLM, plus one bad input, and prints what happened.

MIT licence, like lordevo-x402. The AI SDK is Apache-2.0-licensed; this file only uses its public tool() and jsonSchema() API.

Files

All SDK guides: https://shop.lordevo.com/guides/sdk