Recipe 01 — Get a price quote (1-chain)
Status: ✅ runnable SDK surface:
client.swap.quote(...)Server endpoint:POST /v1/swap/quoteTZ reference: TZ-1 §13.2 (EVM adapter), TZ-3 §3.4 (fee recipient)
What this recipe does
Fetches a price quote for swapping 1 USDC → USDT on Ethereum mainnet using the 1inch v6 aggregator. No transaction is broadcast; this is a read-only estimate suitable for displaying in UI before the user commits to execute.
Prerequisites
pip install cryptoai-gatewayORnpm install @cryptoai/gateway- Env vars:
CRYPTOAI_API_KEY— JWT orcag_live_*API key (or omit for anonymous-tier rate limits)CRYPTOAI_BASE_URL— defaults tohttps://api.cryptoai.gateway
Run
# Python
PYTHONPATH=packages/sdk-py/src python cookbook/recipes/01-price-quote/python_example.py
# TypeScript
npx tsx cookbook/recipes/01-price-quote/typescript_example.ts
Expected output
quote.intent_id = q_01HZ...
quote.estimated_out = 0.9995 USDT
quote.fee_bps = 15
quote.expires_at = 2026-05-12T00:00:30Z
The quote expires 30 seconds after issuance (Phase 4-G quote_ttl_s=30 in
adapters/bridge.py). Pass quote.intent_id to client.swap.execute(...)
(see recipe 02) before that deadline to commit the swap.
What to read next
- Recipe 02 — Execute a swap with slippage protection
- Recipe 03 — Cross-chain swap via LI.FI
- Recipe 17 — Idempotent retry for swaps