{
  "$schema": "https://tensorfeed.ai/.well-known/agent-fair-trade-schema.json",
  "version": "1.0",
  "name": "Agent Fair-Trade Agreement",
  "abbrev": "AFTA",
  "publisher": {
    "name": "TerminalFeed.io",
    "legal_entity": "Pizza Robot Studios LLC",
    "url": "https://terminalfeed.io",
    "contact": "hello@terminalfeed.io",
    "manifesto_page": "https://terminalfeed.io/agent-fair-trade",
    "source_repo": "https://github.com/RipperMercs/terminalfeed",
    "reciprocal_access": "TerminalFeed and TensorFeed share a single bearer-token + credit ledger. A token minted on either site works on both. Each site signs receipts with its own keypair. See network_federation below."
  },
  "self_description": "TerminalFeed.io is agent fair-trade certified: open pricing, automatic no-charge on 5xx, breaker, stale data, and empty results, Ed25519-signed receipts on every paid call, inference-only license. Built with Claude (Anthropic). Standard at /.well-known/agent-fair-trade.json.",
  "no_charge_guarantees": [
    {
      "id": "5xx",
      "description": "Server errors (HTTP 5xx) never charge a credit. The handler can fail safely.",
      "code": "worker-additions/worker.js (handlePremium / aftaPremiumResponse)",
      "verifiable_via": "/api/payment/no-charge-stats?date=YYYY-MM-DD"
    },
    {
      "id": "circuit_breaker",
      "description": "If the cross-Worker validation circuit breaker trips after consecutive billing-rail failures, no credit is charged and a billing_temporarily_unavailable response is returned.",
      "code": "worker-additions/worker.js (_breakerOpen + aftaValidateOnly)",
      "verifiable_via": "/api/payment/no-charge-stats and /developers/agent-payments"
    },
    {
      "id": "empty_result",
      "description": "A valid but empty result on a pure-compute endpoint (world-deltas with no new events since ?since, or anomalies with nothing above threshold) is not charged. The response still returns the empty answer with a signed receipt carrying no_charge_reason: \"empty_result\", so an agent polling for changes is never billed for nothing new.",
      "code": "aftaPremiumResponse __no_charge handling in worker-additions/worker.js",
      "verifiable_via": "Call /api/pro/world-deltas?since=<current ISO time> (no new events) and inspect the receipt. The event appears at /api/payment/no-charge-stats."
    },
    {
      "id": "stale_data",
      "description": "If an upstream refresh fails, the endpoint serves the last cached data flagged stale: true instead of erroring, and the call is not charged (no_charge_reason stale_data). The agent gets degraded but useful data for free during an outage rather than a hard 5xx. Input handling is lenient by default: bad params are clamped or defaulted, not rejected, so there is no separate schema-validation charge to refund.",
      "code": "cacheLookupOrFetch serve-stale plus aftaPremiumResponse in worker-additions/worker.js",
      "verifiable_via": "/api/payment/no-charge-stats and the stale flag plus freshness_sla_seconds field in the receipt"
    }
  ],
  "freshness_slas": "Published live at https://terminalfeed.io/api/meta -> agent_fair_trade.freshness_slas",
  "receipts": {
    "signed": true,
    "algorithm": "EdDSA",
    "curve": "Ed25519",
    "canonical_form": "tensorfeed-canonical-json-v1",
    "public_key_url": "https://terminalfeed.io/.well-known/terminalfeed-receipt-key.json",
    "verify_endpoint": "https://terminalfeed.io/api/receipt/verify",
    "verify_doc": "https://terminalfeed.io/agent-fair-trade#receipts",
    "fields_signed": [
      "v",
      "id",
      "endpoint",
      "method",
      "token_short",
      "credits_charged",
      "credits_remaining",
      "request_hash",
      "response_hash",
      "captured_at",
      "server_time",
      "no_charge_reason",
      "freshness_sla_seconds"
    ],
    "rotation_policy": "Single-key in v1. Key rotations announced 30 days in advance with both old and new keys served during the rotation window.",
    "federated_keys_note": "TerminalFeed and TensorFeed run separate keypairs. To verify a receipt, fetch the public key URL of the issuing site (read receipt.verify_doc or the response's host)."
  },
  "pricing": {
    "transparent": true,
    "listed_at": "https://terminalfeed.io/api/payment/info",
    "currency": "USDC",
    "network": "eip155:8453",
    "network_name": "Base mainnet",
    "rail_rationale": "Public on-chain crypto ledgers (USDC on Base) are structurally fair to all participants, including AI agents that traditional payment processors lock out. Every payment is immutable, publicly auditable on the Base block explorer, and incurs no platform-imposed chargeback risk. The receipt rail and the on-chain rail are independent: a receipt attests to what we charged and why; the chain attests to what was paid.",
    "x402_compatibility": {
      "compliant": true,
      "manifest": "https://tensorfeed.ai/.well-known/x402.json",
      "manifest_note": "TerminalFeed inherits the federation host's x402 manifest. The credit ledger and merchant relationship live on tensorfeed.ai, so TF's x402.json is the canonical source for both sites.",
      "accepted_methods": [
        {
          "method": "exact",
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "asset_symbol": "USDC",
          "extra": { "name": "USD Coin", "version": "2" },
          "extra_note": "EIP-712 domain hint for the canonical Coinbase x402 V2 surface. Native USDC on Base mainnet (Circle's 0x833589...) reports name() = \"USD Coin\". The Coinbase spec example showing name: \"USDC\" is the Sepolia value; signing with that on mainnet produces a different EIP-712 domain hash and the contract rejects with FiatTokenV2: invalid signature.",
          "header": "X-Payment-Tx",
          "value": "Federated through tensorfeed.ai's credit ledger via the /api/internal/validate plus /api/internal/commit rail. A bearer token minted from a Base USDC payment on TensorFeed works on TerminalFeed."
        }
      ],
      "evaluating_methods": [
        {
          "method": "stripe",
          "credential_type": "shared_payment_token",
          "status": "under_evaluation_via_federation_host",
          "spec": "https://link.com/agents",
          "note": "Stripe Link agents (link.com/agents) issue Shared Payment Tokens for HTTP 402 endpoints that advertise method=stripe in the www-authenticate header. Federation host tensorfeed.ai is evaluating SPT verification. When live, TerminalFeed will inherit SPT acceptance through the federation's validate plus commit rail without needing its own Stripe merchant account."
        }
      ]
    }
  },
  "data_license": {
    "type": "inference-only",
    "description": "Premium API responses are licensed for inference use only. Use of TerminalFeed premium data for training, fine-tuning, evaluation, or distillation of machine learning models is prohibited.",
    "terms_url": "https://terminalfeed.io/terms#premium",
    "section": "17.1"
  },
  "deprecation": {
    "notice_days": 90,
    "channel": "https://terminalfeed.io/changelog",
    "policy": "Endpoint removal or breaking change requires 90 days notice on /changelog. Receipts and on-chain payment records are never deleted."
  },
  "sanctions": {
    "screening": "Chainalysis public sanctions API on every credit purchase via the shared TensorFeed payment Worker. Geo-IP block on /api/payment/buy-credits for CU/IR/KP/SY. See https://terminalfeed.io/terms#premium Section 17.9."
  },
  "built_with_claude": {
    "statement": "TerminalFeed was designed by Ripper in collaboration with Claude (Anthropic). Specific systems Claude designed: the premium /api/pro/* endpoints (briefing, macro, crypto-deep, agent-context, sentiment, world-deltas, correlation-matrix, whales, exchange-flows, defi-tvl, stablecoin-flows, github-velocity), the cross-Worker AFTA rail to TensorFeed (validate + commit handshake), the Ed25519 receipt signing pipeline, the per-endpoint freshness SLA registry, the in-memory cache + stale-cache fallback pattern across 30+ free endpoints, the X bot, and the live world-briefing composer.",
    "verifiable_via": "git log on https://github.com/RipperMercs/terminalfeed shows the build trail."
  },
  "adoption": {
    "open_invitation": "We invite other API publishers to adopt this standard. The schema at https://tensorfeed.ai/.well-known/agent-fair-trade-schema.json is open. Self-publish your own /.well-known/agent-fair-trade.json with your code-pointer attestations. There is no certification authority and no fee. Adoption is the certification.",
    "current_adopters": [
      {
        "site": "tensorfeed.ai",
        "adopted_at": "2026-04-30",
        "manifest": "https://tensorfeed.ai/.well-known/agent-fair-trade.json",
        "receipt_key": "https://tensorfeed.ai/.well-known/tensorfeed-receipt-key.json",
        "manifesto": "https://tensorfeed.ai/agent-fair-trade"
      },
      {
        "site": "terminalfeed.io",
        "adopted_at": "2026-04-30",
        "manifest": "https://terminalfeed.io/.well-known/agent-fair-trade.json",
        "receipt_key": "https://terminalfeed.io/.well-known/terminalfeed-receipt-key.json",
        "manifesto": "https://terminalfeed.io/agent-fair-trade"
      }
    ],
    "network_federation": {
      "description": "AFTA adopters that share a payment rail can federate trust at the credit level. Sister sites in a federation accept each other's bearer tokens via a server-to-server validate + commit handshake, so the user experience is reciprocal access on a single token. Each site signs its own receipts with its own keypair; the federation does not share private keys.",
      "rail_endpoints": {
        "validate": "POST /api/internal/validate { token, cost } -> { ok, credits_remaining, sufficient, reservation_id }",
        "commit": "POST /api/internal/commit { token, cost, endpoint, no_charge_reason?, reservation_id? } -> { ok, credits_charged, balance_after, no_charge_reason }",
        "auth_header": "X-Internal-Auth (constant-time check against shared secret)",
        "race_safety": "atomic-reserve-on-validate. The host atomically decrements the balance on validate and returns a reservation_id. Commit consumes the reservation (charge) or restores it (no-charge). Reservations expire 5 minutes after issue. Closes the parallel-request double-spend race identified by the 2026-05-05 audit. Federation members must thread reservation_id through commit; the host still serves legacy no-reservation_id commits for backwards-compat.",
        "ledger": "No-charge events from federated sites land in the host's pay:no-charge:{date} ledger with the sister-site endpoint path, so the public no-charge record reflects the network. TerminalFeed also keeps a local no-charge ledger so terminalfeed.io/api/payment/no-charge-stats works without round-tripping to TensorFeed."
      },
      "current_federation": [
        {
          "host": "tensorfeed.ai",
          "members": ["tensorfeed.ai", "terminalfeed.io"],
          "credit_ledger_authority": "tensorfeed.ai",
          "established": "2026-04-30",
          "note": "TensorFeed holds the credit ledger; TerminalFeed validates and charges via the shared rail. Both sites issue their own Ed25519 receipts."
        }
      ]
    }
  },
  "lastUpdated": "2026-05-08"
}
