> ## Documentation Index
> Fetch the complete documentation index at: https://shinydapps-bd9fa40b.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# VERITY

> Agent IA autonome avec 10 services protégés par L402. Gagne des sats, paie en sats.

# VERITY

VERITY est un agent IA autonome construit sur l402-kit. Elle vend 10 services via le protocole L402, accumule un trésor Bitcoin et ajuste ses propres prix en fonction de la demande — sans intervention humaine.

**Point de découverte :** `GET https://l402kit.com/api/verity`

***

## Les 10 Services

| Service               | Point d'accès              | Prix        | Requiert |
| --------------------- | -------------------------- | ----------- | -------- |
| Recherche Web         | `/api/verity/search`       | 100 sats    | —        |
| Extraction Web        | `/api/verity/scrape`       | 200 sats    | —        |
| Prix BTC              | `/api/verity/btc-price`    | 10 sats     | —        |
| Résumé                | `/api/verity/summarize`    | 50 sats     | —        |
| Sentiment             | `/api/verity/sentiment`    | 30 sats     | —        |
| Intel Domaine         | `/api/verity/domain-intel` | 500 sats    | —        |
| Intégration l402-kit  | `/api/verity/integration`  | 10 000 sats | —        |
| État du Monde         | `/api/verity/worldstate`   | 80 sats     | —        |
| Traduction            | `/api/verity/translate`    | 50 sats     | —        |
| Recherche Approfondie | `/api/verity/research`     | 300 sats    | —        |

Les prix sont dynamiques — VERITY les ajuste toutes les 30 minutes en fonction de la demande.

***

## Comment Payer

Chaque service suit le protocole L402 standard :

```bash theme={null}
# Étape 1 — demander le service (obtenir la facture)
curl -i https://l402kit.com/api/verity/btc-price

# HTTP/1.1 402 Payment Required
# WWW-Authenticate: L402 macaroon="...", invoice="lnbc..."

# Étape 2 — payer la facture avec n'importe quel portefeuille Lightning
# Étape 3 — réessayer avec la preuve
curl -H "Authorization: L402 <macaroon>:<preimage>" \
  https://l402kit.com/api/verity/btc-price
```

***

## Paiement automatisé avec L402Client

```typescript theme={null}
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: 500 },
});

// Prix BTC — 10 sats
const price = await client.fetch("https://l402kit.com/api/verity/btc-price");
const data = await price.json();
console.log(data.bitcoin.usd);

// État du monde — 80 sats
const world = await client.fetch("https://l402kit.com/api/verity/worldstate");
const state = await world.json();
console.log(state.time.utc, state.location.city, state.weather.temperature_c);
```

***

## Référence des Services

### Recherche — 100 sats

Recherche web renvoyant les 10 premiers résultats organiques.

```bash theme={null}
# GET
curl -H "Authorization: L402 <token>" \
  "https://l402kit.com/api/verity/search?q=bitcoin+lightning"

# POST
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"q":"bitcoin lightning"}' \
  https://l402kit.com/api/verity/search
```

**Réponse :**

```json theme={null}
{
  "agent": "VERITY",
  "service": "search",
  "query": "bitcoin lightning",
  "results": [
    { "title": "...", "link": "...", "snippet": "..." }
  ],
  "paid_with": "⚡ Lightning L402"
}
```

***

### Extraction Web — 200 sats

Retourne le contenu complet de la page en markdown.

```bash theme={null}
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}' \
  https://l402kit.com/api/verity/scrape
```

***

### Prix BTC — 10 sats

Prix Bitcoin en temps réel en USD, EUR et BRL.

```bash theme={null}
curl -H "Authorization: L402 <token>" \
  https://l402kit.com/api/verity/btc-price
```

**Réponse :**

```json theme={null}
{
  "bitcoin": { "usd": 98000, "eur": 90000, "brl": 550000 },
  "timestamp": "2026-05-10T12:00:00.000Z"
}
```

***

### Résumé — 50 sats

Résumé IA jusqu'à 50 000 caractères.

```bash theme={null}
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"text":"...long text...", "language":"portuguese"}' \
  https://l402kit.com/api/verity/summarize
```

***

### Sentiment — 30 sats

Analyse de sentiment avec score, niveau de confiance et mots-clés.

```bash theme={null}
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"text":"Bitcoin is the future of money"}' \
  https://l402kit.com/api/verity/sentiment
```

**Réponse :**

```json theme={null}
{
  "analysis": {
    "sentiment": "positive",
    "score": 0.92,
    "confidence": 0.88,
    "keywords": ["bitcoin", "future", "money"]
  }
}
```

***

### Intel Domaine — 500 sats

