@hunt-labs/bytekit-sdk 0.9.1 → 0.9.2

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/CHANGELOG.md CHANGED
@@ -10,6 +10,32 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.9.2] - 2026-09-03
14
+
15
+ ### Changed
16
+
17
+ - **Breaking (API):** the scrape `formats` vocabulary is now `raw | markdown | links | images`
18
+ (#3775). The unprocessed-source format is called `raw` — it has returned JSON, XML and plain
19
+ text alongside HTML since #1853, so the old raw-HTML name misdescribed it — and the
20
+ cleaned-article-HTML format is gone. The server accepts no alias for either retired value, so
21
+ a request naming one now comes back `422` with the new set in the message. Update `formats`
22
+ and read the content back from `formats.raw`:
23
+
24
+ ```ts
25
+ const result = await client.scrape.create({ url, formats: ['raw', 'markdown'] });
26
+ console.log(result.formats.raw);
27
+ ```
28
+
29
+ - Regenerated `src/generated/api.d.ts` against the documented `402` contract (#3784). Every
30
+ quota-enforced operation now declares `402` through one shared `PaymentRequired` response, and
31
+ the `X-Quota-*` headers are referenced by the operations that actually emit them. Types only —
32
+ no runtime behavior changed.
33
+
34
+ - The generated `events` field description on the scrape request type now documents the
35
+ widened server default (`queued`, `completed`, `failed`) and that a caller may send an
36
+ explicit subset to receive fewer deliveries (#3777). Types/docs only — this regeneration
37
+ followed a server-side default change; the SDK carried no logic tied to the old default.
38
+
13
39
  ## [0.9.1] - 2026-08-25
14
40
 
15
41
  ### Fixed
package/README.md CHANGED
@@ -56,7 +56,7 @@ const client = new ByteKit({
56
56
  ```ts
57
57
  const result = await client.scrape.create({
58
58
  url: 'https://example.com',
59
- formats: ['markdown', 'html'],
59
+ formats: ['markdown', 'raw'],
60
60
  });
61
61
  ```
62
62
 
@@ -1521,10 +1521,10 @@ export interface components {
1521
1521
  url: string;
1522
1522
  /**
1523
1523
  * @default [
1524
- * "raw_html"
1524
+ * "raw"
1525
1525
  * ]
1526
1526
  */
1527
- formats: ("raw_html" | "html" | "markdown" | "links" | "images")[];
1527
+ formats: ("raw" | "markdown" | "links" | "images")[];
1528
1528
  /** @default US */
1529
1529
  country: string;
1530
1530
  /** @default 0 */
@@ -1539,7 +1539,9 @@ export interface components {
1539
1539
  */
1540
1540
  webhook_url?: string;
1541
1541
  /**
1542
+ * @description Webhook event types to deliver when webhook_url is set. Defaults to all three (queued, completed, failed); send an explicit subset to receive fewer.
1542
1543
  * @default [
1544
+ * "queued",
1543
1545
  * "completed",
1544
1546
  * "failed"
1545
1547
  * ]
@@ -1572,7 +1574,7 @@ export interface components {
1572
1574
  markdown_filter_images?: boolean;
1573
1575
  /** @description When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`. */
1574
1576
  markdown_include_media?: boolean;
1575
- /** @description When true, enables markdown-pipeline and tag-filter warnings for affected `html` and `markdown` requests. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag. */
1577
+ /** @description When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag. */
1576
1578
  markdown_include_warnings?: boolean;
1577
1579
  /** @description When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`. */
1578
1580
  markdown_include_stats?: boolean;
@@ -1590,17 +1592,17 @@ export interface components {
1590
1592
  */
1591
1593
  mobile: boolean;
1592
1594
  /**
1593
- * @description When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion and from the `html` format output. Set to false to preserve base64 images in the pipeline output. Does not affect `raw_html`, which always returns the original HTML unchanged.
1595
+ * @description When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.
1594
1596
  * @default true
1595
1597
  */
1596
1598
  remove_base64_images: boolean;
1597
1599
  /**
1598
- * @description HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `html` and `markdown` output. Applied before `exclude_tags`. Does not affect `raw_html`, which always returns the full page.
1600
+ * @description HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.
1599
1601
  * @default []
1600
1602
  */
1601
1603
  include_tags: string[];
1602
1604
  /**
1603
- * @description HTML element names (not CSS selectors) to strip from the `html` and `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw_html`, which always returns the full page.
1605
+ * @description HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.
1604
1606
  * @default []
1605
1607
  */
1606
1608
  exclude_tags: string[];
@@ -1670,8 +1672,8 @@ export interface components {
1670
1672
  truncated: boolean;
1671
1673
  };
1672
1674
  ScrapeFormats: {
1673
- raw_html?: string;
1674
- html?: string;
1675
+ /** @description The untouched upstream source of whatever the URL served — HTML, JSON, XML or plain text. */
1676
+ raw?: string;
1675
1677
  markdown?: string;
1676
1678
  /** @description Plain URL strings by default. When markdownIncludeMedia=true, an array of ScrapeScoredLink objects. */
1677
1679
  links?: string[] | components["schemas"]["ScrapeScoredLink"][];
@@ -1709,8 +1711,7 @@ export interface components {
1709
1711
  * "status_code": 200,
1710
1712
  * "retrieved_at": "2025-01-15T12:00:00Z",
1711
1713
  * "formats": {
1712
- * "raw_html": "<html><body><h1>Hello World</h1><p>Example page with a <a href=\"/about\">link</a> and an image.</p></body></html>",
1713
- * "html": "<html><body><h1>Hello World</h1><p>Example page with a <a href=\"/about\">link</a> and an image.</p></body></html>",
1714
+ * "raw": "<html><body><h1>Hello World</h1><p>Example page with a <a href=\"/about\">link</a> and an image.</p></body></html>",
1714
1715
  * "markdown": "# Hello World\n\nExample page with a [link](/about) and an image.\n\n![Alt text](https://example.com/photo.png)",
1715
1716
  * "links": [
1716
1717
  * {
@@ -2632,7 +2633,48 @@ export interface components {
2632
2633
  rollover_credits: number;
2633
2634
  };
2634
2635
  };
2635
- responses: never;
2636
+ responses: {
2637
+ /**
2638
+ * @description Payment required. The account cannot fund this request, and no work was
2639
+ * performed. The unified `Error` envelope carries one of the billing codes
2640
+ * below in `error.code`; match on the code, never on the prose.
2641
+ *
2642
+ * - `quota_exceeded` — the enforced balance for this request's meter is
2643
+ * exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,
2644
+ * `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter
2645
+ * bandwidth; `/v1/search` meters credits.
2646
+ * - `spending_cap_reached` — the request would push overage spend past the
2647
+ * account's configured cap. Only reachable on a custom overage-enabled
2648
+ * plan; standard plans stop at `quota_exceeded`.
2649
+ * - `billing_entitlement_impaired` — the paid subscription is in a payment
2650
+ * impairment (e.g. `past_due`). `error.message` names the reason.
2651
+ * - `billing_entitlement_expired` — the paid subscription entitlement
2652
+ * period has ended, or its dunning grace period has run out.
2653
+ *
2654
+ * Not retryable as-is: settle the balance, raise the cap, or restore the
2655
+ * subscription first. This response carries no `X-Quota-*` headers — they
2656
+ * travel with the 2xx responses of the operations that emit them.
2657
+ */
2658
+ PaymentRequired: {
2659
+ headers: {
2660
+ [name: string]: unknown;
2661
+ };
2662
+ content: {
2663
+ /**
2664
+ * @example {
2665
+ * "status": "failed",
2666
+ * "error": {
2667
+ * "code": "quota_exceeded",
2668
+ * "message": "Monthly bandwidth quota exhausted.",
2669
+ * "http_status": 402,
2670
+ * "failed_at": "2026-01-15T12:00:00Z"
2671
+ * }
2672
+ * }
2673
+ */
2674
+ "application/json": components["schemas"]["Error"];
2675
+ };
2676
+ };
2677
+ };
2636
2678
  parameters: {
2637
2679
  /**
2638
2680
  * @description Optional. Identifies which published ByteKit client sent the request, as
@@ -2673,8 +2715,8 @@ export interface components {
2673
2715
  XQuotaUsed: number;
2674
2716
  /** @description Remaining quota in the billing period. */
2675
2717
  XQuotaRemaining: number;
2676
- /** @description ISO 8601 timestamp when the billing period ends. */
2677
- XQuotaReset: string;
2718
+ /** @description Unix epoch second at which the current billing period ends — the same unit as `X-RateLimit-Reset`, not an ISO 8601 timestamp (issue #1538). */
2719
+ XQuotaReset: number;
2678
2720
  /** @description Maximum concurrent jobs allowed. */
2679
2721
  XConcurrencyLimit: number;
2680
2722
  /** @description Currently active concurrent jobs. */
@@ -3178,6 +3220,10 @@ export interface operations {
3178
3220
  "X-Screenshot-Cache"?: "hit" | "miss" | "bypass";
3179
3221
  /** @description Age of the cached screenshot in seconds. Present only on cache hits. */
3180
3222
  "X-Screenshot-Cache-Age"?: number;
3223
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
3224
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
3225
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
3226
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3181
3227
  [name: string]: unknown;
3182
3228
  };
3183
3229
  content: {
@@ -3207,6 +3253,10 @@ export interface operations {
3207
3253
  "X-Billable-Bytes"?: number;
3208
3254
  /** @description Billing multiplier applied to raw bytes to compute billable bytes. A rendering of the response body's `billing` node, which is the authoritative surface: it names each factor that composed this value. Where the two disagree, the node is correct. */
3209
3255
  "X-Billing-Multiplier"?: number;
3256
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
3257
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
3258
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
3259
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3210
3260
  [name: string]: unknown;
3211
3261
  };
3212
3262
  content: {
@@ -3232,15 +3282,7 @@ export interface operations {
3232
3282
  "application/json": components["schemas"]["Error"];
3233
3283
  };
3234
3284
  };
3235
- /** @description Quota exceeded. */
3236
- 402: {
3237
- headers: {
3238
- [name: string]: unknown;
3239
- };
3240
- content: {
3241
- "application/json": components["schemas"]["Error"];
3242
- };
3243
- };
3285
+ 402: components["responses"]["PaymentRequired"];
3244
3286
  /**
3245
3287
  * @description Validation error, or a screenshot that failed inside the sync hold.
3246
3288
  * The two carry DIFFERENT bodies (issue #2679):
@@ -3272,6 +3314,10 @@ export interface operations {
3272
3314
  headers: {
3273
3315
  /** @description Stable screenshot identifier (matches `id` in the resource body). Emitted only on the failed-capture variant; absent on a request-validation failure. */
3274
3316
  "X-Screenshot-ID"?: string;
3317
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
3318
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
3319
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
3320
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3275
3321
  [name: string]: unknown;
3276
3322
  };
3277
3323
  content: {
@@ -3349,7 +3395,7 @@ export interface operations {
3349
3395
  * @example {
3350
3396
  * "url": "https://example.com",
3351
3397
  * "formats": [
3352
- * "raw_html",
3398
+ * "raw",
3353
3399
  * "markdown"
3354
3400
  * ],
3355
3401
  * "markdown_mode": "article",
@@ -3396,7 +3442,7 @@ export interface operations {
3396
3442
  "X-Raw-Bytes"?: number;
3397
3443
  /** @description Chargeable bytes after applying the billing multiplier. Equals round(X-Raw-Bytes × X-Billing-Multiplier). */
3398
3444
  "X-Billable-Bytes"?: number;
3399
- /** @description Bandwidth cost multiplier (e.g. 1.0 for raw_html-only, 1.5 for +markdown/html). Cache hits compose the endpoint format factor: raw 0.5, markdown 0.75. Excludes the `clean_markdown` surcharge: when `clean_markdown: true` and the clean succeeded, the settled usage is 3× this header's value, so this header does not predict the amount you are billed. The response body's `billing` node is the authoritative surface — it DOES carry the `clean_markdown` factor, so its `multiplier` and `billed_bytes` are what you are charged. Where the two disagree, the node is correct. */
3445
+ /** @description Bandwidth cost multiplier (e.g. 1.0 for a `raw`-only scrape, 1.5 when `markdown` is also requested). Cache hits compose the endpoint format factor, which is a separate number from this one: 0.5 for an unprocessed-source scrape, 0.75 with markdown. Excludes the `clean_markdown` surcharge: when `clean_markdown: true` and the clean succeeded, the settled usage is 3× this header's value, so this header does not predict the amount you are billed. The response body's `billing` node is the authoritative surface — it DOES carry the `clean_markdown` factor, so its `multiplier` and `billed_bytes` are what you are charged. Where the two disagree, the node is correct. */
3400
3446
  "X-Billing-Multiplier"?: number;
3401
3447
  /** @description Credits charged for this scrape (multiplier applied to base 1.0 per format). */
3402
3448
  "X-Scrape-Credits-Charged"?: number;
@@ -3426,6 +3472,10 @@ export interface operations {
3426
3472
  "X-Scrape-Proxy-Tier-Label"?: string;
3427
3473
  /** @description WAF vendor detected on the target, if any (diagnostic). May be "suspected" when a low-confidence fail-open block marker was served. Omitted when no WAF is detected. */
3428
3474
  "X-Scrape-Waf"?: string;
3475
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
3476
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
3477
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
3478
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3429
3479
  [name: string]: unknown;
3430
3480
  };
3431
3481
  content: {
@@ -3439,6 +3489,10 @@ export interface operations {
3439
3489
  "X-Scrape-ID"?: string;
3440
3490
  /** @description Always `queued` on a 202 response. */
3441
3491
  "X-Scrape-Status"?: "queued";
3492
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
3493
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
3494
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
3495
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3442
3496
  [name: string]: unknown;
3443
3497
  };
3444
3498
  content: {
@@ -3464,6 +3518,7 @@ export interface operations {
3464
3518
  "application/json": components["schemas"]["Error"];
3465
3519
  };
3466
3520
  };
3521
+ 402: components["responses"]["PaymentRequired"];
3467
3522
  /** @description Validation error. */
3468
3523
  422: {
3469
3524
  headers: {
@@ -3539,7 +3594,7 @@ export interface operations {
3539
3594
  * {
3540
3595
  * "url": "https://example.com",
3541
3596
  * "formats": [
3542
- * "raw_html",
3597
+ * "raw",
3543
3598
  * "markdown"
3544
3599
  * ],
3545
3600
  * "custom": {
@@ -3555,7 +3610,7 @@ export interface operations {
3555
3610
  * ],
3556
3611
  * "defaults": {
3557
3612
  * "formats": [
3558
- * "raw_html"
3613
+ * "raw"
3559
3614
  * ],
3560
3615
  * "country": "US"
3561
3616
  * },
@@ -3572,7 +3627,7 @@ export interface operations {
3572
3627
  items?: {
3573
3628
  /** Format: uri */
3574
3629
  url: string;
3575
- formats?: ("raw_html" | "html" | "markdown" | "links" | "images")[];
3630
+ formats?: ("raw" | "markdown" | "links" | "images")[];
3576
3631
  country?: string;
3577
3632
  delay_ms?: number;
3578
3633
  timeout_ms?: number;
@@ -3602,10 +3657,10 @@ export interface operations {
3602
3657
  defaults?: {
3603
3658
  /**
3604
3659
  * @default [
3605
- * "raw_html"
3660
+ * "raw"
3606
3661
  * ]
3607
3662
  */
3608
- formats?: ("raw_html" | "html" | "markdown" | "links" | "images")[];
3663
+ formats?: ("raw" | "markdown" | "links" | "images")[];
3609
3664
  /** @default US */
3610
3665
  country?: string;
3611
3666
  /** @default 0 */
@@ -3651,6 +3706,10 @@ export interface operations {
3651
3706
  /** @description Bulk scrape job accepted. */
3652
3707
  202: {
3653
3708
  headers: {
3709
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
3710
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
3711
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
3712
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3654
3713
  [name: string]: unknown;
3655
3714
  };
3656
3715
  content: {
@@ -3694,6 +3753,7 @@ export interface operations {
3694
3753
  "application/json": components["schemas"]["Error"];
3695
3754
  };
3696
3755
  };
3756
+ 402: components["responses"]["PaymentRequired"];
3697
3757
  /**
3698
3758
  * @description Validation error. `bulk_too_large` is returned when the item count
3699
3759
  * exceeds the account plan's `max_bulk_size` cap (also surfaced as
@@ -3842,6 +3902,10 @@ export interface operations {
3842
3902
  "X-Billing-Multiplier"?: number;
3843
3903
  /** @description Back-compat duplicate of `X-Billing-Multiplier` — identical value on every path. Prefer `X-Billing-Multiplier`; this alias is retained for clients that read the `X-Fetch-*` header family. */
3844
3904
  "X-Fetch-Billing-Multiplier"?: number;
3905
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
3906
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
3907
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
3908
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3845
3909
  [name: string]: unknown;
3846
3910
  };
3847
3911
  content: {
@@ -3857,6 +3921,7 @@ export interface operations {
3857
3921
  "application/json": components["schemas"]["Error"];
3858
3922
  };
3859
3923
  };
3924
+ 402: components["responses"]["PaymentRequired"];
3860
3925
  /** @description Validation error (e.g. slow-path-only field). */
3861
3926
  422: {
3862
3927
  headers: {
@@ -3963,6 +4028,10 @@ export interface operations {
3963
4028
  "X-Billing-Multiplier"?: number;
3964
4029
  /** @description Back-compat duplicate of `X-Billing-Multiplier` — identical value on every path. Prefer `X-Billing-Multiplier`; this alias is retained for clients that read the `X-Fetch-*` header family. */
3965
4030
  "X-Fetch-Billing-Multiplier"?: number;
4031
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
4032
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
4033
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
4034
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
3966
4035
  [name: string]: unknown;
3967
4036
  };
3968
4037
  content: {
@@ -3978,6 +4047,7 @@ export interface operations {
3978
4047
  "application/json": components["schemas"]["Error"];
3979
4048
  };
3980
4049
  };
4050
+ 402: components["responses"]["PaymentRequired"];
3981
4051
  /** @description Validation error (e.g. malformed JSON, unsupported fetch format, or slow-path-only field). */
3982
4052
  422: {
3983
4053
  headers: {
@@ -4077,6 +4147,10 @@ export interface operations {
4077
4147
  /** @description Fetch bulk job accepted. */
4078
4148
  202: {
4079
4149
  headers: {
4150
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
4151
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
4152
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
4153
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
4080
4154
  [name: string]: unknown;
4081
4155
  };
4082
4156
  content: {
@@ -4120,6 +4194,7 @@ export interface operations {
4120
4194
  "application/json": components["schemas"]["Error"];
4121
4195
  };
4122
4196
  };
4197
+ 402: components["responses"]["PaymentRequired"];
4123
4198
  /**
4124
4199
  * @description Validation error. `bulk_too_large` is returned when the item count
4125
4200
  * exceeds the account plan's `max_bulk_size` cap (also surfaced as
@@ -4359,7 +4434,7 @@ export interface operations {
4359
4434
  * "type": "scrape",
4360
4435
  * "formats": [
4361
4436
  * "markdown",
4362
- * "html"
4437
+ * "raw"
4363
4438
  * ],
4364
4439
  * "include_html": true,
4365
4440
  * "wait_until": "networkidle",
@@ -4375,7 +4450,7 @@ export interface operations {
4375
4450
  * "device": "desktop",
4376
4451
  * "country": "US",
4377
4452
  * "formats": [
4378
- * "raw_html"
4453
+ * "raw"
4379
4454
  * ],
4380
4455
  * "device_scale_factor": 2
4381
4456
  * },
@@ -4412,7 +4487,7 @@ export interface operations {
4412
4487
  language?: string | null;
4413
4488
  dark_mode?: boolean;
4414
4489
  /** @description Scrape output formats (scrape entries). */
4415
- formats?: ("raw_html" | "html" | "markdown" | "links" | "images")[];
4490
+ formats?: ("raw" | "markdown" | "links" | "images")[];
4416
4491
  /** @enum {string} */
4417
4492
  wait_until?: "load" | "domcontentloaded" | "networkidle";
4418
4493
  wait_for_selector?: string | null;
@@ -4465,7 +4540,7 @@ export interface operations {
4465
4540
  language?: string | null;
4466
4541
  /** @default false */
4467
4542
  dark_mode?: boolean;
4468
- formats?: ("raw_html" | "html" | "markdown" | "links" | "images")[];
4543
+ formats?: ("raw" | "markdown" | "links" | "images")[];
4469
4544
  /**
4470
4545
  * @default load
4471
4546
  * @enum {string}
@@ -4501,6 +4576,10 @@ export interface operations {
4501
4576
  /** @description Bulk job accepted. */
4502
4577
  202: {
4503
4578
  headers: {
4579
+ "X-Quota-Limit": components["headers"]["XQuotaLimit"];
4580
+ "X-Quota-Used": components["headers"]["XQuotaUsed"];
4581
+ "X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
4582
+ "X-Quota-Reset": components["headers"]["XQuotaReset"];
4504
4583
  [name: string]: unknown;
4505
4584
  };
4506
4585
  content: {
@@ -4544,6 +4623,7 @@ export interface operations {
4544
4623
  "application/json": components["schemas"]["Error"];
4545
4624
  };
4546
4625
  };
4626
+ 402: components["responses"]["PaymentRequired"];
4547
4627
  /**
4548
4628
  * @description Validation error. `bulk_too_large` is returned when the item count
4549
4629
  * exceeds the account plan's `max_bulk_size` cap (also surfaced as
@@ -5063,6 +5143,7 @@ export interface operations {
5063
5143
  "application/json": components["schemas"]["Error"];
5064
5144
  };
5065
5145
  };
5146
+ 402: components["responses"]["PaymentRequired"];
5066
5147
  /** @description Validation error. */
5067
5148
  422: {
5068
5149
  headers: {
@@ -5267,15 +5348,7 @@ export interface operations {
5267
5348
  "application/json": components["schemas"]["Error"];
5268
5349
  };
5269
5350
  };
5270
- /** @description Payment required. Either the account is out of credits (`quota_exceeded`), or a custom overage-enabled plan would cross its configured overage spending cap (`spending_cap_reached`). */
5271
- 402: {
5272
- headers: {
5273
- [name: string]: unknown;
5274
- };
5275
- content: {
5276
- "application/json": components["schemas"]["Error"];
5277
- };
5278
- };
5351
+ 402: components["responses"]["PaymentRequired"];
5279
5352
  /** @description Rate limit exceeded (`rate_limited`). Carries the `X-RateLimit-Limit`/`X-RateLimit-Remaining`/`X-RateLimit-Reset` triplet and a `Retry-After` header. The window is per-second for a bearer API key, or the 60-request/60-second Clerk session window when authenticated via `resolveDualAuth` — `Retry-After` reflects whichever window applies to the request. */
5280
5353
  429: {
5281
5354
  headers: {
@@ -5437,15 +5510,7 @@ export interface operations {
5437
5510
  "application/json": components["schemas"]["Error"];
5438
5511
  };
5439
5512
  };
5440
- /** @description Bandwidth quota exhausted (`quota_exceeded`). */
5441
- 402: {
5442
- headers: {
5443
- [name: string]: unknown;
5444
- };
5445
- content: {
5446
- "application/json": components["schemas"]["Error"];
5447
- };
5448
- };
5513
+ 402: components["responses"]["PaymentRequired"];
5449
5514
  /** @description Endpoint not available (feature flag disabled). */
5450
5515
  404: {
5451
5516
  headers: {
@@ -5676,7 +5741,7 @@ export interface operations {
5676
5741
  endpoint: "screenshots" | "recordings" | "scrape" | "scrape_md" | "fetch" | "fetch_md" | "crawl" | "crawl_links" | "sitemap" | "monitors";
5677
5742
  /** @description Raw upstream wire bytes for the endpoint. Screenshot and recording rows created before issue 2179 may reflect legacy billable Phase 1 bytes because exact raw totals cannot be recovered after per-job rounding. */
5678
5743
  raw_bytes: number;
5679
- /** @description Billing multiplier applied to raw bytes (e.g. 1.5 for screenshots/recordings/scrape_md/crawl, 1.0 otherwise). */
5744
+ /** @description Billing multiplier applied to raw bytes, enumerated for every `endpoint` value above — there is no catch-all default: 1.5 for `screenshots`, `recordings`, `scrape_md`, `fetch_md` and `crawl`; 1.0 for `scrape`, `fetch`, `crawl_links`, `sitemap` and `monitors`. Requesting Markdown output moves a request from the plain endpoint key to its `_md` key, so a Markdown scrape AND a Markdown fetch both bill at 1.5× (#3779). Source of truth: `ENDPOINT_BILLING_MULTIPLIER` in packages/scrape-shared/src/billing-multipliers.ts. */
5680
5745
  multiplier: number;
5681
5746
  /** @description raw_bytes × multiplier, rounded. */
5682
5747
  billable_bytes: number;
@@ -29,7 +29,7 @@ export type TokenEncoding = 'cl100k_base' | 'o200k_base';
29
29
  /** Options for POST /v1/scrape. */
30
30
  export interface ScrapeOpts {
31
31
  url: string;
32
- formats?: Array<'raw_html' | 'html' | 'markdown' | 'links' | 'images'>;
32
+ formats?: Array<'raw' | 'markdown' | 'links' | 'images'>;
33
33
  country?: string;
34
34
  delay_ms?: number;
35
35
  /** SERVER-side scrape budget in ms — how long the gateway may spend on the scrape itself. For the CLIENT-side abort budget (when this SDK gives up on the wire), see `RequestOptions.requestTimeoutMs`. */
@@ -65,11 +65,11 @@ export interface ScrapeOpts {
65
65
  token_encoding?: TokenEncoding;
66
66
  /** When true, emulate a mobile device (mobile UA + viewport). Default false (desktop). Part of the cache key, so mobile and desktop responses cache independently. */
67
67
  mobile?: boolean;
68
- /** When true (default), base64-encoded `data:` image sources are stripped before markdown conversion and from `html` output. Set false to preserve them. Does not affect `raw_html`. */
68
+ /** When true (default), base64-encoded `data:` image sources are stripped before markdown conversion. Set false to preserve them. Does not affect `raw`. */
69
69
  remove_base64_images?: boolean;
70
- /** HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in `html`/`markdown` output. Applied before `exclude_tags`. Does not affect `raw_html`. */
70
+ /** HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in `markdown` output. Applied before `exclude_tags`. Does not affect `raw`. */
71
71
  include_tags?: string[];
72
- /** HTML element names (not CSS selectors) to strip from `html`/`markdown` output. Applied after `include_tags`. Does not affect `raw_html`. */
72
+ /** HTML element names (not CSS selectors) to strip from `markdown` output. Applied after `include_tags`. Does not affect `raw`. */
73
73
  exclude_tags?: string[];
74
74
  /** When true and `markdown` is in `formats`, the converted markdown is sent to Groq for cleaning before return. Graceful degradation on any Groq failure. Billing: 3× credits and bytes applied only when cleaning succeeds. */
75
75
  clean_markdown?: boolean;
package/dist/version.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * outbound request carries — see the emit site in `client.ts`. The header name is spelled
6
6
  * only there, so issue #2905's pre-merge gate 1 counts exactly one occurrence in `src/`.
7
7
  */
8
- export declare const SDK_VERSION = "0.9.1";
8
+ export declare const SDK_VERSION = "0.9.2";
package/dist/version.js CHANGED
@@ -9,4 +9,4 @@
9
9
  * outbound request carries — see the emit site in `client.ts`. The header name is spelled
10
10
  * only there, so issue #2905's pre-merge gate 1 counts exactly one occurrence in `src/`.
11
11
  */
12
- export const SDK_VERSION = '0.9.1';
12
+ export const SDK_VERSION = '0.9.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-sdk",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Official TypeScript SDK for the ByteKit API",
5
5
  "license": "MIT",
6
6
  "type": "module",