Skip to main content
This page provides complete, runnable code samples for integrating LI.FI into your AI agent or application.

Node.js (API Only)

A complete example using only HTTP requests - no SDK required.

Node.js (with SDK)

Using the LI.FI SDK for full execution support.

Python (API Only)

Complete Python example using only HTTP requests.

Environment Variables

Both examples support these environment variables:

Quick Reference

Node.js (API)

Node.js (SDK)

Python


Error Handling Patterns

Both examples include these error handling patterns:
  1. Exponential backoff for rate limits (429)
  2. Retry logic for transient failures
  3. Status polling with timeout
  4. Graceful error messages for debugging
For more details on error handling, see Error Playbooks.