> ## 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

> 10個のL402保護サービスを持つ自律型AIエージェント。satsを稼ぎ、satsで支払う。

# VERITY

VERITYはl402-kit上に構築された自律型AIエージェントです。L402プロトコルを通じて10のサービスを販売し、Bitcoinのトレジャリーを蓄積し、人間の介入なしに需要に基づいて自身の価格を調整します。

**ディスカバリーエンドポイント:** `GET https://l402kit.com/api/verity`

***

## 10のサービス

| サービス               | エンドポイント                    | 価格          | 必要条件 |
| ------------------ | -------------------------- | ----------- | ---- |
| ウェブ検索              | `/api/verity/search`       | 100 sats    | —    |
| ウェブスクレイピング         | `/api/verity/scrape`       | 200 sats    | —    |
| BTC価格              | `/api/verity/btc-price`    | 10 sats     | —    |
| 要約                 | `/api/verity/summarize`    | 50 sats     | —    |
| センチメント分析           | `/api/verity/sentiment`    | 30 sats     | —    |
| ドメインインテル           | `/api/verity/domain-intel` | 500 sats    | —    |
| l402-kit インテグレーション | `/api/verity/integration`  | 10,000 sats | —    |
| ワールドステート           | `/api/verity/worldstate`   | 80 sats     | —    |
| 翻訳                 | `/api/verity/translate`    | 50 sats     | —    |
| リサーチ               | `/api/verity/research`     | 300 sats    | —    |

価格は動的です — VERITYは需要に基づいて30分ごとに価格を調整します。

***

## 支払い方法

すべてのサービスは標準的なL402に従います：

```bash theme={null}
# ステップ1 — サービスをリクエストする（インボイスを取得する）
curl -i https://l402kit.com/api/verity/btc-price

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

# ステップ2 — 任意のLightning Networkウォレットでインボイスを支払う
# ステップ3 — 証明を付けて再試行する
curl -H "Authorization: L402 <macaroon>:<preimage>" \
  https://l402kit.com/api/verity/btc-price
```

***

## 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 },
});

// 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);

// ワールドステート — 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);
```

***

## サービスリファレンス

### 検索 — 100 sats

上位10件のオーガニック検索結果を返すウェブ検索。

```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
```

**レスポンス:**

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

***

### ウェブスクレイピング — 200 sats

ページの全コンテンツを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
```

***

### BTC価格 — 10 sats

USD、EUR、BRLによるリアルタイムのBitcoin価格。

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

**レスポンス:**

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

***

### 要約 — 50 sats

最大50,000文字のAI要約。

```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
```

***

### センチメント分析 — 30 sats

スコア、信頼度、キーワードを含むセンチメント分析。

```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
```

**レスポンス:**

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

***

### ドメインインテル — 500 sats

WHOIS、DNSレコード、SSL証明書。APIキー不要 — 公開RDAPとcrt.shを使用。

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

**レスポンス:**

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

***

### l402-kit インテグレーション — 10,000 sats

公開GitHubリポジトリのURLを送信します。VERITYはコードベースを解析し、完全なl402-kitインテグレーションコードを返します。

```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
```

**レスポンス:**

````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"]
}
````

***

### ワールドステート — 80 sats

1回の呼び出しでUTC時刻 + 発信者のジオロケーション + 現地の天気を取得。外部APIコストはゼロ。

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

**レスポンス:**

```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"
  }
}
```

***

### リサーチ — 300 sats

ディープリサーチバンドル：検索 + スクレイピング + AIによる要約を1回の呼び出しで実行。3回の個別支払いと3倍のラウンドトリップレイテンシを節約できます。

```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
```

**レスポンス:**

```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"
}
```

**各サービスを個別に呼び出す場合との比較:** 検索（100 sats）+ スクレイピング（200 sats）+ 要約（50 sats）= 合計350 sats。リサーチは300 sats — より安く、支払いも1回。

***

### 翻訳 — 50 sats

テキストまたはMDXドキュメントを11のサポート言語のいずれかに翻訳します。`format`が`mdx`の場合、コードブロック、MDXコンポーネント、URL、技術用語はそのまま保持され、散文のみが翻訳されます。

**サポートロケール:** `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
```

**MDXフォーマット**（コードブロックとコンポーネントを保持）:

```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
```

**レスポンス:**

```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"
}
```

最大入力: 1回の呼び出しにつき100,000文字。

***

## ダイナミックプライシング

VERITYは30分ごとに価格を調整します：

```
高需要（閾値を超える呼び出し/時間）→ 価格 × 1.1
需要ゼロ（2時間連続）              → 価格 × 0.9
フロア保護                         → 価格が最低値を下回ることはない
```

現在の価格はいつでも確認できます：

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

***

***

## パブリック探索エンドポイント

これら2つのエンドポイントはL402支払いが不要です — VERITYのカタログと財務情報を監査・探索のために公開します。

### GET /api/verity/services

すべてのアクティブサービスのライブ価格、最低価格、サージ閾値を含むマシンリーダブルなカタログ。

```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

VERITYの日次財務レポート — 収益、コスト、マージン、サービス別の内訳。毎日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"
}
```

レポートは7日間保存されます。その日のレポートがまだ生成されていない場合は404を返します。

## オペレーターAPI

VERITYをフォークして独自のエージェントを運用する場合、これらのエンドポイントによりデプロイ不要でランタイム中に価格やバジェットを変更できます。

すべての管理者ルートには`DASHBOARD_SECRET`ヘッダーが必要です：

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

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

すべてのサービスの現在の価格設定とコンシューマーの支出を返します。

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

**レスポンス:**

```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

特定のサービスの価格パラメーターを更新します。指定されたフィールドのみ変更されます。

```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
```

| フィールド            | 説明                          |
| ---------------- | --------------------------- |
| `service`        | サービス名（必須）                   |
| `base`           | satsによる基本価格                 |
| `floor`          | 最低価格（ダイナミックプライシングはこれを下回らない） |
| `surgeThreshold` | +10%のサージをトリガーする呼び出し/時間数     |
| `cogs`           | satsによる原価（財務エージェントが使用）      |

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

コンシューマーの日次支出上限を設定します。

```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
```

最小: 100 sats。変更は即座に有効になります。

***

## アーキテクチャ

```
VERITY (agent:shinydapps.verity)
  ├── 10 L402-protected services
  ├── Treasury: shinydapps@blink.sv
  ├── Heartbeat: every 30min (price adjustment + Satring market scan)
  ├── Query cache: KV-backed, per-service TTL (5min–24h)
  ├── Fiscal Agent: daily report at 00:00 UTC → GET /api/verity/fiscal
  ├── Service catalog: machine-readable → GET /api/verity/services
  ├── Agent contract: GET /.well-known/agent.json → verity block
  └── LAW-N: behavioral events emitted per transaction
```

VERITYはオープンソースです — 同じアーキテクチャをフォークして独自の自律型エージェントを作成できます。
