serpkite 0.7.0 → 0.8.0

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/dist/index.d.cts CHANGED
@@ -105,7 +105,10 @@ interface paths {
105
105
  };
106
106
  get?: never;
107
107
  put?: never;
108
- /** Google Images */
108
+ /**
109
+ * Google Images
110
+ * @description One page is a block of up to 100 images for 1 credit; page 2 starts at position 101. `num` returns only the first `num` images of the page (same credit). A page past the last one returns empty `results`, free.
111
+ */
109
112
  post: operations["images"];
110
113
  delete?: never;
111
114
  options?: never;
@@ -331,6 +334,118 @@ interface paths {
331
334
  patch?: never;
332
335
  trace?: never;
333
336
  };
337
+ "/v1/chatgpt": {
338
+ parameters: {
339
+ query?: never;
340
+ header?: never;
341
+ path?: never;
342
+ cookie?: never;
343
+ };
344
+ get?: never;
345
+ put?: never;
346
+ /**
347
+ * Ask ChatGPT as a logged-out user and get its answer, cited sources, products and places (5 credits)
348
+ * @description Opens chatgpt.com as a logged-out visitor in a standard Chrome behind our
349
+ * proxies, sends `prompt` and returns the answer. With `web_search` (default
350
+ * true) ChatGPT searches the web; `false` lets it decide. ChatGPT localises
351
+ * prices, shops and places to where the visitor is: set `country` to ask from
352
+ * an exit in that country (residential proxies), or leave it out to ask from
353
+ * any of our exits. Guests get ChatGPT's default free model (`model`).
354
+ * Takes 20–90 s; failed or refused answers are free.
355
+ */
356
+ post: operations["chatgpt"];
357
+ delete?: never;
358
+ options?: never;
359
+ head?: never;
360
+ patch?: never;
361
+ trace?: never;
362
+ };
363
+ "/v1/gemini": {
364
+ parameters: {
365
+ query?: never;
366
+ header?: never;
367
+ path?: never;
368
+ cookie?: never;
369
+ };
370
+ get?: never;
371
+ put?: never;
372
+ /**
373
+ * Ask Google Gemini as a logged-out user and get its answer with the sources it grounded on (5 credits)
374
+ * @description Opens gemini.google.com as a logged-out visitor and sends `prompt`. Gemini
375
+ * answers guests from residential and ISP exits only; grounded answers take
376
+ * 40–90 s. `country` asks from an exit in that country.
377
+ */
378
+ post: operations["gemini"];
379
+ delete?: never;
380
+ options?: never;
381
+ head?: never;
382
+ patch?: never;
383
+ trace?: never;
384
+ };
385
+ "/v1/copilot": {
386
+ parameters: {
387
+ query?: never;
388
+ header?: never;
389
+ path?: never;
390
+ cookie?: never;
391
+ };
392
+ get?: never;
393
+ put?: never;
394
+ /**
395
+ * Ask Microsoft Copilot Search on Bing and get its answer, cited sources and products (3 credits)
396
+ * @description Microsoft Copilot Search (bing.com/copilotsearch, Bing's AI answer).
397
+ * The Copilot app itself has no logged-out access. `country` and `language`
398
+ * set Bing's market. Products are Bing's sponsored product cards. 15–40 s.
399
+ */
400
+ post: operations["copilot"];
401
+ delete?: never;
402
+ options?: never;
403
+ head?: never;
404
+ patch?: never;
405
+ trace?: never;
406
+ };
407
+ "/v1/ai_mode": {
408
+ parameters: {
409
+ query?: never;
410
+ header?: never;
411
+ path?: never;
412
+ cookie?: never;
413
+ };
414
+ get?: never;
415
+ put?: never;
416
+ /**
417
+ * Ask Google AI Mode and get its answer, cited sources and products (3 credits)
418
+ * @description Google's AI Mode (`udm=50`) for `prompt`, logged out. `country` is the
419
+ * country Google answers for. 10–45 s.
420
+ */
421
+ post: operations["aiMode"];
422
+ delete?: never;
423
+ options?: never;
424
+ head?: never;
425
+ patch?: never;
426
+ trace?: never;
427
+ };
428
+ "/v1/brave_ai": {
429
+ parameters: {
430
+ query?: never;
431
+ header?: never;
432
+ path?: never;
433
+ cookie?: never;
434
+ };
435
+ get?: never;
436
+ put?: never;
437
+ /**
438
+ * Ask Brave Search's AI answer and get it with cited sources, the searches it ran and products (2 credits)
439
+ * @description Brave Search's AI answer ("Ask Brave") for `prompt`, logged out. `country`
440
+ * sets Brave's market (prices and shops follow it). About 10 s.
441
+ */
442
+ post: operations["braveAi"];
443
+ delete?: never;
444
+ options?: never;
445
+ head?: never;
446
+ patch?: never;
447
+ trace?: never;
448
+ };
334
449
  "/v1/extract": {
335
450
  parameters: {
336
451
  query?: never;
@@ -572,6 +687,13 @@ interface paths {
572
687
  * account (403 `forbidden`). A monitor pauses itself after 10 failed runs in a row
573
688
  * (search errors, insufficient credits or webhook failures) or when its key is
574
689
  * revoked; set `active: true` to resume.
690
+ *
691
+ * With an AI assistant `endpoint` (chatgpt, gemini, copilot, ai_mode,
692
+ * brave_ai) the monitor asks `prompt` every run and reports every answer
693
+ * (AI visibility is tracked over time): `text`, `markdown`, `sources`,
694
+ * `new_sources` (links not seen in earlier runs), `search_queries`,
695
+ * `products` and, with `track`, `mentions`. Each run costs the endpoint's
696
+ * price.
575
697
  */
576
698
  post: operations["createMonitor"];
577
699
  delete?: never;
@@ -913,7 +1035,7 @@ interface components {
913
1035
  /** @description Map point "@lat,lng,14z" (maps and places only; zoom optional, default 14z): the map is searched around that point at that zoom, wherever the request comes from. Overrides location */
914
1036
  ll?: string;
915
1037
  /**
916
- * @description 10, or up to 100 for the depth bundle on search and news (7 credits for 100; values between round up to whole pages). Other verticals return one page of 10
1038
+ * @description 1–100. Up to 10 returns one page (10 results, 1 credit; trim it yourself for fewer). Above 10 on search and news is the depth bundle (7 credits for 100; values between round up to whole pages). On images a page is a block of up to 100 images (1 credit) and num (default 100) is how many of them to return; `page` moves to the next block. Other verticals return one page of 10
917
1039
  * @default 10
918
1040
  */
919
1041
  num?: number;
@@ -1053,6 +1175,135 @@ interface components {
1053
1175
  max_age?: number;
1054
1176
  engine?: components["schemas"]["EngineParam"];
1055
1177
  };
1178
+ AssistantRequest: {
1179
+ /** @description The message to the assistant */
1180
+ prompt: string;
1181
+ /** @description Ask from this country (ISO 3166-1 alpha-2): answers, prices and shops follow it */
1182
+ country?: string;
1183
+ /** @description Interface language (e.g. en, de); the answer follows the prompt's language */
1184
+ language?: string;
1185
+ track?: components["schemas"]["TrackList"];
1186
+ /**
1187
+ * @description Also return the answer page's HTML (`html`)
1188
+ * @default false
1189
+ */
1190
+ include_html?: boolean;
1191
+ /**
1192
+ * @default json
1193
+ * @enum {string}
1194
+ */
1195
+ format?: "json" | "markdown" | "compact";
1196
+ fields?: string;
1197
+ /** @description Accept a cached answer up to this many seconds old (half price); answers are cached for at most an hour */
1198
+ max_age?: number;
1199
+ };
1200
+ ChatGPTRequest: {
1201
+ /** @description The message to ChatGPT */
1202
+ prompt: string;
1203
+ /**
1204
+ * @description Make ChatGPT search the web; false lets it decide (it then searches for about two thirds of shopping and local prompts)
1205
+ * @default true
1206
+ */
1207
+ web_search?: boolean;
1208
+ /** @description Ask from an exit in this country (ISO 3166-1 alpha-2, residential proxies). Without it any of our exits asks (mostly US and EU) */
1209
+ country?: string;
1210
+ track?: components["schemas"]["TrackList"];
1211
+ /** @default false */
1212
+ include_html?: boolean;
1213
+ /**
1214
+ * @default json
1215
+ * @enum {string}
1216
+ */
1217
+ format?: "json" | "markdown" | "compact";
1218
+ fields?: string;
1219
+ max_age?: number;
1220
+ };
1221
+ /** @description Brands ("Acme") and domains ("acme.com", subdomains match) to check the answer for; each comes back in `mentions` */
1222
+ TrackList: string[];
1223
+ AISource: {
1224
+ /** @description The number the answer cites it with ([n] in markdown) */
1225
+ position: number;
1226
+ title?: string;
1227
+ link: string;
1228
+ domain: string;
1229
+ snippet?: string;
1230
+ date?: string;
1231
+ /** @description Cited inline in the answer (false: only listed beside it) */
1232
+ cited: boolean;
1233
+ };
1234
+ AIProduct: {
1235
+ position: number;
1236
+ title: string;
1237
+ brand?: string;
1238
+ /** @description As shown */
1239
+ price?: string;
1240
+ extracted_price?: number;
1241
+ /** @description ISO 4217 when the symbol is unambiguous */
1242
+ currency?: string;
1243
+ rating?: number;
1244
+ reviews?: number;
1245
+ merchant?: string;
1246
+ link?: string;
1247
+ image?: string;
1248
+ description?: string;
1249
+ /** @description A paid placement (an ad card shown with the answer) */
1250
+ sponsored?: boolean;
1251
+ };
1252
+ Mention: {
1253
+ term: string;
1254
+ /** @description The answer text names it (a domain: names the domain) */
1255
+ mentioned: boolean;
1256
+ /** @description A cited source matches it */
1257
+ cited: boolean;
1258
+ /** @description Positions of the matching sources */
1259
+ sources: number[];
1260
+ /** @description Positions of the matching products */
1261
+ products?: number[];
1262
+ /** @description Where the text first names it, 0 (start) to 1 (end); -1 when it doesn't */
1263
+ text_position: number;
1264
+ };
1265
+ /** @description The normalised request of an AI assistant endpoint (the path names the assistant, so there is no engine) */
1266
+ AssistantEcho: {
1267
+ /**
1268
+ * @example chatgpt
1269
+ * @example gemini
1270
+ */
1271
+ endpoint: string;
1272
+ prompt: string;
1273
+ country?: string;
1274
+ /** @description Not on chatgpt */
1275
+ language?: string;
1276
+ /** @description chatgpt only */
1277
+ web_search?: boolean;
1278
+ include_html?: boolean;
1279
+ };
1280
+ AssistantResponse: {
1281
+ request: components["schemas"]["AssistantEcho"];
1282
+ /** @description The answer as plain text */
1283
+ text: string;
1284
+ /** @description The answer as Markdown, citations as [n](link) matching sources[].position */
1285
+ markdown: string;
1286
+ /** @description Only with include_html=true */
1287
+ html?: string;
1288
+ /** @description The model the assistant reports, when it does (e.g. ChatGPT's guest model) */
1289
+ model?: string;
1290
+ sources: components["schemas"]["AISource"][];
1291
+ /** @description The searches the assistant ran (fan-out) where it shows them */
1292
+ search_queries: string[];
1293
+ products: components["schemas"]["AIProduct"][];
1294
+ /** @description Local businesses the answer showed */
1295
+ places?: components["schemas"]["PlaceResult"][];
1296
+ related_questions?: string[];
1297
+ /** @description With track only */
1298
+ mentions?: components["schemas"]["Mention"][];
1299
+ meta: components["schemas"]["Meta"];
1300
+ };
1301
+ AIOverview: {
1302
+ text: string;
1303
+ /** @description Citations as [n](link) matching sources[].position */
1304
+ markdown: string;
1305
+ sources: components["schemas"]["AISource"][];
1306
+ };
1056
1307
  WebpageRequest: {
1057
1308
  /**
1058
1309
  * Format: uri
@@ -1660,6 +1911,7 @@ interface components {
1660
1911
  * @example search
1661
1912
  * @example news
1662
1913
  * @example webpage
1914
+ * @example chatgpt
1663
1915
  */
1664
1916
  endpoint: string;
1665
1917
  /** @description The engine policy as asked (google, auto, one provider or a list) */
@@ -1691,6 +1943,11 @@ interface components {
1691
1943
  boost_domains?: string[];
1692
1944
  highlights?: boolean;
1693
1945
  include_answer?: boolean;
1946
+ /** @description AI assistant endpoints */
1947
+ prompt?: string;
1948
+ /** @description /v1/chatgpt */
1949
+ web_search?: boolean;
1950
+ include_html?: boolean;
1694
1951
  } & {
1695
1952
  [key: string]: unknown;
1696
1953
  };
@@ -1774,6 +2031,8 @@ interface components {
1774
2031
  top_stories?: components["schemas"]["NewsResult"][];
1775
2032
  places?: components["schemas"]["PlaceResult"][];
1776
2033
  answer?: components["schemas"]["SearchAnswer"];
2034
+ /** @description Google's AI Overview when the page showed one */
2035
+ ai_overview?: components["schemas"]["AIOverview"];
1777
2036
  meta: components["schemas"]["Meta"];
1778
2037
  };
1779
2038
  ImageResult: {
@@ -2120,7 +2379,7 @@ interface components {
2120
2379
  };
2121
2380
  BatchCreateRequest: {
2122
2381
  /** @enum {string} */
2123
- endpoint: "search" | "images" | "videos" | "news" | "maps" | "places" | "place" | "reviews" | "shopping" | "scholar" | "patents" | "autocomplete" | "webpage";
2382
+ endpoint: "search" | "images" | "videos" | "news" | "maps" | "places" | "place" | "reviews" | "shopping" | "scholar" | "patents" | "autocomplete" | "webpage" | "chatgpt" | "gemini" | "copilot" | "ai_mode" | "brave_ai";
2124
2383
  /** @description Request bodies for `endpoint` (same fields as the realtime endpoint) */
2125
2384
  requests: {
2126
2385
  [key: string]: unknown;
@@ -2202,10 +2461,15 @@ interface components {
2202
2461
  message?: string;
2203
2462
  };
2204
2463
  };
2205
- /** @description The saved request a monitor reruns: a search (q and options) or, for webpage monitors, url (and country) */
2464
+ /** @description The saved request a monitor reruns: a search (q and options), for webpage monitors url (and country), or for AI assistant monitors prompt (with country, language, web_search and track) */
2206
2465
  MonitorSearch: {
2207
2466
  q?: string;
2208
2467
  url?: string;
2468
+ /** @description AI assistant monitors */
2469
+ prompt?: string;
2470
+ /** @description endpoint=chatgpt */
2471
+ web_search?: boolean;
2472
+ track?: string[];
2209
2473
  country?: string;
2210
2474
  language?: string;
2211
2475
  location?: string;
@@ -2218,7 +2482,7 @@ interface components {
2218
2482
  exclude_domains?: string[];
2219
2483
  engine?: string[];
2220
2484
  };
2221
- /** @description Search and news monitors need `q`; webpage monitors need `url` and take only `country` besides */
2485
+ /** @description Search and news monitors need `q`; webpage monitors need `url` and take only `country` besides; AI assistant monitors need `prompt` and take `country`, `language` (not chatgpt), `web_search` (chatgpt) and `track` */
2222
2486
  MonitorCreateRequest: {
2223
2487
  q?: string;
2224
2488
  /**
@@ -2226,11 +2490,16 @@ interface components {
2226
2490
  * @description endpoint=webpage: the page to watch for content changes
2227
2491
  */
2228
2492
  url?: string;
2493
+ /** @description AI assistant monitors: the prompt asked every run */
2494
+ prompt?: string;
2495
+ /** @description endpoint=chatgpt */
2496
+ web_search?: boolean;
2497
+ track?: components["schemas"]["TrackList"];
2229
2498
  /**
2230
2499
  * @default search
2231
2500
  * @enum {string}
2232
2501
  */
2233
- endpoint?: "search" | "news" | "webpage";
2502
+ endpoint?: "search" | "news" | "webpage" | "chatgpt" | "gemini" | "copilot" | "ai_mode" | "brave_ai";
2234
2503
  /** @description Your own JSON object (at most 2 KB), echoed on the monitor and in its webhooks */
2235
2504
  metadata?: {
2236
2505
  [key: string]: unknown;
@@ -2282,11 +2551,14 @@ interface components {
2282
2551
  [key: string]: unknown;
2283
2552
  } | null;
2284
2553
  /**
2285
- * @description Switching between a search and a page drops the other kind's fields
2554
+ * @description Switching between a search, a page and an AI prompt drops the other kinds' fields
2286
2555
  * @enum {string}
2287
2556
  */
2288
- endpoint?: "search" | "news" | "webpage";
2557
+ endpoint?: "search" | "news" | "webpage" | "chatgpt" | "gemini" | "copilot" | "ai_mode" | "brave_ai";
2289
2558
  q?: string;
2559
+ prompt?: string;
2560
+ web_search?: boolean;
2561
+ track?: components["schemas"]["TrackList"];
2290
2562
  /**
2291
2563
  * Format: uri
2292
2564
  * @description endpoint=webpage only
@@ -2311,7 +2583,7 @@ interface components {
2311
2583
  id: string;
2312
2584
  name: string;
2313
2585
  /** @enum {string} */
2314
- endpoint: "search" | "news" | "webpage";
2586
+ endpoint: "search" | "news" | "webpage" | "chatgpt" | "gemini" | "copilot" | "ai_mode" | "brave_ai";
2315
2587
  request: components["schemas"]["MonitorSearch"];
2316
2588
  metadata?: {
2317
2589
  [key: string]: unknown;
@@ -2344,7 +2616,7 @@ interface components {
2344
2616
  status: "ok" | "error" | "webhook_failed" | "paused";
2345
2617
  error?: string | null;
2346
2618
  new_results: number;
2347
- /** @description The new results (OrganicResult-shaped for search, NewsResult for news, MonitorPageChange for webpage); null when there were none or after 24 hours */
2619
+ /** @description The new results (OrganicResult-shaped for search, NewsResult for news, MonitorPageChange for webpage, one MonitorAnswer per run for AI assistants); null when there were none or after 24 hours */
2348
2620
  results?: {
2349
2621
  [key: string]: unknown;
2350
2622
  }[] | null;
@@ -2370,6 +2642,19 @@ interface components {
2370
2642
  markdown: string;
2371
2643
  published_at?: string;
2372
2644
  };
2645
+ /** @description What an AI assistant monitor reports every run (one item per run) */
2646
+ MonitorAnswer: {
2647
+ text: string;
2648
+ markdown: string;
2649
+ model?: string;
2650
+ sources: components["schemas"]["AISource"][];
2651
+ /** @description Links of the sources not seen in earlier runs */
2652
+ new_sources: string[];
2653
+ search_queries: string[];
2654
+ products?: components["schemas"]["AIProduct"][];
2655
+ /** @description With track only */
2656
+ mentions?: components["schemas"]["Mention"][];
2657
+ };
2373
2658
  MonitorRunList: {
2374
2659
  results: components["schemas"]["MonitorRun"][];
2375
2660
  /**
@@ -2394,11 +2679,13 @@ interface components {
2394
2679
  run_id: string;
2395
2680
  name: string;
2396
2681
  /** @enum {string} */
2397
- endpoint: "search" | "news" | "webpage";
2398
- /** @description The saved query (empty for webpage monitors) */
2399
- q: string;
2682
+ endpoint: "search" | "news" | "webpage" | "chatgpt" | "gemini" | "copilot" | "ai_mode" | "brave_ai";
2683
+ /** @description The saved query (empty for webpage monitors */
2684
+ q?: string;
2400
2685
  /** @description webpage monitors only */
2401
2686
  url?: string;
2687
+ /** @description AI assistant monitors only (instead of q) */
2688
+ prompt?: string;
2402
2689
  /** @description The monitor's metadata */
2403
2690
  metadata?: {
2404
2691
  [key: string]: unknown;
@@ -2407,7 +2694,7 @@ interface components {
2407
2694
  first_run: boolean;
2408
2695
  /** Format: date-time */
2409
2696
  run_at: string;
2410
- /** @description Results not seen in earlier runs (OrganicResult-shaped for search, NewsResult for news, MonitorPageChange for webpage) */
2697
+ /** @description Results not seen in earlier runs (OrganicResult-shaped for search, NewsResult for news, MonitorPageChange for webpage); for AI assistant monitors the run's answer (one MonitorAnswer, sent every run) */
2411
2698
  new_results: {
2412
2699
  [key: string]: unknown;
2413
2700
  }[];
@@ -2745,6 +3032,22 @@ interface components {
2745
3032
  };
2746
3033
  };
2747
3034
  /** @description OK (text/markdown when format=markdown) */
3035
+ AssistantOK: {
3036
+ headers: {
3037
+ "X-Credits-Used": components["headers"]["CreditsUsed"];
3038
+ "X-Credits-Remaining": components["headers"]["CreditsRemaining"];
3039
+ "X-Cost-USD": components["headers"]["CostUSD"];
3040
+ "X-Cache": components["headers"]["Cache"];
3041
+ "X-Latency-Ms": components["headers"]["LatencyMs"];
3042
+ "X-Tokens-Estimate": components["headers"]["TokensEstimate"];
3043
+ [name: string]: unknown;
3044
+ };
3045
+ content: {
3046
+ "application/json": components["schemas"]["AssistantResponse"];
3047
+ "text/markdown": string;
3048
+ };
3049
+ };
3050
+ /** @description OK (text/markdown when format=markdown) */
2748
3051
  WebpageOK: {
2749
3052
  headers: {
2750
3053
  "X-Credits-Used": components["headers"]["CreditsUsed"];
@@ -3080,6 +3383,146 @@ interface operations {
3080
3383
  503: components["responses"]["Unavailable"];
3081
3384
  };
3082
3385
  };
3386
+ chatgpt: {
3387
+ parameters: {
3388
+ query?: never;
3389
+ header?: never;
3390
+ path?: never;
3391
+ cookie?: never;
3392
+ };
3393
+ requestBody: {
3394
+ content: {
3395
+ /**
3396
+ * @example {
3397
+ * "prompt": "What are the best CRMs for a 10-person startup?",
3398
+ * "track": [
3399
+ * "hubspot.com",
3400
+ * "Pipedrive"
3401
+ * ]
3402
+ * }
3403
+ */
3404
+ "application/json": components["schemas"]["ChatGPTRequest"];
3405
+ };
3406
+ };
3407
+ responses: {
3408
+ 200: components["responses"]["AssistantOK"];
3409
+ 400: components["responses"]["Error"];
3410
+ 401: components["responses"]["Error"];
3411
+ 402: components["responses"]["Error"];
3412
+ 403: components["responses"]["Error"];
3413
+ 429: components["responses"]["Error"];
3414
+ 503: components["responses"]["Unavailable"];
3415
+ };
3416
+ };
3417
+ gemini: {
3418
+ parameters: {
3419
+ query?: never;
3420
+ header?: never;
3421
+ path?: never;
3422
+ cookie?: never;
3423
+ };
3424
+ requestBody: {
3425
+ content: {
3426
+ /**
3427
+ * @example {
3428
+ * "prompt": "How do heat pumps work in cold climates?"
3429
+ * }
3430
+ */
3431
+ "application/json": components["schemas"]["AssistantRequest"];
3432
+ };
3433
+ };
3434
+ responses: {
3435
+ 200: components["responses"]["AssistantOK"];
3436
+ 400: components["responses"]["Error"];
3437
+ 401: components["responses"]["Error"];
3438
+ 402: components["responses"]["Error"];
3439
+ 403: components["responses"]["Error"];
3440
+ 429: components["responses"]["Error"];
3441
+ 503: components["responses"]["Unavailable"];
3442
+ };
3443
+ };
3444
+ copilot: {
3445
+ parameters: {
3446
+ query?: never;
3447
+ header?: never;
3448
+ path?: never;
3449
+ cookie?: never;
3450
+ };
3451
+ requestBody: {
3452
+ content: {
3453
+ /**
3454
+ * @example {
3455
+ * "prompt": "best mattress for side sleepers",
3456
+ * "country": "us"
3457
+ * }
3458
+ */
3459
+ "application/json": components["schemas"]["AssistantRequest"];
3460
+ };
3461
+ };
3462
+ responses: {
3463
+ 200: components["responses"]["AssistantOK"];
3464
+ 400: components["responses"]["Error"];
3465
+ 401: components["responses"]["Error"];
3466
+ 402: components["responses"]["Error"];
3467
+ 403: components["responses"]["Error"];
3468
+ 429: components["responses"]["Error"];
3469
+ 503: components["responses"]["Unavailable"];
3470
+ };
3471
+ };
3472
+ aiMode: {
3473
+ parameters: {
3474
+ query?: never;
3475
+ header?: never;
3476
+ path?: never;
3477
+ cookie?: never;
3478
+ };
3479
+ requestBody: {
3480
+ content: {
3481
+ /**
3482
+ * @example {
3483
+ * "prompt": "how to remove a red wine stain from a wool carpet"
3484
+ * }
3485
+ */
3486
+ "application/json": components["schemas"]["AssistantRequest"];
3487
+ };
3488
+ };
3489
+ responses: {
3490
+ 200: components["responses"]["AssistantOK"];
3491
+ 400: components["responses"]["Error"];
3492
+ 401: components["responses"]["Error"];
3493
+ 402: components["responses"]["Error"];
3494
+ 403: components["responses"]["Error"];
3495
+ 429: components["responses"]["Error"];
3496
+ 503: components["responses"]["Unavailable"];
3497
+ };
3498
+ };
3499
+ braveAi: {
3500
+ parameters: {
3501
+ query?: never;
3502
+ header?: never;
3503
+ path?: never;
3504
+ cookie?: never;
3505
+ };
3506
+ requestBody: {
3507
+ content: {
3508
+ /**
3509
+ * @example {
3510
+ * "prompt": "best budget noise cancelling headphones under $100"
3511
+ * }
3512
+ */
3513
+ "application/json": components["schemas"]["AssistantRequest"];
3514
+ };
3515
+ };
3516
+ responses: {
3517
+ 200: components["responses"]["AssistantOK"];
3518
+ 400: components["responses"]["Error"];
3519
+ 401: components["responses"]["Error"];
3520
+ 402: components["responses"]["Error"];
3521
+ 403: components["responses"]["Error"];
3522
+ 429: components["responses"]["Error"];
3523
+ 503: components["responses"]["Unavailable"];
3524
+ };
3525
+ };
3083
3526
  extract: {
3084
3527
  parameters: {
3085
3528
  query?: never;
@@ -4023,6 +4466,14 @@ type WebpageParams = Schemas["WebpageRequest"];
4023
4466
  type RankParams = Schemas["RankRequest"];
4024
4467
  type MapParams = Schemas["MapRequest"];
4025
4468
  type ExtractParams = Schemas["ExtractRequest"];
4469
+ /**
4470
+ * Body of `gemini`, `copilot`, `aiMode` and `braveAi`: `prompt` (required), `country`, `language`,
4471
+ * `track` (brands and domains to look for, returned in `mentions`), `include_html`, `format`,
4472
+ * `fields`, `max_age`.
4473
+ */
4474
+ type AssistantParams = Schemas["AssistantRequest"];
4475
+ /** Body of `chatgpt`: like {@link AssistantParams} plus `web_search` (default true), without `language`. */
4476
+ type ChatGPTParams = Schemas["ChatGPTRequest"];
4026
4477
  /** `format` values accepted by the verticals. */
4027
4478
  type Format = NonNullable<SearchParams["format"]>;
4028
4479
  type Meta = Schemas["Meta"];
@@ -4073,6 +4524,18 @@ type Citation = Schemas["Citation"];
4073
4524
  type SearchAnswer = Schemas["SearchAnswer"];
4074
4525
  /** `meta.llm`: the model behind an AI response and the tokens it used. */
4075
4526
  type LLMUsage = Schemas["LLMUsage"];
4527
+ /** A source of an AI assistant answer or AI Overview; `cited` when the answer cites it inline. */
4528
+ type AISource = Schemas["AISource"];
4529
+ /** A product an AI assistant showed (price as shown, `extracted_price`, `currency`, merchant…). */
4530
+ type AIProduct = Schemas["AIProduct"];
4531
+ /**
4532
+ * One `track` term checked against an AI answer: `mentioned` (the text names it), `cited` (a cited
4533
+ * source matches it), the matching `sources` / `products` positions and `text_position` (0-1, -1
4534
+ * when the text doesn't name it).
4535
+ */
4536
+ type Mention = Schemas["Mention"];
4537
+ /** `ai_overview` on `search`: Google's AI Overview when the page showed one. */
4538
+ type AIOverview = Schemas["AIOverview"];
4076
4539
  type SearchResponse = Schemas["SearchResponse"];
4077
4540
  type ImagesResponse = Schemas["ImagesResponse"];
4078
4541
  type VideosResponse = Schemas["VideosResponse"];
@@ -4089,6 +4552,14 @@ type WebpageResponse = Schemas["WebpageResponse"];
4089
4552
  type RankResponse = Schemas["RankResponse"];
4090
4553
  type MapResponse = Schemas["MapResponse"];
4091
4554
  type ExtractResponse = Schemas["ExtractResponse"];
4555
+ /**
4556
+ * Returned by `chatgpt`, `gemini`, `copilot`, `aiMode` and `braveAi`: the answer (`text`,
4557
+ * `markdown` with `[n](link)` citations), `sources`, `search_queries`, `products`, `places`,
4558
+ * `related_questions`, `model` where the assistant reports it, and `mentions` with `track`.
4559
+ */
4560
+ type AssistantResponse = Schemas["AssistantResponse"];
4561
+ /** The AI assistant endpoints (also accepted by batches and monitors). */
4562
+ type AssistantEndpoint = "chatgpt" | "gemini" | "copilot" | "ai_mode" | "brave_ai";
4092
4563
  type Account = Schemas["Account"];
4093
4564
  type Status = Schemas["Status"];
4094
4565
  /**
@@ -4155,6 +4626,11 @@ type BatchRequestMap = {
4155
4626
  patents: SearchParams;
4156
4627
  autocomplete: SearchParams;
4157
4628
  webpage: WebpageParams;
4629
+ chatgpt: ChatGPTParams;
4630
+ gemini: AssistantParams;
4631
+ copilot: AssistantParams;
4632
+ ai_mode: AssistantParams;
4633
+ brave_ai: AssistantParams;
4158
4634
  };
4159
4635
  /** Body of `POST /v1/batches`. `requests` takes the same fields as the realtime endpoint. */
4160
4636
  type BatchCreateParams = {
@@ -4206,7 +4682,10 @@ type ResearchTask = Omit<Schemas["ResearchTask"], "result"> & {
4206
4682
  type ResearchProgress = NonNullable<Schemas["ResearchTask"]["progress"]>;
4207
4683
  /**
4208
4684
  * Body of `POST /v1/monitors`. `search` and `news` monitors need `q`; `webpage` monitors need
4209
- * `url` (and take only `country` besides) and report the page when its content changes.
4685
+ * `url` (and take only `country` besides) and report the page when its content changes. AI
4686
+ * assistant monitors (`chatgpt`, `gemini`, `copilot`, `ai_mode`, `brave_ai`) need `prompt` and take
4687
+ * `country`, `language` (not chatgpt), `web_search` (chatgpt) and `track`; every run reports the
4688
+ * answer as a {@link MonitorAnswer}.
4210
4689
  * `metadata` is your own JSON object (at most 2 KB), echoed on the monitor and its webhooks.
4211
4690
  * `webhook_url` is optional: without one, new results are read from the run history
4212
4691
  * (`monitors.runs`). `active: false` creates the monitor paused.
@@ -4225,7 +4704,10 @@ type MonitorUpdateParams = Omit<Schemas["MonitorUpdateRequest"], "engine"> & {
4225
4704
  engine?: Engine;
4226
4705
  };
4227
4706
  type Monitor = Schemas["Monitor"];
4228
- /** What a monitor watches: a `search`, `news` search, or a `webpage` for content changes. */
4707
+ /**
4708
+ * What a monitor watches: a `search`, `news` search, a `webpage` for content changes, or an AI
4709
+ * assistant's answer to a prompt (`chatgpt`, `gemini`, `copilot`, `ai_mode`, `brave_ai`).
4710
+ */
4229
4711
  type MonitorEndpoint = Monitor["endpoint"];
4230
4712
  /** Your own JSON object on a monitor (at most 2 KB), echoed in `monitor.results`. */
4231
4713
  type MonitorMetadata = NonNullable<Monitor["metadata"]>;
@@ -4234,13 +4716,19 @@ type MonitorMetadata = NonNullable<Monitor["metadata"]>;
4234
4716
  * the page when first seen (`change: "new"`) or when its content changed (`"changed"`).
4235
4717
  */
4236
4718
  type MonitorPageChange = Schemas["MonitorPageChange"];
4719
+ /**
4720
+ * The result item of an AI assistant monitor: one per run (every run reports the answer), with
4721
+ * `new_sources` (source links not seen in earlier runs) and, with `track`, `mentions`.
4722
+ */
4723
+ type MonitorAnswer = Schemas["MonitorAnswer"];
4237
4724
  /** `last_status` of a monitor; `"paused"` after 10 failed runs in a row. */
4238
4725
  type MonitorStatus = NonNullable<Monitor["last_status"]>;
4239
4726
  type MonitorList = Schemas["MonitorList"];
4240
4727
  type MonitorSearch = Schemas["MonitorSearch"];
4241
4728
  /**
4242
4729
  * One run of a monitor. `results` holds the new results (null when none, or after 24 hours):
4243
- * `OrganicResult`-shaped for search, `NewsResult` for news, {@link MonitorPageChange} for webpage.
4730
+ * `OrganicResult`-shaped for search, `NewsResult` for news, {@link MonitorPageChange} for webpage,
4731
+ * one {@link MonitorAnswer} for AI assistants.
4244
4732
  */
4245
4733
  type MonitorRun = Schemas["MonitorRun"];
4246
4734
  /** A page of runs, newest first. Pass `next_before` as `before` for the next page. */
@@ -4266,7 +4754,8 @@ type ResearchCompletedEvent = Omit<TaskCompletedEvent, "event" | "kind" | "resul
4266
4754
  /**
4267
4755
  * Body of `monitor.results`. `run_id` is also the `X-SerpKite-Delivery` header (dedupe retries
4268
4756
  * on it). Carries the monitor's `metadata`, and `url` for webpage monitors (whose `new_results`
4269
- * are {@link MonitorPageChange} items and `q` is empty).
4757
+ * are {@link MonitorPageChange} items and `q` is empty). AI assistant monitors send `prompt`
4758
+ * instead of `q` and one {@link MonitorAnswer} in `new_results`.
4270
4759
  */
4271
4760
  type MonitorResultsEvent = Schemas["MonitorResultsEvent"];
4272
4761
  /** `X-SerpKite-Event` values. Plain strings stay accepted for events added later. */
@@ -4290,7 +4779,7 @@ type WebhookEvent = {
4290
4779
  data: MonitorResultsEvent;
4291
4780
  };
4292
4781
 
4293
- declare const VERSION = "0.7.0";
4782
+ declare const VERSION = "0.8.0";
4294
4783
  declare const DEFAULT_BASE_URL = "https://api.serpkite.com";
4295
4784
  interface SerpKiteOptions {
4296
4785
  /** API key (`skt_live_…`). Defaults to the `SERPKITE_API_KEY` environment variable. */
@@ -4366,6 +4855,8 @@ interface VerticalMethod<P, R> {
4366
4855
  (params: P, options?: RequestOptions): Promise<R | CompactResponse | string>;
4367
4856
  }
4368
4857
  type Method = "GET" | "POST" | "PATCH" | "DELETE";
4858
+ /** Minimum per-attempt timeout of the AI assistant methods: answers take 10-90 s. */
4859
+ declare const ASSISTANT_TIMEOUT_MS = 120000;
4369
4860
  interface Call {
4370
4861
  method: Method;
4371
4862
  path: string;
@@ -4393,6 +4884,7 @@ declare class SerpKite {
4393
4884
  top_stories?: components["schemas"]["NewsResult"][];
4394
4885
  places?: components["schemas"]["PlaceResult"][];
4395
4886
  answer?: components["schemas"]["SearchAnswer"];
4887
+ ai_overview?: components["schemas"]["AIOverview"];
4396
4888
  meta: components["schemas"]["Meta"];
4397
4889
  }>;
4398
4890
  /** Google Images. */
@@ -4504,6 +4996,131 @@ declare class SerpKite {
4504
4996
  image_links?: string[];
4505
4997
  meta: components["schemas"]["Meta"];
4506
4998
  }>;
4999
+ /**
5000
+ * Ask ChatGPT as a logged-out user: the answer (`text`, `markdown`), cited `sources`,
5001
+ * `search_queries`, `products`, `places` and the guest `model`. `web_search` (default true)
5002
+ * makes it search the web; `country` asks from an exit in that country. `track` returns
5003
+ * `mentions` of your brands and domains. 5 credits.
5004
+ */
5005
+ readonly chatgpt: VerticalMethod<{
5006
+ prompt: string;
5007
+ web_search?: boolean;
5008
+ country?: string;
5009
+ track?: components["schemas"]["TrackList"];
5010
+ include_html?: boolean;
5011
+ format?: "json" | "markdown" | "compact";
5012
+ fields?: string;
5013
+ max_age?: number;
5014
+ }, {
5015
+ request: components["schemas"]["AssistantEcho"];
5016
+ text: string;
5017
+ markdown: string;
5018
+ html?: string;
5019
+ model?: string;
5020
+ sources: components["schemas"]["AISource"][];
5021
+ search_queries: string[];
5022
+ products: components["schemas"]["AIProduct"][];
5023
+ places?: components["schemas"]["PlaceResult"][];
5024
+ related_questions?: string[];
5025
+ mentions?: components["schemas"]["Mention"][];
5026
+ meta: components["schemas"]["Meta"];
5027
+ }>;
5028
+ /** Ask Google Gemini as a logged-out user: the answer with the sources it grounded on. 5 credits. */
5029
+ readonly gemini: VerticalMethod<{
5030
+ prompt: string;
5031
+ country?: string;
5032
+ language?: string;
5033
+ track?: components["schemas"]["TrackList"];
5034
+ include_html?: boolean;
5035
+ format?: "json" | "markdown" | "compact";
5036
+ fields?: string;
5037
+ max_age?: number;
5038
+ }, {
5039
+ request: components["schemas"]["AssistantEcho"];
5040
+ text: string;
5041
+ markdown: string;
5042
+ html?: string;
5043
+ model?: string;
5044
+ sources: components["schemas"]["AISource"][];
5045
+ search_queries: string[];
5046
+ products: components["schemas"]["AIProduct"][];
5047
+ places?: components["schemas"]["PlaceResult"][];
5048
+ related_questions?: string[];
5049
+ mentions?: components["schemas"]["Mention"][];
5050
+ meta: components["schemas"]["Meta"];
5051
+ }>;
5052
+ /** Microsoft Copilot Search on Bing: the answer, cited sources and products. 3 credits. */
5053
+ readonly copilot: VerticalMethod<{
5054
+ prompt: string;
5055
+ country?: string;
5056
+ language?: string;
5057
+ track?: components["schemas"]["TrackList"];
5058
+ include_html?: boolean;
5059
+ format?: "json" | "markdown" | "compact";
5060
+ fields?: string;
5061
+ max_age?: number;
5062
+ }, {
5063
+ request: components["schemas"]["AssistantEcho"];
5064
+ text: string;
5065
+ markdown: string;
5066
+ html?: string;
5067
+ model?: string;
5068
+ sources: components["schemas"]["AISource"][];
5069
+ search_queries: string[];
5070
+ products: components["schemas"]["AIProduct"][];
5071
+ places?: components["schemas"]["PlaceResult"][];
5072
+ related_questions?: string[];
5073
+ mentions?: components["schemas"]["Mention"][];
5074
+ meta: components["schemas"]["Meta"];
5075
+ }>;
5076
+ /** Google AI Mode: the answer, cited sources and products. 3 credits. */
5077
+ readonly aiMode: VerticalMethod<{
5078
+ prompt: string;
5079
+ country?: string;
5080
+ language?: string;
5081
+ track?: components["schemas"]["TrackList"];
5082
+ include_html?: boolean;
5083
+ format?: "json" | "markdown" | "compact";
5084
+ fields?: string;
5085
+ max_age?: number;
5086
+ }, {
5087
+ request: components["schemas"]["AssistantEcho"];
5088
+ text: string;
5089
+ markdown: string;
5090
+ html?: string;
5091
+ model?: string;
5092
+ sources: components["schemas"]["AISource"][];
5093
+ search_queries: string[];
5094
+ products: components["schemas"]["AIProduct"][];
5095
+ places?: components["schemas"]["PlaceResult"][];
5096
+ related_questions?: string[];
5097
+ mentions?: components["schemas"]["Mention"][];
5098
+ meta: components["schemas"]["Meta"];
5099
+ }>;
5100
+ /** Brave Search's AI answer: cited sources, the searches it ran and products. 2 credits. */
5101
+ readonly braveAi: VerticalMethod<{
5102
+ prompt: string;
5103
+ country?: string;
5104
+ language?: string;
5105
+ track?: components["schemas"]["TrackList"];
5106
+ include_html?: boolean;
5107
+ format?: "json" | "markdown" | "compact";
5108
+ fields?: string;
5109
+ max_age?: number;
5110
+ }, {
5111
+ request: components["schemas"]["AssistantEcho"];
5112
+ text: string;
5113
+ markdown: string;
5114
+ html?: string;
5115
+ model?: string;
5116
+ sources: components["schemas"]["AISource"][];
5117
+ search_queries: string[];
5118
+ products: components["schemas"]["AIProduct"][];
5119
+ places?: components["schemas"]["PlaceResult"][];
5120
+ related_questions?: string[];
5121
+ mentions?: components["schemas"]["Mention"][];
5122
+ meta: components["schemas"]["Meta"];
5123
+ }>;
4507
5124
  /** Position of `domain` for keyword `q` in the top `num` results (default 100). */
4508
5125
  rank(params: RankParams, options?: RequestOptions): Promise<RankResponse>;
4509
5126
  /**
@@ -4605,7 +5222,9 @@ declare class SerpKite {
4605
5222
  * and reports it (`MonitorPageChange`) when its content changes. `metadata` (your JSON
4606
5223
  * object, at most 2 KB) is echoed on the monitor and in its webhooks. Without a
4607
5224
  * `webhook_url`, read new results from `monitors.runs`. `active: false`
4608
- * creates it paused. A monitor pauses itself after 10 failed runs in a row
5225
+ * creates it paused. With an AI assistant `endpoint` (`chatgpt`, `gemini`, `copilot`,
5226
+ * `ai_mode`, `brave_ai`) and a `prompt` every run reports the answer (`MonitorAnswer`:
5227
+ * sources, `new_sources`, `mentions` with `track`). A monitor pauses itself after 10 failed runs in a row
4609
5228
  * (`last_status: "paused"`); `update(id, { active: true })` resumes it. Each run costs
4610
5229
  * what its search costs. Only retried on 429.
4611
5230
  */
@@ -4740,4 +5359,4 @@ declare function verifyWebhook(secret: string, payload: string | Uint8Array, hea
4740
5359
  */
4741
5360
  declare function parseWebhook(secret: string, payload: string | Uint8Array, headers: HeaderSource, options?: VerifyWebhookOptions): Promise<WebhookEvent>;
4742
5361
 
4743
- export { type Account, type AnswerBox, type AnswerMeta, type AnswerParams, type AnswerResponse, type AnswerSource, type AnswerStreamDelta, type AnswerStreamDone, type AnswerStreamEvent, type AnswerStreamResults, type AutocompleteResponse, type Batch, type BatchCompletedEvent, type BatchCreateEntry, type BatchCreateError, type BatchCreateOptions, type BatchCreateParams, type BatchCreateResponse, type BatchEndpoint, type BatchStatus, type Citation, type CompactResponse, type CrawlPage, type CrawlParams, type CrawlResult, type CrawlSitemapMode, type CrawlStats, type CrawlStopReason, type CrawlTask, DEFAULT_BASE_URL, type DomainList, type Engine, type ErrorBody, type ExtractFailure, type ExtractParams, type ExtractResponse, type ExtractResult, type Format, type Highlight, type HoursInterval, type ImageResult, type ImagesResponse, type KnowledgeGraph, type LLMUsage, type MapParams, type MapResponse, type MapURL, type MapsResponse, type Meta, type Monitor, type MonitorCreateParams, type MonitorEndpoint, type MonitorList, type MonitorMetadata, type MonitorPageChange, type MonitorResultsEvent, type MonitorRun, type MonitorRunList, type MonitorRunsParams, type MonitorSearch, type MonitorStatus, type MonitorUpdateParams, type NewsResponse, type NewsResult, type OrganicResult, type PageLink, type PageMetadata, type PatentResult, type PatentsResponse, type PeopleAlsoAsk, type PlaceParams, type PlacePhoto, type PlaceResult, type PlacesResponse, type Provider, type RankMatch, type RankParams, type RankResponse, type RelatedSearch, type RequestEcho, type RequestOptions, type ResearchCompletedEvent, type ResearchEffort, type ResearchParams, type ResearchProgress, type ResearchResult, type ResearchSource, type ResearchTask, type ResponseInfo, type ReviewResult, type ReviewsParams, type ReviewsResponse, type RouteOutcome, type RouteStep, type ScholarResponse, type ScholarResult, type SearchAnswer, type SearchParams, type SearchResponse, SerpKite, SerpKiteError, type SerpKiteOptions, type ShoppingResponse, type ShoppingResult, type Sitelink, type Status, type Suggestion, type TaskCancelResponse, type TaskCompletedEvent, type TaskCreated, type TaskError, type TaskStatus, VERSION, type VerifyWebhookOptions, type VerticalMethod, type VideoResult, type VideosResponse, type WaitOptions, type WebhookEvent, type WebhookEventType, type WebpageParams, type WebpageResponse, type WeeklyHours, type components, isBatchError, type operations, parseRetryAfter, parseWebhook, type paths, verifyWebhook };
5362
+ export { type AIOverview, type AIProduct, type AISource, ASSISTANT_TIMEOUT_MS, type Account, type AnswerBox, type AnswerMeta, type AnswerParams, type AnswerResponse, type AnswerSource, type AnswerStreamDelta, type AnswerStreamDone, type AnswerStreamEvent, type AnswerStreamResults, type AssistantEndpoint, type AssistantParams, type AssistantResponse, type AutocompleteResponse, type Batch, type BatchCompletedEvent, type BatchCreateEntry, type BatchCreateError, type BatchCreateOptions, type BatchCreateParams, type BatchCreateResponse, type BatchEndpoint, type BatchStatus, type ChatGPTParams, type Citation, type CompactResponse, type CrawlPage, type CrawlParams, type CrawlResult, type CrawlSitemapMode, type CrawlStats, type CrawlStopReason, type CrawlTask, DEFAULT_BASE_URL, type DomainList, type Engine, type ErrorBody, type ExtractFailure, type ExtractParams, type ExtractResponse, type ExtractResult, type Format, type Highlight, type HoursInterval, type ImageResult, type ImagesResponse, type KnowledgeGraph, type LLMUsage, type MapParams, type MapResponse, type MapURL, type MapsResponse, type Mention, type Meta, type Monitor, type MonitorAnswer, type MonitorCreateParams, type MonitorEndpoint, type MonitorList, type MonitorMetadata, type MonitorPageChange, type MonitorResultsEvent, type MonitorRun, type MonitorRunList, type MonitorRunsParams, type MonitorSearch, type MonitorStatus, type MonitorUpdateParams, type NewsResponse, type NewsResult, type OrganicResult, type PageLink, type PageMetadata, type PatentResult, type PatentsResponse, type PeopleAlsoAsk, type PlaceParams, type PlacePhoto, type PlaceResult, type PlacesResponse, type Provider, type RankMatch, type RankParams, type RankResponse, type RelatedSearch, type RequestEcho, type RequestOptions, type ResearchCompletedEvent, type ResearchEffort, type ResearchParams, type ResearchProgress, type ResearchResult, type ResearchSource, type ResearchTask, type ResponseInfo, type ReviewResult, type ReviewsParams, type ReviewsResponse, type RouteOutcome, type RouteStep, type ScholarResponse, type ScholarResult, type SearchAnswer, type SearchParams, type SearchResponse, SerpKite, SerpKiteError, type SerpKiteOptions, type ShoppingResponse, type ShoppingResult, type Sitelink, type Status, type Suggestion, type TaskCancelResponse, type TaskCompletedEvent, type TaskCreated, type TaskError, type TaskStatus, VERSION, type VerifyWebhookOptions, type VerticalMethod, type VideoResult, type VideosResponse, type WaitOptions, type WebhookEvent, type WebhookEventType, type WebpageParams, type WebpageResponse, type WeeklyHours, type components, isBatchError, type operations, parseRetryAfter, parseWebhook, type paths, verifyWebhook };