Skip to content
Source
Sign inSign up
TanStack/schemas

Read the BytePlus image table under its annotated header (#640) #642

Mergedtombeckenhammerged 1 commit intomain fromrefs/pull/642/headmerged by tombeckenham View on GitHub

tombeckenhamcommented

Fixes #640.

What changed on the page

Read from https://docs.byteplus.com/en/docs/ModelArk/1544106 on 2026-11-13:

  1. The image table's Output image header gained a note line ("P is the total pixel count of a single output image."). The header no longer matched, so no image table was found and every poll threw byteplus pricing page (images): parsed 0 model rows.
  2. Seedream 5.0 pro's tiers are reworded: P ≤ 2.61 million (1.5K or lower): $0.045 P > 2.61 million (higher than 1.5K): $0.09 (was "Up to 2.61 million pixels … More than …").

Fix

  • imageRows (shared by parseByteplusImages and parseByteplusPixelTiers) takes the output column as the single header starting "Output image".
  • PIXEL_TIER_OUTPUT follows the new wording. The old wording is gone from the page, so it is not kept.
  • Still fail-closed: no matching table, or a row in any other wording, gives no price, and an empty image map still throws in assertParsed.
  • Fixture fixtures/byteplus-pricing-images.json is the image table cut verbatim from the live doc (row, column and cell zones).

Run against the full live page: chat 14, video 7, images 5, pixel tiers 1.

Not fixed here

  • The 400 pricing_lost / parser_miss events are not a parser miss. The page dropped its folded "Retiring models" section. Eight rows that hold a stored card no longer have a row: deepseek-v3-2-251201, glm-4-7-251222, seed-1-6-250915, seed-1-6-flash-250715, seed-1-8-251228, seed-2-0-lite-260228, seed-2-0-mini-260215, seedance-1-5-pro-251215 (8 per poll x ~50 polls = 400). All eight are on the model deprecation notice. Stored cards are kept and the event will keep firing each poll until that is decided separately.
  • dola-seedream-5-5-261028 stays unpriced (it has no stored card). Its row is a new shape: $0.008 per input image and two bounded pixel tiers. The parser warns and skips it.

Checks

bun run test src/server/providers/byteplus-pricing.test.ts src/server/providers/byteplus.test.ts (43 passed), bun run typecheck, bun --bun run lint, bun --bun run check. No packages/* change, so no changeset.

Summary by CodeRabbit

  • Bug Fixes
    • BytePlus image pricing now reflects published flat rates and pixel-based pricing tiers, including the current “P ≤” and “P >” thresholds.
    • Pricing results are empty when a table has no output-image pricing column, and unpriced models are omitted.
    • Tables with missing or ambiguous output-image columns are handled more consistently.
    1. ⚠️ No Changeset found

      Latest commit: 9a87d9511b0718587d888b68044f05ecf16f1054

      Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

      This PR includes no changesets

      When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

      Click here to learn what changesets are, and how to add one.

      Click here if you're a maintainer who wants to add a changeset to this PR

    2. tombeckenham linked this to fix #640

    3. tanstack-source added labelsbug

    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The BytePlus image pricing parser now extracts rows from the updated table layout and recognizes the published pixel-tier wording. A fixture and tests cover flat image prices, pixel tiers, and tables without a valid output-image column.

      Changes: BytePlus image pricing

      Layer / File(s)Summary
      Shared image-row extraction
      src/server/providers/byteplus-pricing.ts
      A shared extractor selects image pricing tables with exactly one output-image column and returns trimmed row values.
      Pricing parsing and fixture validation
      src/server/providers/byteplus-pricing.ts, src/server/providers/byteplus-pricing.test.ts, src/server/providers/fixtures/byteplus-pricing-images.json
      The flat-price and pixel-tier parsers use the shared rows. Pixel-tier parsing matches the published P ≤ and P > wording. Fixture-based tests check prices, tiers, and tables without an output-image column.

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Merge Risk: Minimal · up to 9a87d

      The change lets the BytePlus pricing parser read the updated image table and pixel-tier wording, with a fixture and tests. No merge-blocking risk was found. The unpriced Seedream 5.5 model and the pricing_lost events for retired models are known and handled separately.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Description CheckPassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title checkPassedThe title names the main change: the BytePlus image table parser now reads the table under its annotated 'Output image' header. The raw summary confirms this: imageRows matches a header beginning with…
      Linked Issues checkPassedIssue #640 requires four things: (1) update the parser for the changed ModelArk page, (2) keep parsing fail-closed with no fallback prices, (3) keep throwing when a page parses nothing, and (4) add a …
      Out of Scope Changes checkPassedAll changed areas connect to #640. The parser change in byteplus-pricing.ts updates the image-table header match and pixel-tier wording, which is the reported cause of the 'parsed 0 model rows' failur…
      Full details: Title check

      Explanation

      The title names the main change: the BytePlus image table parser now reads the table under its annotated 'Output image' header. The raw summary confirms this: imageRows matches a header beginning with 'Output image', and the PR adds a live-table fixture. The title is specific and matches the changeset. The '(#640)' reference points to the linked issue and is acceptable. The title is 63 characters, which is concise.

      Full details: Linked Issues check

      Explanation

      Issue #640 requires four things: (1) update the parser for the changed ModelArk page, (2) keep parsing fail-closed with no fallback prices, (3) keep throwing when a page parses nothing, and (4) add a fixture from the current page. The diff to src/server/providers/byteplus-pricing.ts meets (1): the new imageRows helper selects the output column by the header prefix Output image, and PIXEL_TIER_OUTPUT matches the revised P ≤ / P > wording. Both parseByteplusImages and parseByteplusPixelTiers use imageRows. Requirement (2) holds: imageRows returns no rows when no single matching output column exists, and no fallback price is added. Requirement (3) relies on the existing assertParsed path for an empty image map, which the PR states and which this change does not alter. Requirement (4) is met by fixtures/byteplus-pricing-images.json and the test additions described in the summary. The PR does not restore the eight retired-model rows that cause the 400 pricing_lost events. The PR argues these rows left the page in a folded 'Retiring models' section and are not a parser miss. That is a product decision, not a coding requirement of #640, so it does not fail this assessment. dola-seedream-5-5-261028 stays unpriced by design, and the parser warns and skips it. I did not open the test file or the fixture; the test results come from the PR description.

      Full details: Out of Scope Changes check

      Explanation

      All changed areas connect to #640. The parser change in byteplus-pricing.ts updates the image-table header match and pixel-tier wording, which is the reported cause of the 'parsed 0 model rows' failure. The new fixture is a verbatim cut of the live image table and supports the tests. The test file changes cover the same image and pixel-tier paths. The shared imageRows helper is needed because both parsers read the same table. The pixel-tier wording change replaces the old 'Up to' and 'More than' text, which the PR says is no longer on the page. No unrelated chat, video, or package changes appear in the reviewed scope. I did not inspect the test file or the fixture contents directly.

      Finishing Touches

      Generate unit tests (beta)

      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      Share

      Recent review info

      Run configuration

      • Source mode: Auto
      • Repository: Unavailable
      • Branch: Unavailable
      • File: No configuration file from this repository applied
      • Commit: Unavailable
      • Layers: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 011bf08c-e740-47bc-af4a-f5b0bdf5ac57
      Commits

      Reviewing files that changed from the base of the PR and between 20d83ebb4b4281219e04526ed348c46cf671f2e3 and 9a87d9511b0718587d888b68044f05ecf16f1054.

      Files selected for processing: 3

      • src/server/providers/byteplus-pricing.test.ts
      • src/server/providers/byteplus-pricing.ts
      • src/server/providers/fixtures/byteplus-pricing-images.json

      Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

    5. tombeckenham merged this3110d82

    6. tombeckenham closed this

Sign in to join this conversation.