git clone --depth 1 https://github.com/internet-court/internet-court-skill /tmp/lifi && cp -r /tmp/lifi/vendored/lifi/lifi ~/.claude/skills/lifiSKILL.md
# LI.FI API Integration
LI.FI aggregates bridges, DEXs, intent solvers, and DeFi protocols behind one API. This skill covers the full product surface:
| Product | Base URL | What it does |
|---------|----------|--------------|
| **Core API** (swaps & bridges) | `https://li.quest/v1` | Quotes, routes, execution data, status tracking across 75+ chains |
| **Composer** (DeFi execution) | `https://li.quest/v1` (same `/quote` endpoint) | One-click swap/bridge + deposit/withdraw into vaults, lending, staking |
| **Earn** (yield data) | `https://earn.li.fi/v1` | Vault discovery, APY/TVL analytics, portfolio positions |
| **Intents** (solver marketplace) | `https://order.li.fi` | Intent-based orders filled by a competitive solver network |
For AI agents, LI.FI also offers an MCP server (`https://mcp.li.quest/mcp`) and a CLI (`@lifi/cli`). LI.FI recommends agents and backends use the REST API directly rather than the SDK.
## Authentication & Rate Limits
API key is **optional** — it only raises rate limits. Header: `x-lifi-api-key` (get one at the [LI.FI Partner Portal](https://portal.li.fi/)).
```bash
curl "https://li.quest/v1/chains" -H "x-lifi-api-key: YOUR_API_KEY"
```
| Tier | `/quote`, `/advanced/routes` | `/advanced/stepTransaction` | Other endpoints |
|------|------------------------------|------------------------------|-----------------|
| Without API key | 75 req / 2 hours | 50 req / 2 hours | 100 req / minute |
| With API key (default) | 100 RPM (2-hour rolling window: 12,000 / 2h) | same | 100 RPM |
Responses include `ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset` (seconds) headers. 429 responses carry error code `1005`. Never expose your API key in client-side code.
## Quick Start — The Five-Call Recipe
The canonical flow for any swap/bridge:
```
1. GET /chains → discover chains (id, key, chainType, nativeToken)
2. GET /tokens → find tokens & decimals (?chains=1,42161)
3. GET /quote → get quote with ready-to-sign transactionRequest
4. [Execute] → if ERC-20: check allowance vs estimate.approvalAddress, approve if needed;
then sign & send transactionRequest
5. GET /status → poll until DONE or FAILED
```
```bash
# 3. Quote (fromToken/toToken accept addresses OR symbols)
curl "https://li.quest/v1/quote?\
fromChain=42161&toChain=10&\
fromToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&\
toToken=0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1&\
fromAmount=10000000&fromAddress=0xYourAddress&slippage=0.005"
# 5. Status (pass fromChain to speed it up; bridge = quote's `tool`)
curl "https://li.quest/v1/status?txHash=0xYourTxHash&fromChain=42161&toChain=10&bridge=across"
```
From the quote response, extract: `transactionRequest` (sign & send), `estimate.approvalAddress` (ERC-20 spender), `estimate.toAmount`/`toAmountMin`, `estimate.executionDuration` (basis for polling), and `tool` (pass as `bridge` to `/status`). Quotes go stale in ~60 seconds — re-fetch before signing if older (and always after a separate approval tx).
## Core Endpoints
### GET /quote
Single best route with transaction data ready for execution.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `fromChain` / `toChain` | string | Yes | Chain ID or key (same value = same-chain swap) |
| `fromToken` / `toToken` | string | Yes | Token address or symbol |
| `fromAmount` | string | Yes | Amount in smallest unit |
| `fromAddress` | string | Yes | Sender wallet address |
| `toAddress` | string | No | Recipient (defaults to fromAddress) |
| `slippage` | number | No | 0.005 = 0.5% (default) |
| `order` | string | No | `FASTEST` or `CHEAPEST` |
| `integrator` | string | No | Your app ID (analytics + fee collection) |
| `fee` | number | No | Integrator fee (0.02 = 2%) |
| `preset` | string | No | Routing preset, e.g. `stablecoin` (see below) |
| `allowBridges` / `denyBridges` / `preferBridges` | string[] | No | Tool keys from `/tools`, or `all`/`none`/`default` |
| `allowExchanges` / `denyExchanges` / `preferExchanges` | string[] | No | Same |
| `allowDestinationCall` | boolean | No | Default true |
| `maxPriceImpact` | number | No | Default 0.10 (10%) |
| `fromAmountForGas` | string | No | Amount converted to gas on destination |
| `skipSimulation` | boolean | No | Faster response, less accurate gas limit |
| `svmPriorityFeeLevel` | string | No | Solana priority fee: `NORMAL`/`FAST`/`ULTRA` |
| `swapStepTimingStrategies` / `routeTimingStrategies` | string[] | No | e.g. `minWaitTime-600-4-300` |
Variants:
- **GET /quote/toAmount** — pass `toAmount` instead of `fromAmount`; API computes the required input.
- **POST /quote/contractCalls** — bridge + arbitrary destination-chain contract calls (manual calldata). For supported DeFi protocols, prefer Composer instead.
### POST /advanced/routes + POST /advanced/stepTransaction
Multiple route options for comparison. Note the different naming: body uses `fromChainId`, `fromTokenAddress` (addresses only), with filters and `preset` inside `options{}`. Routes contain `steps` without transaction data — POST each step to `/advanced/stepTransaction` to populate `transactionRequest`.
Use `/quote` for simple transfers (1 call); use `/advanced/routes` when the user needs choices or price comparison (2+ calls).
### GET /status
`txHash` (required — sending hash, receiving hash, or step id), plus optional `fromChain` (recommended, speeds up response), `toChain`, `bridge`.
**Statuses:** `NOT_FOUND` → `PENDING` → `DONE` | `FAILED`. On `DONE`, check `substatus`: `COMPLETED`, `PARTIAL` (different token received — full value preserved), or `REFUNDED`. See [Status Recovery](#status-tracking--recovery) below.
### Discovery & utility
- **GET /chains** — `?chainTypes=EVM,SVM,UTXO,MVM,TVM`. **If omitted, returns EVM only.** Non-EVM: Solana (SVM), Bitcoin (UTXO), Sui (MVM), Tron (TVM).
- **GET /tokens** — `?chains=1,137&tags=stablecoin&minPriceUSD=0.01`
- **GET /token** — `?chain=POL&token=DAI`
- **GET /tools**0G Compute Network guide for decentralized AI inference, fine-tuning, and GPU services. Covers chatbots, image generation, speech-to-text, SDK integration (0g-serving-broker), processResponse API, broker.inference methods, CLI commands (0g-compute-cli), and account management. Use this skill for any 0G compute, 0G AI, or decentralized GPU question.
Give the AI agent its own EVM wallet with admin-controlled policies the agent CANNOT bypass even under prompt injection. Encrypted keystore (AES-256-GCM, scrypt KDF), policy file the agent has no tool to write, deterministic policy gate on every signing operation, optional local HTTP dashboard. Triggers: agent wallet, give the agent a wallet, agent address, fund the agent, agent autonomy, policy gate, kill switch, agent permissions, bounded autonomy, ERC-4337 alternative, session-key alternative.
Crypto wallet operations via the awal CLI — sign in, check balances, send USDC/ETH/POL/SOL, trade tokens, fund the wallet, and use the x402 payment protocol to discover paid services, pay for API calls, monetize an API, or query onchain data. Use whenever the user mentions signing in, login, authentication, wallet status, balance, address, sending money, paying someone, transferring tokens, ENS names, swapping/trading/converting tokens, funding/topping up/onramp, USDC, ETH, POL, SOL, the x402 bazaar, paid APIs, monetizing an endpoint, or querying onchain data on Base.
Help developers write code that interacts with Alkahest escrow contracts using the TypeScript, Rust, or Python SDK
Interact with Alkahest escrow contracts as a buyer, seller, or oracle using the CLI
Use this skill when the user asks to list, create, inspect, update, disable, re-enable, or revoke AltLLM Portal API keys for external agents or applications. Do NOT use for wallet login, billing history, or payment links.
Use this skill when the user asks to log in or out with a wallet session, fetch a wallet sign-in challenge, verify an externally signed challenge, or troubleshoot AltLLM Portal wallet login for the local altllm CLI. Do NOT use for API key management, billing history, or payment links.
Use this skill when the user asks to inspect AltLLM Portal balance, redeem a promo code, review billing transactions, or view usage analytics by period, model, or API key using the local altllm CLI. Do NOT use for API key lifecycle management or payment-link execution.