Correct the crawl pre-flight credit note in billing.mdx - #1378
Merged
Conversation
The note said that a crawl whose `limit` exceeds the remaining credit balance returns a 402, and that omitting `limit` therefore requires 10,000 credits up front. Neither is what the API does. `apps/api/src/routes/shared.ts:166-202` clamps the requested limit to the remaining balance and re-checks the clamped value, then lets the request through with the lowered limit. `apps/api/src/controllers/v2/crawl.ts:168-174` names that middleware the source of truth and clamps the normalized limit again at line 269, so the 10,000 default is lowered to fit the balance instead of being required in advance. A 402 is returned only when the clamped limit is not positive or when a per-API-key spend limit denies the lowered request as well. Rewrites the note to describe the clamp, keeps the code-verified 10,000 default, and adds no numbers that are not in the code. Finding: DI-2026-09-05-WEEKLY IP-D2, reconciled plan item 8. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SL5chNkWnr4Gy6uuB8PeKS
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rewrites the crawl pre-flight credit
<Note>inbilling.mdxso it matches what the API does. The note described a hard 402 and a 10,000 credit prerequisite. The API clamps the limit instead.Why
DI-2026-09-05-WEEKLY, path IP-D2. The note on
origin/mainreads:Both claims are wrong against
firecrawlorigin/main.apps/api/src/routes/shared.ts:166-202computesclampedLimit = Math.min(requestedLimit, remainingCredits), re-checks that clamped value against Autumn, and on success sets(req.body as any).limit = clampedLimitand callsnext(). The log line is "Adjusting limit to remaining credits". The 402 atshared.ts:222is reached only when the clamp does not produce a positive limit, or when the re-check of the clamped value is itself denied, which is the per-API-key spend limit case called out in the comment atshared.ts:187-190.apps/api/src/controllers/v2/crawl.ts:168-174names that middleware the source of truth: "checkCreditsMiddleware (always runs before this controller) is the source of truth: Infinity when Autumn allows the request, the real remaining when it clamps a low-credit crawl." The controller then clamps again atcrawl.ts:269,finalCrawlerOptions.limit = Math.min(remainingCredits, finalCrawlerOptions.limit), which is what handles the omitted-limit case: theprefault(10000)default inapps/api/src/controllers/v2/types.ts:1274is lowered to fit the balance rather than required up front.Changes
billing.mdx: one<Note>rewritten. It now says the effective limit is lowered to fit the balance, states the two conditions that do return a 402, and says the omitted-limit default is lowered the same way. The 10,000 default is kept because it is in the code. No other number is introduced.Verification
mintlify broken-linksandmintlify validateon Node 22.23.2, run on this branch and on a detached worktree at the base commit73103de7. Identical on both: 208 broken-link entries across 95 files, andvalidatefailing with 17 warnings. This change adds no new link or validation finding.git diff --name-only origin/main...HEADreturnsbilling.mdxonly.Notes for review
PR #1370 also edits
billing.mdx, at lines 38-63. This change is at lines 54-56 of the base file, outside #1370's hunks, so the two do not overlap. Whichever merges second may need a trivial context rebase.🤖 Generated with Claude Code
https://claude.ai/code/session_01SL5chNkWnr4Gy6uuB8PeKS