Skip to content

Commit 0f6ae12

Browse files
kathaylToriLindsay
andauthored
Update pricing.mdx (#25942)
* Update pricing.mdx add in how to get X-Browser-Ms-Used header when using typescript SDK * Update src/content/docs/browser-rendering/platform/pricing.mdx Co-authored-by: ToriLindsay <[email protected]> --------- Co-authored-by: ToriLindsay <[email protected]>
1 parent 173cc12 commit 0f6ae12

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/content/docs/browser-rendering/platform/pricing.mdx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,23 @@ For **browser duration** and **concurrent browsers**:
4444

4545
### How do I estimate my Browser Rendering costs?
4646

47-
To monitor your Browser Rendering usage in the Cloudflare dashboard, go to the **Browser Rendering** page.
47+
You can monitor Browser Rendering usage in two ways:
48+
49+
- To monitor your Browser Rendering usage in the Cloudflare dashboard, go to the **Browser Rendering** page.
4850

4951
<DashButton url="/?to=/:account/workers/browser-rendering" />
5052

51-
Then, you can use [the pricing page](/browser-rendering/platform/pricing/) to estimate your costs.
53+
- The `X-Browser-Ms-Used` header, which is returned in every REST API response, reports browser time used for the request (in milliseconds). You can also access this header using the Typescript SDK with the .asResponse() method:
54+
55+
```ts
56+
const contentRes = await client.browserRendering.content.create({
57+
account_id: 'account_id',
58+
}).asResponse();
59+
60+
const browserMsUsed = parseInt(contentRes.headers.get('X-Browser-Ms-Used') || '');
61+
```
62+
63+
Then, you can use [the pricing page](/browser-rendering/platform/pricing/) to estimate your costs based on your usage.
5264

5365
### Do failed API calls, such as those that time out, add to billable browser hours?
5466
No. If a request to the Browser Rendering REST API fails with a `waitForTimeout` error, the browser session is not charged.

0 commit comments

Comments
 (0)