Skip to main content

Exemples VERITY

VERITY est un agent autonome en direct à https://l402kit.com/api/verity. Ces exemples montrent comment appeler les 10 services de manière programmatique en utilisant le SDK agent l402-kit.

Configuration

import { L402Client } from "l402-kit/agent";
import { BlinkWallet } from "l402-kit/wallets";

const client = new L402Client({
  wallet: new BlinkWallet(process.env.BLINK_API_KEY!),
  budget: { maxSats: 5000 }, // hard cap per session
});

Découvrir tous les services et les prix actuels

const res = await fetch("https://l402kit.com/api/verity/services");
const { services } = await res.json();

for (const svc of services) {
  console.log(`${svc.id}: ${svc.price_sats} sats (floor: ${svc.floor_sats})`);
}

Vérifier le rapport fiscal quotidien

// Public — no payment required
const res = await fetch("https://l402kit.com/api/verity/fiscal");
const report = await res.json();

console.log(`Revenue: ${report.revenue_sats} sats (~${report.usd_equivalent})`);
console.log(`Net: ${report.net_sats} sats (${report.margin_pct}% margin)`);

for (const [service, data] of Object.entries(report.breakdown)) {
  console.log(`  ${service}: ${data.calls} calls × ${data.price} sats = ${data.revenue} sats`);
}

État du monde — 80 sats

Obtenez l’heure UTC, votre localisation et la météo locale en un seul appel.
const res = await client.fetch("https://l402kit.com/api/verity/worldstate");
const { time, location, weather } = await res.json();

console.log(`Time: ${time.utc}`);
console.log(`Location: ${location.city}, ${location.country}`);
console.log(`Weather: ${weather.temperature_c}°C, ${weather.condition}`);

Prix BTC — 10 sats

const res = await client.fetch("https://l402kit.com/api/verity/btc-price");
const { bitcoin } = await res.json();

console.log(`BTC: $${bitcoin.usd} USD | R$${bitcoin.brl} BRL`);

Recherche Web — 100 sats

const res = await client.fetch(
  "https://l402kit.com/api/verity/search?q=bitcoin+lightning+l402",
);
const { results } = await res.json();

for (const r of results) {
  console.log(`${r.title}\n${r.link}\n${r.snippet}\n`);
}

Résumé — 50 sats

const longText = "..."; // jusqu'à 50 000 caractères

const res = await client.fetch("https://l402kit.com/api/verity/summarize", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ text: longText, language: "english" }),
});
const { summary } = await res.json();
console.log(summary);

Sentiment — 30 sats

const res = await client.fetch("https://l402kit.com/api/verity/sentiment", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ text: "Lightning payments are instant and cheap!" }),
});
const { analysis } = await res.json();
// { sentiment: "positive", score: 0.94, confidence: 0.91, keywords: [...] }

Renseignements sur le domaine — 500 sats

const res = await client.fetch(
  "https://l402kit.com/api/verity/domain-intel?domain=bitcoin.org",
);
const { whois, dns, certificates } = await res.json();

console.log(`Registered: ${whois.registered}`);
console.log(`Expires: ${whois.expires}`);
console.log(`A records: ${dns.a_records.join(", ")}`);

Extraction Web — 200 sats

const res = await client.fetch("https://l402kit.com/api/verity/scrape", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://bitcoin.org/en/bitcoin-paper" }),
});
const { content, title } = await res.json();
console.log(`${title}\n\n${content.slice(0, 500)}...`);

Traduction — 50 sats

Traduisez n’importe quel texte vers 11 langues. Le mode MDX préserve les blocs de code, les balises de composants, les URLs et la terminologie L402.
// Texte brut
const res = await client.fetch("https://l402kit.com/api/verity/translate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    text: "Pay per call with Bitcoin Lightning. No API keys needed.",
    locale: "pt",
  }),
});
const { translated } = await res.json();
console.log(translated);
// "Pague por chamada com Bitcoin Lightning. Nenhuma chave de API necessária."
// Compatible MDX (préserve les blocs de code, <Components />, URLs)
const mdxPage = `## Install\n\`\`\`bash\nnpm install l402-kit\n\`\`\`\nSee [docs](https://docs.l402kit.com).`;

const res = await client.fetch("https://l402kit.com/api/verity/translate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ text: mdxPage, locale: "es", format: "mdx" }),
});
const { translated } = await res.json();
// Le bloc de code et l'URL sont préservés intacts ; seule la prose est traduite
Langues supportées : pt es zh ar fr de ja ko hi ru it

Intégration l402-kit — 10 000 sats

Envoyez à VERITY un dépôt GitHub public. Elle lit le code et retourne une intégration l402-kit complète.
const res = await client.fetch("https://l402kit.com/api/verity/integration", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ repoUrl: "https://github.com/owner/my-api" }),
});
const { integration, next_steps } = await res.json();

// integration = markdown avec le code exact à ajouter à votre dépôt
console.log(integration);
Le service d’intégration coûte 10 000 sats (~10 $). Après le paiement, vous recevez un code middleware complet spécifique à votre framework (Express, FastAPI, Gin, Axum, etc.) — et VERITY obtient la première référence vers votre nouvelle API propulsée par l402-kit.

Enchaînement des services

Un schéma d’agent courant : recherche → extraction → résumé.
// 1. Rechercher un sujet (100 sats)
const searchRes = await client.fetch(
  "https://l402kit.com/api/verity/search?q=bitcoin+lightning+adoption+2026",
);
const { results } = await searchRes.json();
const topUrl = results[0].link;

// 2. Extraire le premier résultat (200 sats)
const scrapeRes = await client.fetch("https://l402kit.com/api/verity/scrape", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: topUrl }),
});
const { content } = await scrapeRes.json();

// 3. Résumer l'article (50 sats)
const sumRes = await client.fetch("https://l402kit.com/api/verity/summarize", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ text: content }),
});
const { summary } = await sumRes.json();

// Coût total : 350 sats (~0,35 $)
console.log(summary);

Python

from l402kit import L402Client, BlinkWallet
import os

client = L402Client(
    wallet=BlinkWallet(os.environ["BLINK_API_KEY"]),
    budget={"max_sats": 5000},
)

# État du monde
resp = client.get("https://l402kit.com/api/verity/worldstate")
data = resp.json()
print(f"{data['time']['utc']} | {data['location']['city']} | {data['weather']['temperature_c']}°C")