Cleanup & cost
Release browsers promptly and keep each task within budget.
With an initialized client:
await client.withSession({
timeoutSeconds: 300,
timeoutMs: 60_000,
cleanupTimeoutMs: 30_000,
}, async (session) => {
// Complete and save results before leaving this scope.
console.log(session.id);
});Understand the charge
At the base rate, one credit covers each started 36 seconds. Creation reserves the rounded budget for the requested lifetime.
| Example | Credits |
|---|---|
| 300-second maximum lifetime | 9 reserved |
| Normal stop after 10 seconds | 1 charged; 8 released |
| Normal stop after 37 seconds | 2 charged; 7 released |
| Startup failure or confirmed platform interruption | Free under current policy |
Waiting for a model or a person still uses browser time. CDP disconnection and viewer closure do not stop billing.
Confirm cleanup
For explicit sessions, call close and wait for releasedAt. A terminal status alone does not prove release.
If cleanup fails, save the session ID and recovery key, inspect current state, and retry closure. Do not create a replacement browser merely because a local wait expired.
New projects or keys do not add credits or concurrency. See billing for reservations, settlement, and funding.