WHOIS, enregistrements DNS et certificats SSL. Sans clé API — utilise RDAP public et crt.sh.

```bash theme={null}
curl -H "Authorization: L402 <token>" \
  "https://l402kit.com/api/verity/domain-intel?domain=example.com"
```

**Réponse :**

```json theme={null}
{
  "domain": "example.com",
  "whois": { "registrar": "...", "registered": "...", "expires": "..." },
  "dns": { "a_records": ["93.184.216.34"] },
  "certificates": [{ "issued": "...", "expires": "...", "issuer": "..." }]
}
```

***

### Intégration l402-kit — 10 000 sats

Envoyez l'URL d'un dépôt GitHub public. VERITY analyse la base de code et retourne le code d'intégration l402-kit complet.

```bash theme={null}
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"repoUrl":"https://github.com/owner/repo"}' \
  https://l402kit.com/api/verity/integration
```

**Réponse :**

````json theme={null}
{
  "repo": "owner/repo",
  "integration": "## Detected: Express.js\n\n```typescript\nimport { l402 } from 'l402-kit';\n...",
  "next_steps": ["Apply integration code", "Set env vars", "Deploy and test"]
}
````

***

### État du Monde — 80 sats

Heure UTC + géolocalisation de l'appelant + météo locale en un seul appel. Zéro coût d'API externe.

```bash theme={null}
curl -H "Authorization: L402 <token>" \
  https://l402kit.com/api/verity/worldstate
```

**Réponse :**

```json theme={null}
{
  "time": {
    "utc": "2026-05-10T14:32:00.000Z",
    "unix": 1778421120,
    "hour": 14, "minute": 32, "weekday": "Sun"
  },
  "location": {
    "city": "São Paulo", "country": "BR", "timezone": "America/Sao_Paulo"
  },
  "weather": {
    "temperature_c": 23.4,
    "feels_like_c": 22.1,
    "humidity_pct": 68,
    "condition": "partly cloudy"
  }
}
```

***

### Recherche Approfondie — 300 sats

Pack de recherche approfondie : recherche + extraction + résumé IA en un seul appel. Économise 3 paiements séparés et 3 fois la latence aller-retour.

```bash theme={null}
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"query": "bitcoin lightning network adoption 2026"}' \
  https://l402kit.com/api/verity/research
```

**Réponse :**

```json theme={null}
{
  "agent": "VERITY",
  "service": "research",
  "query": "bitcoin lightning network adoption 2026",
  "summary": "Lightning Network adoption has accelerated significantly in 2026...",
  "scraped_url": "https://example.com/article",
  "sources": [
    { "title": "...", "link": "...", "snippet": "..." }
  ],
  "provider": "serper",
  "paid_with": "⚡ Lightning L402"
}
```

**par rapport à l'appel des services séparément :** Recherche (100 sats) + Extraction (200 sats) + Résumé (50 sats) = 350 sats au total. La Recherche Approfondie coûte 300 sats — moins cher et un seul paiement.

***

### Traduction — 50 sats

Traduit du texte ou de la documentation MDX vers l'une des 11 langues prises en charge. Lorsque `format` est `mdx`, les blocs de code, les composants MDX, les URL et les termes techniques sont préservés exactement — seule la prose est traduite.

**Langues prises en charge :** `pt`, `es`, `zh`, `ar`, `hi`, `fr`, `de`, `ru`, `ja`, `it`, `en`

```bash theme={null}
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"text": "Pay once, access forever.", "locale": "pt", "format": "plain"}' \
  https://l402kit.com/api/verity/translate
```

**Format MDX** (préserve les blocs de code et les composants) :

```bash theme={null}
curl -X POST -H "Authorization: L402 <token>" \
  -H "Content-Type: application/json" \
  -d '{"text": "---\ntitle: Quickstart\n---\n\nPay with Lightning.", "locale": "ja", "format": "mdx"}' \
  https://l402kit.com/api/verity/translate
```

**Réponse :**

```json theme={null}
{
  "agent": "VERITY",
  "service": "translate",
  "locale": "pt",
  "language": "Brazilian Portuguese",
  "format": "plain",
  "translated": "Pague uma vez, acesse para sempre.",
  "source_length": 26,
  "paid_with": "⚡ Lightning L402"
}
```

Entrée maximale : 100 000 caractères par appel.

***

## Tarification Dynamique

VERITY ajuste les prix toutes les 30 minutes :

```
Forte demande (> seuil d'appels/heure) → prix × 1.1
Demande nulle (2 heures consécutives)  → prix × 0.9
Protection plancher                    → le prix ne descend jamais en dessous du minimum
```

Vérifiez les prix actuels à tout moment :

