letsfg 2026.5.54 → 2026.5.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,18 +1,18 @@
1
1
  # LetsFG — Your AI agent just learned to book flights. (Node.js)
2
2
 
3
- **200+ airline connectors. Real prices. One function call.** Search 400+ airlines at raw airline prices — **$20–$50 cheaper** than Booking.com, Kayak, and other OTAs. Zero dependencies. Built for AI agents.
3
+ **Server-side search engine. Real prices. One function call.** Search hundreds of airlines at raw airline prices — **$20–$50 cheaper** than Booking.com, Kayak, and other OTAs. Zero dependencies. Built for AI agents.
4
4
 
5
5
  [![GitHub stars](https://img.shields.io/github/stars/LetsFG/LetsFG?style=social)](https://github.com/LetsFG/LetsFG)
6
6
  [![npm](https://img.shields.io/npm/v/letsfg)](https://www.npmjs.com/package/letsfg)
7
7
 
8
- ## Three ways to use LetsFG
8
+ ## Two ways to use LetsFG
9
9
 
10
- | | **Local** (this SDK) | **letsfg.co** (website / agent API) | **Developer API** |
11
- |---|---|---|---|
12
- | **Search cost** | Free | Free | Prepaid credits |
13
- | **Booking URL** | 1% concierge fee (min $3) via letsfg.co | 1% concierge fee (min $3) via letsfg.co | Direct airline URL, no fee |
14
- | **Speed** | 115 min (local browsers) | Seconds | Seconds |
15
- | **Setup** | `npm install letsfg` | [letsfg.co](https://letsfg.co) | [letsfg.co/developers](https://letsfg.co/developers) |
10
+ | | **CLI / SDK** (this package) | **Developer API** |
11
+ |---|---|---|
12
+ | **Search cost** | Free (Twitter/X Bearer token via `letsfg auth`) | Prepaid credits |
13
+ | **Booking URL** | 1% concierge fee (min $3) via letsfg.co | Direct airline URL, no fee |
14
+ | **Speed** | 6090 s | 2–5 s (discover) · 60–90 s (full) |
15
+ | **Setup** | `npm install letsfg` then `letsfg auth` | [letsfg.co/developers](https://letsfg.co/developers) |
16
16
 
17
17
  > **Want direct airline URLs without any per-booking fee?** Use the [Developer API](https://letsfg.co/developers) — prepaid credits, results in seconds, no checkout step.
18
18
 
@@ -62,12 +62,9 @@ console.log(`PNR: ${booking.booking_reference}`);
62
62
  ## Quick Start (CLI)
63
63
 
64
64
  ```bash
65
- export LETSFG_API_KEY=trav_...
65
+ export LETSFG_BEARER_TOKEN=<your-bearer-token>
66
66
 
67
67
  letsfg search GDN BER 2026-03-03 --sort price
68
-
69
- # Fast mode — OTAs + key airlines only (~25 connectors, 20-40s)
70
- letsfg search GDN BER 2026-03-03 --mode fast
71
68
  letsfg search LON BCN 2026-04-01 --json # Machine-readable
72
69
  letsfg unlock off_xxx
73
70
  letsfg book off_xxx -p '{"id":"pas_xxx","given_name":"John",...}' -e john@example.com
@@ -89,96 +86,10 @@ letsfg book off_xxx -p '{"id":"pas_xxx","given_name":"John",...}' -e john@exampl
89
86
  - `offerSummary(offer)` — One-line string summary
90
87
  - `cheapestOffer(result)` — Get cheapest offer from search
91
88
 
92
- ### `searchLocal(origin, destination, dateFrom, options?)`
93
-
94
- Search 200 airline connectors locally (no API key needed). Requires Python + `letsfg` installed.
95
-
96
- > **Note:** Local search results return masked booking links by default. Each offer includes `offer_ref` and `payment_token` fields. To get a direct airline booking URL, use the **concierge unlock flow** (1% fee, min $3 — no API key needed) or sign up for the **Developer API** at [letsfg.co/developers](https://letsfg.co/developers) for fee-free direct links.
97
-
98
- ```typescript
99
- import { searchLocal } from 'letsfg';
100
-
101
- const result = await searchLocal('GDN', 'BCN', '2026-06-15');
102
- console.log(result.total_results);
103
-
104
- // Limit browser concurrency for constrained environments
105
- const result2 = await searchLocal('GDN', 'BCN', '2026-06-15', { maxBrowsers: 4 });
106
- ```
107
-
108
- ### Unlocking offer results
109
-
110
- Local search results include `offer_ref` and `payment_token` on each offer. Use these to retrieve the direct airline booking URL via the concierge flow (no API key required):
111
-
112
- ```typescript
113
- import { searchLocal } from 'letsfg';
114
-
115
- const result = await searchLocal('GDN', 'BCN', '2026-06-15');
116
- const offer = result.offers[0];
117
-
118
- // 1. Initiate checkout — fee = max(price × 1%, $3.00). No API key needed.
119
- const checkoutRes = await fetch('https://letsfg.co/api/developers/checkout', {
120
- method: 'POST',
121
- headers: { 'Content-Type': 'application/json' },
122
- body: JSON.stringify({
123
- offer_id: offer.id,
124
- offer_ref: offer.offer_ref,
125
- payment_token: offer.payment_token,
126
- currency: offer.currency,
127
- price: String(offer.price),
128
- }),
129
- });
130
- const { checkout_url } = await checkoutRes.json();
131
-
132
- // 2. Present checkout_url to the user (or open it programmatically)
133
- console.log(`Pay here: ${checkout_url}`);
134
-
135
- // 3. Poll until payment is confirmed
136
- async function pollVerify(token: string): Promise<string> {
137
- while (true) {
138
- await new Promise(r => setTimeout(r, 3000));
139
- const res = await fetch(
140
- `https://letsfg.co/api/developers/payment-verify?token=${token}`
141
- );
142
- const data = await res.json();
143
- if (data.verified) return data.booking_url;
144
- }
145
- }
146
-
147
- // 4. booking_url is the direct airline link — no further fees
148
- const bookingUrl = await pollVerify(offer.payment_token);
149
- console.log(`Book here: ${bookingUrl}`);
150
- ```
151
-
152
- To skip the per-booking fee entirely, use the [Developer API](https://letsfg.co/developers) — it returns direct airline booking URLs on every search result.
153
-
154
- ### `systemInfo()`
155
-
156
- Get system resource profile and recommended concurrency settings.
157
-
158
- ```typescript
159
- import { systemInfo } from 'letsfg';
160
-
161
- const info = await systemInfo();
162
- console.log(info);
163
- // { platform: 'win32', cpu_cores: 16, ram_total_gb: 31.2, ram_available_gb: 14.7,
164
- // tier: 'standard', recommended_max_browsers: 8, current_max_browsers: 8 }
165
- ```
166
-
167
89
  ## Zero Dependencies
168
90
 
169
91
  Uses native `fetch` (Node 18+). No `axios`, no `node-fetch`, nothing. Safe for sandboxed environments.
170
92
 
171
- ## Performance Tuning
172
-
173
- Local search auto-scales browser concurrency based on available RAM. Override with `maxBrowsers`:
174
-
175
- ```typescript
176
- // Limit to 4 concurrent browsers
177
- await searchLocal('LHR', 'BCN', '2026-04-15', { maxBrowsers: 4 });
178
- ```
179
-
180
- Or set the `LETSFG_MAX_BROWSERS` environment variable globally.
181
-
182
93
  ## Also Available As
183
94
 
184
95
  - **MCP Server**: `npx letsfg-mcp` — [npm](https://www.npmjs.com/package/letsfg-mcp)