跳到正文
DEV Community· AgentStack Notes·· 5 小時前AI 評分49

AI 智能體如何預檢 ScraperAPI 額度成本

ScraperAPI Credit Cost Pre-Flight for AI Agents

AI 導讀

指南整理 AI 智能體呼叫 ScraperAPI 前後核算額度成本的流程,包括事前使用 account/urlcost 查詢、以 max_cost 設定單次上限,以及呼叫後記錄 sa-credit-cost。

正文

Originally published at AgentStack Notes. Last fact-checked: November 18, 2026.

Disclosure: This article was drafted with AI assistance and checked against ScraperAPI's official documentation. Links to ScraperAPI marked † are referral links: we may receive a commission if you sign up through them, at no extra cost to you. We have not run production workloads on ScraperAPI; everything below comes from its official documentation.

Note on experience: we have not called ScraperAPI, read a real sa-credit-cost header or measured any bill. The docs pages were read as raw page text on November 17-18, 2026. Check the live docs before relying on any statement. "Not stated" means the page we read did not say.

Before an AI agent adds render, premium or ultra_premium to a ScraperAPI † call, it can price the call three ways: look it up ahead of time, read a header afterwards, or cap it with max_cost. This post orders those tools into a short routine, lists the parameters ScraperAPI documents as extra cost, and marks the points the docs leave open.

1. What a request costs, per the docs

The "Credits and Requests costs" page says credits consumed "depends on the domain and parameters used with your request". Normal requests cost 1 credit; e-commerce domains (Amazon, Walmart, eBay) 5; SERP domains (Google, Bing) 25; LinkedIn 30. Cloudflare, Cloudflare Turnstile, DataDome, PerimeterX/Human and Akamai bypass are listed at 10 credits per scrape. Update, November 18: ScraperAPI's October 2026 release note says Akamai-protected sites are now unblocked without extra parameters (test without premium/ultra_premium if you added them only for Akamai), but the credits page still lists Akamai bypass at 10, so the billed cost is unconfirmed; check it with the cost lookup. The page does not say how the domain layer and the parameter layer combine (for example, whether a Google SERP request with render=true is 25 + 10), so an agent cannot compute the sum from the docs alone.

2. Parameters that cost extra, and ones that do not

Listed as extra cost: premium=true 10 credits; render=true 10; screenshot=true 10 (the page spells it "scrensshot"; we read it as screenshot); ultra_premium=true 30 (paid plans only); premium + render 25; ultra_premium + render 75 (paid plans only).

Listed as no extra cost: wait_for_selector, country_code, session_number, device_type, output_format, keep_headers, autoparse.

Per the Supported Parameters page, premium and ultra_premium cannot be combined, and session_number cannot be combined with either. Sticky sessions expire 15 minutes after last use. Whether screenshot=true is charged on top of the render charge is not stated.

3. Step one: look the cost up before calling

The cost page points to the dashboard's Domain Multiplier tool and to an API endpoint, https://api.scraperapi.com/account/urlcost, which takes api_key, url and the same parameters as a scrape. The check happens before scrape credits are spent. Not stated: its response format, whether the lookup consumes credits, and whether it is rate limited. We did not call it, so test those three points with a real key.

The dashboard also has a Domain Credit Cost Estimator (June 2026 release note): search a domain and see per-request credits by type (Standard, Premium, Ultra Premium and rendered variants) before sending anything. The note does not say whether it has an API or applies to DataPipeline jobs, so the documented programmatic route stays account/urlcost.

4. Step two: read the header after calling

Each response carries sa-credit-cost, "which shows the API Credit cost of that request". Log it per call, keep a running total, and compare with GET /account (usage data in JSON; the page does not list the exact fields).

5. Step three: cap the call

max_cost sets the maximum credits per scrape; if the cost would exceed it, the API returns 403 with "This request exceeds your max_cost". The status-code page also uses 403 for an exhausted monthly allowance, so read the body text. Our earlier article covers max_cost and async jobs. The order lookup, cap, call, header is our suggestion; the docs describe each piece separately.

6. The Ultra Premium cache

For ultra_premium=true, cached responses are served "whenever available", by default, no older than 10 minutes. cache_control=no-cache forces fresh data, and cached responses carry sa-from-cache: 1. An agent that needs fresh prices or rankings should set no-cache or check the header. Whether a cached response is billed at the full rate is not stated; budget as if it is.

7. Failures and the 70-second window

The cost page says only successful requests (200 and 404) are charged, plus requests cancelled from your side before the 70-second retry window ends. The status-code page says failed requests are retried up to 70 seconds before a 500 and recommends a 70-second client timeout. A shorter client timeout can therefore end up billed, as the wording reads. Whether a 200 containing a CAPTCHA is billed is not stated. Custom-deal accounts may see higher credit counts on Ultra Premium domains per a note on the cost page.

8. Pre-flight checklist (our reading)

  • Query account/urlcost with the exact parameters you plan to send.
  • Set max_cost to the per-task budget; on a 403, read the message body.
  • Use a client timeout of at least 70 seconds.
  • With ultra_premium, use cache_control=no-cache when freshness matters.
  • Log sa-credit-cost for every call and compare the total with /account.
  • Do not stack render, premium and screenshot by default.

What we could not confirm

  • How domain, bot-protection and parameter costs combine.
  • The format, credit cost and rate limit of account/urlcost.
  • Whether screenshot=true is charged on top of rendering.
  • Whether a cached Ultra Premium response is billed, and at what rate.
  • Whether a 200 containing a CAPTCHA is billed.
  • The fields returned by /account.
  • Whether the Estimator has an API, or applies to DataPipeline jobs.
  • Whether the premium=true pool is open to free plans: the cost page puts "paid plans only" on ultra_premium alone, while the proxy-pool page says the premium pool is "available to all paid users".
  • Billed cost of Akamai-protected sites after the October 2026 change.

Sources: docs.scraperapi.com (Credits and Requests costs; Supported Parameters; Cost Control; Cached Responses; Sticky Sessions; API Status Codes; Credit Usage). Checked November 17-18, 2026. Also: ScraperAPI release notes (June 2026 Estimator; October 2026 Akamai).

More: the original article, the credit comparison with ScrapingBee, and failed-scrape billing.

來源:DEV Community · dev.to