Documentation Index
Fetch the complete documentation index at: https://docs.useotto.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Otto X brings the Otto AI agent swarm to the X Layer ecosystem. Same x402 thesis — pay per call, no API keys, payment IS the authentication — now settling on X Layer mainnet via OKX’s Onchain OS infrastructure.
Base URL: https://xlayer.ottoai.services
Chain: X Layer Mainnet (Chain ID: 196)
Payment: On-chain micro-payments on X Layer via OKX Facilitator
Discovery:
How It Differs from x402.ottoai.services
| x402.ottoai.services | xlayer.ottoai.services |
|---|
| Chain | Base, Polygon, Solana | X Layer (196) |
| Facilitator | CDP (Coinbase) | OKX Facilitator |
| Payment Token | USDC | Native X Layer payments |
| SDK | @x402/express (Coinbase) | @okxweb3/x402-express (OKX) |
| Endpoints | 32 | 36 |
| Focus | Full agent swarm | DEX + market intel + AI tools + trading resources |
Both deployments serve the same underlying agent intelligence. Otto X adds X Layer-native DeFi endpoints (swap quotes, token pricing, approvals) powered by OKX DEX Aggregator.
OKX Onchain OS Usage
| Module | How It’s Used |
|---|
x402 SDK (@okxweb3/x402-express, @okxweb3/x402-evm, @okxweb3/x402-core) | Payment middleware gating all 36 paid endpoints via OKXFacilitatorClient on X Layer |
| DEX Aggregator API v6 | HMAC-authenticated calls for swap quotes, token pricing, registry, and ERC-20 approvals on chain 196 |
| Agentic Wallet | Project on-chain identity (0xa3db6825de8222e9f8bac136eeb2f65d49a88fcf) |
| OKX API Auth | HMAC-SHA256 request signing for all DEX interactions |
Pricing Overview
X Layer DEX Endpoints
| Endpoint | Price | Description |
|---|
POST /swap | $0.01 | DEX swap quotes + unsigned calldata via OKX DEX Aggregator |
GET /market-alpha | $0.005 | Live token pricing derived from on-chain DEX quotes |
GET /price?token=0x... | $0.002 | Single token USD price via DEX quote |
GET /all-tokens | $0.002 | All tokens supported on X Layer DEX |
GET /approve?token=0x...&amount=N | $0.005 | ERC-20 approval calldata for DEX router |
Market Intelligence
| Endpoint | Price | Description |
|---|
GET /crypto-news | $0.001 | Real-time crypto news with sentiment analysis |
GET /token-alpha?symbol=BTC | $0.10 | Premium token intelligence — news, sentiment, futures |
GET /kol-sentiment | $0.10 | Aggregated sentiment from top 50 crypto KOLs |
GET /trending-altcoins | $0.10 | Top 3 trending altcoins with analysis |
GET /mega-report | $0.25 | Comprehensive daily market briefing |
GET /token-security?address=0x... | $0.10 | Token contract security audit |
GET /funding-rates?symbol=BTC | $0.10 | Derivatives funding rates & open interest |
GET /defi-analytics?protocol=aave | $0.10 | DeFi protocol analytics |
GET /filtered-news?topic=DeFi | $0.10 | AI-filtered news by topic (DeFi, NFTs, Layer2, etc.) |
GET /twitter-summary | $0.001 | Curated crypto Twitter/X digest from top KOLs |
GET /token-details?symbol=BTC | $0.10 | Token price, market cap, 24h change |
GET /yield-alpha | $0.10 | Top DeFi yield opportunities across chains |
GET /tradfi-data?symbol=SPY | $0.10 | TradFi macro intelligence — indices, VIX, DXY, yields (omit symbol for macro dashboard) |
| Endpoint | Price | Description |
|---|
POST /generate-meme | $1.00 | Multi-model image gen via fal.ai (GPT Image 2, Nano Banana Pro) |
GET /llm-research?prompt=... | $0.50 | AI research assistant with web search |
GET /tx-explainer?txHash=0x...&chain=base | $0.01 | Decode & explain EVM transactions across 11 chains |
Trading Resources
Read-only data sourced directly from Otto X’s own libs — Zerion for portfolios, vaults.fyi for yield positions, DeFi Llama for yield markets, Hyperliquid info endpoint for perps data. Wallet-scoped reads default to your Otto X sub-wallet (resolved from your x402 payer); pass ?address=0x... to query any other EVM address.
| Endpoint | Price | Description |
|---|
GET /portfolio | $0.001 | Multi-chain token balances for your Otto X sub-wallet (or ?address=) |
GET /supported-tokens?chainId=8453&search=USDC | $0.001 | Search tokens by symbol on a given chain (CoinGecko registry) |
GET /hyperliquid-account | $0.001 | Hyperliquid perpetual futures account + open positions |
GET /hyperliquid-market?asset=BTC | $0.001 | Perpetual market data + mark prices (omit asset for top-20 by leverage) |
GET /hl-transaction-history | $0.001 | Recent Hyperliquid fills. Optional ?limit= (default 50, max 200) |
GET /yield-markets | $0.001 | Available yield markets via DeFi Llama (filterable by protocol, chainId, tokenSymbol) |
GET /yield-farming-active | $0.001 | Active yield positions via vaults.fyi |
GET /yield-farming-historical | $0.001 | Past Otto X yield exits (sourced from the operation ledger) |
GET /idle-capital | $0.001 | Detect undeployed tokens that could earn yield |
GET /yield-recommendations | $0.001 | Personalized vault recs based on your idle balances |
Agentic Wallet V2 — Autonomous DeFi Execution
Otto X provisions a TEE-custodied sub-wallet for each x402 payer and executes swaps, bridges, and DeFi deposits on their behalf — all signed inside OKX’s TEE, no user-side key management.
| Endpoint | Price | Description |
|---|
GET /sub-wallet?address=0x... | free | Preview — returns your sub-wallet EVM address + supported chains/assets. Call once, cache. Required before building a principalAuth note. |
POST /auto-swap | $0.25 | In-chain swap via OKX DEX aggregator (500+ sources, 20 chains). Accepts principalAuth for one-call UX. |
POST /auto-bridge | $0.50 | Cross-chain bridge via OKX (Stargate / Across / Relay / Gas.zip, 17 chains). Accepts principalAuth. |
POST /auto-defi-invest | $0.25 | Deposit into allowlisted DeFi protocol (Aave V3, Lido, Compound V3, Morpho). Accepts principalAuth. |
POST /auto-defi-withdraw | $0.25 | Redeem an active DeFi position |
POST /auto-withdraw | $0.50 | Escape hatch — sweep funds from your sub-wallet to any external address |
GET /supported-protocols | free | Catalog of allowlisted protocol × chain × token combinations |
GET /defi-positions?address=0x... | free | Active DeFi positions for a sub-wallet |
Allowlisted protocols:
| Protocol | Chains |
|---|
| Aave V3 | Base, Arbitrum, Optimism, Polygon, Ethereum, X Layer |
| Lido | Ethereum |
| Compound V3 | Base, Arbitrum, Ethereum |
| Morpho | Base, Ethereum |
principalAuth launch chains: Base, Arbitrum, Polygon (USDC), X Layer (USDT0). Other chains still work via the legacy 409 funds-required fallback — see below.
Expansion requires mainnet validation of a full deposit→withdraw cycle before a new protocol is added.
Custody Model (Important)
Otto X’s Agentic Wallet is TEE-custodial, not self-custodial:
- Keys are generated and held inside OKX’s Trusted Execution Environment (TEE). Otto AI holds an API credential that authorizes signing; neither Otto nor OKX staff can export the underlying key.
- Users do not control their sub-wallet directly. There is no seed phrase to back up, no MetaMask connection, no co-signer role.
- This trades away the self-custodial property of Otto AI’s Safe-based Trade Execution Agent in exchange for fully autonomous execution (no user signing, no gas management, atomic operations).
POST /auto-withdraw is the escape hatch: users can sweep any token balance to any external address at any time. No approvals, no holds.
- Otto runs an hourly GC that flags inactive empty sub-wallets to prevent capacity squat.
This posture is specific to Otto X on X Layer. Otto AI’s other agents (Market Alpha, Trade Execution, Tools, Prediction Markets) remain non-custodial via Safe + Dynamic MPC.
Aligned with Agent Payments Protocol §8.4
This split — funded wallet off the per-action signing path, hot key in the TEE for autonomous execution — is exactly the architecture OKX’s Agent Payments Protocol whitepaper (§8.4 Separating signing from custody) describes for production agent commerce. Otto X has been running this design on mainnet since March 2026, ahead of the protocol’s public release. Once the APP wire-format spec is published, Otto X sub-wallets are a drop-in Buyer-Agent runtime for charge, session, and upto intents.
One-Call Flow via EIP-3009 principalAuth (recommended)
Recent clients collapse the old two-step funds-required dance into a single HTTP call by including a signed EIP-3009 TransferWithAuthorization note in the request body. The server verifies it, pulls your USDC (or USDT0 on X Layer) directly into your sub-wallet on-chain, then executes the op — all in one response.
Client-side recipe:
-
One-time preview —
GET /sub-wallet?address=0xYOUR_WALLET (free). Cache sub_wallet.evm_address indefinitely; it’s deterministic per payer.
-
Sign two things — your wallet signs:
- The x402 service fee (standard paywall, $0.25 USDT0 on X Layer → Otto treasury).
- An EIP-3009
TransferWithAuthorization note authorizing your USDC on the target chain to flow into your sub-wallet. Modern wallets (MetaMask, Coinbase Wallet, Rabby, Phantom) can batch both into one confirmation screen.
-
POST the op — include
principalAuth in the body:
{
"fromToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"toToken": "0x4200000000000000000000000000000000000006",
"amount": "10",
"chain": "base",
"principalAuth": {
"from": "0xYOUR_WALLET",
"to": "0xYOUR_SUB_WALLET",
"value": "10000000",
"validAfter": 0,
"validBefore": 1776973646,
"nonce": "0x...",
"signature": "0x..."
}
}
Sent with the x402 fee in PAYMENT-SIGNATURE.
Server guarantees, verified before touching the chain:
principalAuth.from MUST equal your x402 payer (no impersonation).
principalAuth.to MUST equal your provisioned sub-wallet (no draining to attacker addresses).
principalAuth.value MUST be ≥ the op’s required amount.
validBefore MUST be in the future; nonce MUST be unseen (replay-safe via a per-signer-per-token-per-nonce DB claim + on-chain authorizationState check).
The server then broadcasts token.transferWithAuthorization(...) (operator pays gas, user funds move straight from their wallet to their sub-wallet — no intermediate custody), tops up the sub-wallet with dust native gas if needed, executes the op, and returns 200 with all tx hashes.
Legacy Flow — HTTP 409 funds_required (fallback)
Clients that can’t sign EIP-3009 notes, or that target chains we haven’t enabled yet, fall back to the two-step flow. POST /auto-* without a principalAuth and with an insufficient sub-wallet balance returns:
{
"status": "funds_required",
"code": "FUNDS_REQUIRED",
"idempotency_key": "a1b2c3...",
"retry_after_deposit": true,
"deposit": {
"deposit_address": "0xYourSubWallet...",
"required_amount": "50",
"token": "USDC",
"chain": "base"
},
"instructions": "Deposit 50 USDC to this address on Base, then retry with header 'idempotency-key: a1b2c3...'. Your x402 payment for this attempt was NOT charged."
}
Because the status is ≥ 400, x402 skips settlement — you’re NOT charged for the funds-required response. Only successful execution settles the service fee.
The same idempotency key can be reused for up to 7 days to re-submit the original intent once funds arrive. Re-submitting the same body with a fresh key returns the same op (dedup on payer + op type + body hash).
Free Endpoints
| Endpoint | Description |
|---|
GET / | Landing page + JSON service discovery |
GET /health | Service health check |
GET /tokens | Curated token registry (16 tokens) |
GET /llm.txt | AI-readable service catalog |
GET /.well-known/x402 | x402 discovery document |
GET /sub-wallet?address=0x... | Auto-provisioned sub-wallet EVM address + supported chains/assets |
GET /supported-protocols | DeFi allowlist catalog |
GET /defi-positions?address=0x... | Active DeFi positions (public on-chain read) |
x402 Payment Flow (OKX)
The flow is the same as our Base/Polygon deployment, but settlement happens on X Layer via OKX Facilitator instead of CDP Facilitator.
1. Send request → GET /crypto-news
2. Get 402 ← Payment Required ($0.001, X Layer)
3. Pay on-chain → Transfer on X Layer mainnet (chain 196)
4. Retry + proof → GET /crypto-news + payment header
5. Verified → OKX Facilitator confirms payment
6. Get data ← News report with sentiment
Token Registry
Otto X maintains a curated registry of 16 X Layer tokens, available for free at GET /tokens.
| Category | Tokens |
|---|
| Native | OKB |
| Stablecoins | USDT, USDG, USDC, USDe, frxUSD |
| Wrapped | WETH, WOKB, XBTC, XETH, XSOL, XOKSOL |
| DeFi | sUSDe, rsETH, LINK |
| Meme | XDOG |
The paid GET /all-tokens endpoint returns the full list from OKX DEX Aggregator (100+ tokens).
Quick Start
# Health check (free)
curl https://xlayer.ottoai.services/health
# Token registry (free)
curl https://xlayer.ottoai.services/tokens
# AI-readable catalog (free)
curl https://xlayer.ottoai.services/llm.txt
# Paid endpoint (returns 402 with payment instructions)
curl https://xlayer.ottoai.services/crypto-news
For a full client example showing discovery and the 402 payment flow, see examples/client.ts in the GitHub repo.
Roadmap
principalAuth chain expansion: add Ethereum, Optimism, Avalanche, BSC for EIP-3009 one-call flows once on-chain gas economics justify it
- Onchain OS One-Time / Batch Payment for principal on X Layer: reroute the principal leg through the OKX Payment protocol so the user’s principal transfer itself is zero-gas (today only the service fee is); offer
aggr_deferred scheme on high-frequency reads so AI-agent hot loops can batch-settle signatures via TEE
- Agentic Wallet allowlist expansion: broaden beyond Aave / Lido / Compound / Morpho once each new protocol clears mainnet validation; add BSC, Avalanche, and Solana DeFi integrations
- AI-routed yield (
/auto-yield): natural-language endpoint that picks the best allowlisted protocol automatically based on current APYs and risk tolerance
- Earn-pay-earn loops: Agents earn via x402, pay for intelligence via x402, compound returns through Otto X — all on X Layer
- OKX Onchain OS Skills integration: Publishing Otto services as first-class skills so Claude Code / Cursor / Codex CLI users can discover and pay for Otto intelligence natively
- Hyperliquid perps via Agentic Wallet: extend beyond OKX’s DeFi catalog by wiring
wallet contract-call against Hyperliquid’s contracts for TP/SL-capable perp execution from the same sub-wallet
- Multi-master sharding: scale beyond 50 sub-wallets per OKX master by sharding across multiple execution masters with deterministic routing