```bash theme={null}
curl https://l402kit.com/api/verity | jq '.services[].priceSats'
```

***

***

## Endpoints de Découverte Publics

Ces deux endpoints ne nécessitent pas de paiement L402 — ils exposent le catalogue et les finances de VERITY pour l'audit et la découverte.

### GET /api/verity/services

Catalogue lisible par machine de tous les services actifs avec tarification en direct, planchers et seuils de surge.

```bash theme={null}
curl https://l402kit.com/api/verity/services
```

```json theme={null}
{
  "services": [
    {
      "id": "search",
      "endpoint": "https://l402kit.com/api/verity/search",
      "price_sats": 500,
      "floor_sats": 500,
      "cogs_sats": 50,
      "surge_threshold": 50
    }
  ],
  "count": 10,
  "updated": "2026-05-12T14:32:00.000Z"
}
```

### GET /api/verity/fiscal

Rapport fiscal quotidien de VERITY — revenus, coûts, marge et ventilation par service. Généré à 00:00 UTC.

```bash theme={null}
curl https://l402kit.com/api/verity/fiscal
```

```json theme={null}
{
  "date": "2026-05-12",
  "agent": "VERITY",
  "revenue_sats": 8450,
  "consumer_spent_sats": 340,
  "net_sats": 8110,
  "margin_pct": "95.98",
  "usd_equivalent": "10.00",
  "btc_usd_rate": 95000,
  "breakdown": {
    "search": { "calls": 21, "price": 500, "revenue": 10500, "success_rate": 98 }
  },
  "generated_at": "2026-05-12T00:00:01.000Z"
}
```

Les rapports sont conservés 7 jours. Renvoie 404 si le rapport du jour n'a pas encore été généré.

## API Opérateur

Si vous forkez VERITY pour exécuter votre propre agent, ces points d'accès vous permettent de modifier la tarification et les budgets à l'exécution — sans déploiement requis.

Toutes les routes d'administration nécessitent l'en-tête `DASHBOARD_SECRET` :

```
Authorization: Bearer <DASHBOARD_SECRET>
```

### GET /api/verity/admin/config

Retourne la configuration de tarification actuelle et les dépenses des consommateurs pour tous les services.

```bash theme={null}
curl -H "Authorization: Bearer <secret>" \
  https://l402kit.com/api/verity/admin/config
```

**Réponse :**

```json theme={null}
{
  "configs": {
    "search":  { "base": 100, "floor": 50, "surgeThreshold": 50, "cogs": 2 },
    "translate": { "base": 50, "floor": 50, "surgeThreshold": 30, "cogs": 1 }
  },
  "prices": { "search": 100, "translate": 50 },
  "consumer": { "spent_today": 340, "budget": 10000 }
}
```

### POST /api/verity/admin/config

Met à jour les paramètres de tarification pour un service spécifique. Seuls les champs fournis sont modifiés.

```bash theme={null}
curl -X POST -H "Authorization: Bearer <secret>" \
  -H "Content-Type: application/json" \
  -d '{"service": "search", "base": 150, "floor": 80}' \
  https://l402kit.com/api/verity/admin/config
```

| Champ            | Description                                                           |
| ---------------- | --------------------------------------------------------------------- |
| `service`        | Nom du service (requis)                                               |
| `base`           | Prix de base en sats                                                  |
| `floor`          | Prix minimum (la tarification dynamique ne descend jamais en dessous) |
| `surgeThreshold` | Appels/heure déclenchant une hausse de +10%                           |
| `cogs`           | Coût des biens en sats (utilisé par l'agent fiscal)                   |

### POST /api/verity/admin/budget

Définit la limite de dépense journalière du consommateur.

```bash theme={null}
curl -X POST -H "Authorization: Bearer <secret>" \
  -H "Content-Type: application/json" \
  -d '{"sats": 5000}' \
  https://l402kit.com/api/verity/admin/budget
```

Minimum : 100 sats. Les modifications prennent effet immédiatement.

***

## Architecture

```
VERITY (agent:shinydapps.verity)
  ├── 10 services protégés par L402
  ├── Trésor : shinydapps@blink.sv
  ├── Battement de cœur : toutes les 30 min (ajustement des prix + scan du marché Satring)
  ├── Cache des requêtes : KV-backed, TTL par service (5min–24h)
  ├── Agent Fiscal : rapport quotidien à 00:00 UTC → GET /api/verity/fiscal
  ├── Catalogue des services : lisible par machine → GET /api/verity/services
  ├── Contrat d'agent : GET /.well-known/agent.json → bloc verity
  └── LAW-N : événements comportementaux émis par transaction
```

VERITY est open-source — la même architecture peut être forkée pour créer votre propre agent autonome.
