agentsvc.io

Vercel AI SDK

agentsvc tools for the AI SDK

The agentsvc package turns any of our 126 services into AI SDK tools with their live input schemas. Each call costs $0.002 to $0.6 and is paid from a prepaid credit token or from the agent's own wallet via x402 (USDC on Base, Solana, Polygon or Arbitrum). No account, no subscription. Failed calls are never charged.

Install

npm install agentsvc ai

Paying from a wallet instead of a credit token needs the x402 client as well: npm install @x402/fetch @x402/evm viem.

Choose how to pay

Credit token (simplest): buy one at /credits from $0.10 (+10% bonus) and set it as an environment variable.

AGENTSVC_CREDIT_TOKEN=asvc_cr_...

Wallet: createAgentsvc({ privateKey, network: 'eip155:8453' }) with a separate wallet that holds a few dollars of USDC on Base, Polygon (eip155:137) or Arbitrum (eip155:42161). It pays no gas; it only signs a USDC authorization per call.

Run an agent

import { generateText, isStepCount } from 'ai';
import { createAgentsvc } from 'agentsvc';
import { agentsvcTools } from 'agentsvc/ai-sdk';

const svc = createAgentsvc({ creditToken: process.env.AGENTSVC_CREDIT_TOKEN });
const tools = await agentsvcTools(svc, ['web-scrape', 'token-precheck', 'token-smart-money']);

const { text } = await generateText({
  model: 'anthropic/claude-haiku-5.5', // AI Gateway, or any provider model
  tools,
  stopWhen: isStepCount(5),
  prompt: 'Is BRETT (0x532f27101965dd16442E59d40670FaF5eBB142E4) on Base safe to buy, and who is buying it right now?',
});
console.log(text);

Tool names are the service slugs with underscores (token_smart_money). Each tool description contains the price, so the model knows what a call costs.

Pick tools

Pass a list of slugs, a category or a filter. Fewer tools give the model an easier choice.

await agentsvcTools(svc, ['agent-memory', 'agent-inbox']);    // by slug
await agentsvcTools(svc, { category: 'finance' });             // by category: web, text, data, finance, utility, visual
await agentsvcTools(svc, s => s.price_usdc <= 0.005);          // by filter

Useful sets: reading the web (web-scrape, search-read, answer-with-sources), trading (token-precheck, token-smart-money, crypto-prices), agent state (agent-memory, agent-inbox), finding other APIs (service-finder). Full list with prices: /services.

Call a service directly

const page = await svc.call('web-scrape', { url: 'https://example.com' });
const sample = await svc.sample('token-smart-money'); // free example output, no payment

Errors throw AgentsvcError with status (402 without payment, 400 for invalid input) and the response body. Neither is charged.