ZapAPI Docs
Get StartedConceptsAI GatewayGuidesPayment GatewaySDKAPI ReferenceResources
AI Gateway

AI Tools

Pay-per-call AI tools — image & video generation, 600+ language TTS, translation, OCR and more. Quoted in sats upfront, confirmed by you.

AI Tools are pay-per-call capabilities beyond chat: generate images and video, synthesize speech in 600+ languages, translate, extract text with OCR, and more. Every call is quoted in sats upfront, confirmed by you, and itemized in your usage history — billed from the same AI credit balance as chat.

How it works

list tools → quote (valid ~5 min) → execute → result
                ↑ you see the exact sats BEFORE you pay
  1. Browse the catalog — /ai/tools in the dashboard, or the API below.
  2. Quote — a live price in sats for your exact parameters (upstream cost
    • margin + FX buffer). Quotes are valid for ~5 minutes.
  3. Execute — the balance is debited and the tool runs. Instant tools return the result inline; async tools return a job id to poll.
  4. Audit — every call lands in your tool history with its cost breakdown.

Destructive tools that act on the outside world (SMS, calls, email, fax) require an explicit confirmed: true — nothing fires by accident.

Tool categories

CategoryWhat you can doPriced per
ImageText-to-image, editing, upscaling, background removalimage
Video & 3DText-to-video, image-to-video, 3D assetssecond / render
Audio & VoiceTTS in 600+ languages, voice cloning, music1M units / track
TextSummaries, structured extraction, transformations1M tokens
TranslateFull-document and snippet translation1M chars
OCR & ExtractText from images, PDFs, screenshotspage
CommsSMS, calls, fax, email — confirmation requiredmessage
BusinessEnrichment, lookups, verificationrequest

The live catalog with indicative sats pricing is public: GET /ai/tools/catalog (no auth).

API

List tools

List all tools (or filter by category)
curl "https://api.zapapi.com/api/v1/ai/tools?category=image" \
  -H "Authorization: Bearer zap_live_your_key"

Each tool carries its id, name, category, pricingMode, whether it's destructiveHint (needs confirmation) and isAsync (runs as a job), an optional inputSchema, and an indicative price in sats.

Quote a call

Live quote (valid ~5 minutes)
curl -X POST https://api.zapapi.com/api/v1/ai/tools/flux-image/quote \
  -H "Authorization: Bearer zap_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "params": { "prompt": "A lightning bolt over a skyline", "resolution": "1K" } }'
Quote response
{
  "toolId": "flux-image",
  "costSats": 41,
  "listedSats": 52,
  "markupPct": 20,
  "flatFeeSats": 2,
  "fxBufferPct": 3,
  "destructiveHint": false,
  "isAsync": false,
  "expiresAt": "2026-10-28T12:05:00.000Z"
}

Execute

Execute (debits balance, pays upstream)
curl -X POST https://api.zapapi.com/api/v1/ai/tools/flux-image/execute \
  -H "Authorization: Bearer zap_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "params": { "prompt": "A lightning bolt over a skyline", "resolution": "1K" },
    "maxSats": 52
  }'
FieldPurpose
paramsTool input (schema on the tool entry)
maxSatsOptional spend cap — aborts if the live quote drifted above it
confirmedRequired true for destructive tools (comms)

Instant tools return the completed call with result. Async tools return status: "executing" and a call id — poll:

Poll an async job
curl https://api.zapapi.com/api/v1/ai/tools/jobs/CALL_ID \
  -H "Authorization: Bearer zap_live_your_key"

History

Tool call history with cost breakdowns
curl "https://api.zapapi.com/api/v1/ai/tools/history?page=1&pageCount=20" \
  -H "Authorization: Bearer zap_live_your_key"

From the SDK

tools.ts
import { ZapAPI } from '@zapapi/sdk';

const zap = new ZapAPI(process.env.ZAPAPI_KEY);

// Browse tools and quote a call
const tools = await zap.aiTools.list('image');
const quote = await zap.aiTools.quote('flux-image', {
  prompt: 'A lightning bolt over a skyline',
  resolution: '1K',
});

// Execute capped at the quoted price
const call = await zap.aiTools.execute('flux-image', {
  params: { prompt: 'A lightning bolt over a skyline', resolution: '1K' },
  maxSats: quote.listedSats,
});

// Async tools — wait for the result
const job = await zap.aiTools.waitForCompletion(call.id, { timeoutMs: 300_000 });
console.log(job.result);

// History
const { calls, total } = await zap.aiTools.history({ page: 1 });

Errors

HTTPMeaning
400Invalid params, or destructive tool without confirmed: true
402Insufficient AI credit — top up with Lightning
404Unknown tool id
429Upstream rate limit — retry shortly
502Upstream error — failed calls are refunded automatically

Failed calls refund automatically

When an upstream call fails before producing a result, the charge is reversed and the call shows status refunded in your history. You only ever pay for completed work.

On this page