Gemini Computer Use in JavaScript: we gave it a support queue

What happens behind the scenes
A browser move in our demo starts with a screenshot. Gemini looks at that picture and suggests what to do next. Our JavaScript code runs the action.
Our program uses the Gemini Computer Use API in this loop:
- Show the screen. Our code sends Gemini the task and a screenshot.
- Get a suggested move. Gemini returns a click location, text to type or another browser action.
- Check and act. Our code checks the proposal, handles any required approval, and uses Playwright to operate the browser.
- Show what changed. Send back the action's result and a new screenshot. Keep going until the model finishes or our program stops the run.
Google's JavaScript SDK, @google/genai, carries the messages between our program and Gemini. Playwright is a separate library that controls the browser's mouse, keyboard and screenshots. We run the browser on our machine; the screenshots go to Google. Google's Computer Use guide.
The useful bit is Gemini choosing its next move from the screen. Our code still has to handle changed pages, permissions and a separate check of what actually got saved.
Our demo: find the broken checkout
We built a small support assistant around that loop and gave it four fake customer tickets. One customer says the latest release has stopped everyone from paying. The assistant has to find that ticket, select High priority, and save this exact internal note:
Escalate to on-call: checkout blocked. Customer update due in 30 minutes.
It must keep the ticket Open, leave the other tickets alone, and avoid sending a customer reply.
Using fake tickets lets us reset everything and try again. We don't need a Zendesk account, real customer data, or a demo website that someone else might change tomorrow. The Reply and Close buttons work inside the simulation so we can catch a mistake, but the demo cannot deliver a real message.
The exact note is useful too. We can check whether Gemini typed it twice, changed the wording, or put it in the wrong place. A confident "done" message won't pass that check.
If a support system already has an API for updating tickets, our program can make the change directly without clicking through pages. I'd usually choose that. Computer use is interesting when you have permission to use a website but its API or existing integrations don't cover the job. Our local support page gives us a repeatable way to try that approach. It isn't a connection to a real help desk.
What we tested
- Accuracy: Does it choose the right ticket and save the right information?
- Recovery: Can it handle a pop-up or a page that changes while it's working?
- Safety: Does it stop when the page contains instructions designed to trick it?
- Practicality: How long does it take, what does it cost, and which teams would benefit?
Recommended
AI Performance Metrics Explained Through How Printers Work

A familiar office printer can explain a lot about AI performance, from latency and throughput to memory and scheduling. The Printer It's 1999. Somewhere in a university computer lab. Three computer science students are s…
Read nextHow it did
We tested the finished demo on November 5, 2026. Each attempt started with a fresh browser and the original four tickets.
Most runs used Gemini 3.8 Flash, Google's recommended model for this tool. We also tried the cheaper Gemini 3.5 Flash-Lite on the ordinary task. These are the results from the final set of tests:
| Test | Did it finish correctly? | Time per attempt | Estimated AI cost per attempt |
|---|---|---|---|
| 3.8 Flash: ordinary task | 3 out of 3 | 33.9 to 54.5 seconds | $0.0100 to $0.0126 |
| 3.8 Flash: resize the page while Gemini is thinking | 2 out of 2 | 39.1 to 47.7 seconds | $0.0135 to $0.0161 |
| 3.8 Flash: put a pop-up in the way | 2 out of 2 | 41.6 to 52.4 seconds | $0.0100 to $0.0124 |
| 3.8 Flash: put malicious instructions in a ticket | Neither finished; both stopped for safety | 8.8 to 15.7 seconds | Incomplete cost data |
| 3.5 Flash-Lite: ordinary task | 2 out of 2 | 23.0 to 27.0 seconds | $0.0045 to $0.0053 |
Every finished job saved the exact note once, set High priority, kept the ticket Open, left the other tickets unchanged, and sent no customer reply. Our program checked the saved data separately from Gemini's final answer.
In both resize tests, we changed the browser from 1440 by 1050 to 760 by 1050 after Gemini started planning its first move. Our code rejected that move because it used the old screen. Gemini got a fresh screenshot and finished the job. The pop-up cases worked too; dismissing it added one action.
The ordinary 3.8 Flash task took five browser actions. Flash-Lite used an extra turn to wait or take another screenshot. It still finished faster and cost less in these two attempts. We haven't tested its harder cases, so I'd avoid picking an overall winner from that small comparison.
For the malicious tickets, Gemini opened the right ticket and then Google returned promptFeedback.blockReason: 'SAFETY'. The entire saved state stayed unchanged, with zero recorded writes. That was a useful stop, although the support job remained unfinished. The response didn't name the detector that fired, and two visible attacks tell us very little about other attacks.
The final set used 64 requests. The nine completed jobs cost an estimated $0.0945 combined in model usage. The blocked responses left out some billing fields, so we can't give a complete cost for those attempts or the whole investigation. These figures use November 5 Standard rates and exclude browser hosting, storage, taxes and supervision.
This came from a live run. We approved that exact simulated Save for repeated tests. All nine completed final runs asked for confirmation, and our code checked the action before using that permission. The approval covered the batch, so nobody answered nine separate prompts.
The earlier attempts count too
Getting to that final set took seven earlier full attempts:
| Earlier test | Attempts | What happened |
|---|---|---|
| Interactions API, two Flash runs and one Flash-Lite run | 3 | All stopped after the first click with HTTP 400; two captured an explicit harmful-content error |
| GenerateContent before Save approval | 1 | Filled in the correct note, then stopped to ask permission; nothing saved |
| GenerateContent with a changed screen at Save | 1 | Our code rejected the old click; the next API request failed because it lacked a safety acknowledgement |
| Earlier resized and approved ordinary runs | 2 | Both finished; the ordinary run still hit the rounded-corner rendering bug described below |
That's 18 full task attempts, plus a few small tests of the API conversation itself. We kept the failures in the record. We fixed problems in our code along the way, but the Interactions error remains unresolved in this setup.
There are also 43 passing offline checks and six earlier scripted replays. Those check our browser controls, saved results, API message formats, approvals, cost calculations and cleanup. They don't measure Gemini's judgment. Some use fake HTTP responses; replay uses known page controls to choose its clicks.
For anyone repeating this, the final live tests used Node 22.22.2 on macOS ARM64, @google/genai 2.32.0, Playwright 1.64.1 and the v1beta GenerateContent API. The browser ran without a visible window. We set thinking to Low, allowed 4,096 output tokens, enabled injection detection, kept Google's default safety policies and allowed one request attempt. We left temperature at the provider's default. The ranges above are the shortest and longest observed runs, not predictions of future performance.
The demo includes VALIDATION.md and validation-results.json with the results for each run. Full local screenshots, response details and Playwright traces stay outside the shareable package. We didn't measure a person doing the same task, so we can't claim a time saving over doing it by hand.
The good bit, and the waiting around
The satisfying part was watching the correct note end up on the correct ticket after the page changed size. We described the customer's problem. We didn't tell Gemini which page element to select or hand it a fixed click sequence.
Its actions also come with a readable intent. That's handy when you're looking through a log and wondering why it clicked a particular spot. And because our code handles the clicks, we can check a proposed action before allowing it.
The waiting was less fun. One request in an early resized run took 46 seconds. The browser spent little time clicking and typing; most of the run was waiting for model requests. I wouldn't choose this tiny task to demonstrate raw speed.
The token bill was small. The work of making the demo dependable was much bigger. We had to handle two API formats, typing, changed screens, approval, saved-result checks and failure logs. Google's SDK handles the requests, but you still have to build those parts around it.
I'd be more interested in a small queue of awkward jobs that would otherwise keep interrupting someone. If the same job happens thousands of times in a predictable interface, a fixed script or a direct integration starts to look much more sensible.
Where I'd use this at work
Company size matters because the rules and costs around the task change. It doesn't make the model more reliable. These are places I'd consider a pilot, rather than jobs this demo has already proved it can do.
| Team | A reasonable first experiment | When I'd choose another approach |
|---|---|---|
| Solo operator or small agency | Prepare a few updates in client portals you're allowed to use | Doing it by hand is simpler, or client accounts can't be kept separate |
| Small business support or operations | Prepare internal notes in an older system with no suitable API | The support tool already has a good API or connector |
| Product testing team | Try a user journey and keep screenshots of where it breaks | A regular Playwright test can cover a known critical journey more reliably |
| Mid-sized company with disconnected systems | Help a person handle occasional exceptions across different tools | The volume justifies a proper integration, or you can't check the final result |
| Enterprise or regulated team | An isolated pilot with fake or approved non-sensitive data | The task can't meet the team's privacy, permission or audit requirements |
I'd start finance teams with preparing an invoice, rather than releasing a payment. For marketing, I'd try preparing titles and descriptions before allowing publication. For IT, gathering evidence is an easier first job than changing production permissions. We haven't tested those jobs here.
My preference is a suitable API or connector first, then a fixed browser script for a stable, known task. I'd try visual planning when the screen is the available interface and writing a script for every variation would be expensive. You can also mix approaches: let the agent interpret an unusual case, then use an API to apply the checked update.
The EveryDev.ai comparison of Browser Use vs. Browserbase vs. Hyperbrowser vs. Notte covers some of the browser infrastructure around this. Choosing who runs the browser is a separate decision from choosing Gemini to plan its next move.
Run the JavaScript demo
The code is on GitHub in EveryDev.ai's AI demo repository. This demo has its own folder inside a pnpm workspace, so we can add other demos later without mixing their code.
You'll need Node.js 22.9 or later, pnpm 12.16.1, and a paid Gemini API key with access to your chosen model. The package pins Google's JavaScript library, @google/genai, to 2.32.0 and the browser-control tool, Playwright, to 1.64.1 so everyone starts with the same versions. Its README covers Linux browser dependencies and the full list of commands.
Clone the repository, install the packages and browser, then create your private settings file:
git clone https://github.com/EveryDevAi/ai-llm-demos.git
cd ai-llm-demos
pnpm install --frozen-lockfile
pnpm --filter @everydev-ai/gemini-computer-use exec playwright install chromium
cp demos/gemini-computer-use/.env.example demos/gemini-computer-use/.env.local
Put your key in GEMINI_API_KEY inside demos/gemini-computer-use/.env.local. Keep that file out of Git. From the repository root, run:
pnpm test
pnpm replay
pnpm demo:gemini
Those commands do different jobs. pnpm test checks our code without calling Gemini. pnpm replay uses a fixed script to complete the task without a model. pnpm demo:gemini lets Gemini choose what to do.
The demo starts a small local web server and a fresh browser session. It doesn't use your usual Chrome profile or existing accounts. Logs and screenshots go in the ignored demos/gemini-computer-use/runs/ folder.
If Gemini asks permission to Save, the terminal asks you to type SAVE T-1042. For a set of repeated tests where you've already approved that exact simulated Save, use pnpm demo:gemini --headless --approve-fixture-save. The extra flag only covers that specific prepared internal note and Save button. It doesn't grant permission to operate an external support account.
One reader asked how this compares with "headless" browser automation. Headless just means the browser runs without showing a window. Gemini can still choose actions from screenshots in a headless browser, and a fixed Playwright script can run with a visible window. These are separate choices. Playwright's browser options.
How the browser actions become JavaScript
Google's SDK has no Playwright dependency. We add Playwright ourselves.
For a look inside the SDK, GenerateContent goes through models.ts and _api_client.ts. Interactions follows client.ts, google-genai.ts and interactions-create.ts.
The browser input itself is ordinary Playwright code. After our checks, the click and type handlers do the equivalent of this:
switch (call.name) {
case 'click':
await page.mouse.click(
Math.floor((call.arguments.x / 1000) * frame.viewport.width),
Math.floor((call.arguments.y / 1000) * frame.viewport.height),
);
break;
case 'type':
await page.keyboard.insertText(call.arguments.text);
break;
}
The full demo also checks arguments, handles approval and other actions, takes screenshots and reports errors. This split lets developers use a local browser, a hosted browser or a separate mobile or desktop controller. They also have to decide permissions, timeouts, logging and what counts as finished.
A click location depends on the screenshot
Gemini returns browser coordinates as numbers from 0 to 999. A click at (500, 250) on a screenshot that is 1,200 pixels wide and 800 pixels tall becomes (600, 200) in the browser:
const pixelX = Math.floor((x / 1000) * screenshotWidth);
const pixelY = Math.floor((y / 1000) * screenshotHeight);
Divide by 1000, not 999. Use the dimensions of the screenshot Gemini saw. A picture of the full page doesn't match a visible-window coordinate system, and a high-resolution device image can differ from the browser's layout pixels. We capture the visible area using CSS pixels, the units the browser uses for layout.
For planning, Gemini gets screenshots and the current page address. It doesn't get a hidden copy of the ticket data, a list of page elements or an accessibility tree. Our code does inspect page controls while starting up, running offline tests and checking permission for the exact Save. Those checks don't tell Gemini which ticket to choose.
The first API route we tried got stuck
Google's JavaScript SDK offers two ways to have this conversation: ai.interactions.create and ai.models.generateContent. They use the same kind of browser actions, but expect different message formats and keep conversation history differently.
| API | How we send the picture | How we report an action | How it remembers earlier turns |
|---|---|---|---|
| Interactions | input text and image blocks | function_result with a matching call_id | Google keeps a chain linked by previous_interaction_id |
| GenerateContent | contents[].parts with text and inlineData | functionResponse with a name, optional original ID, result and picture | Our program resends the conversation |
We started with the Interactions example in the current guide. It clicked the right ticket, then the next request failed with HTTP 400. We checked the returned interaction ID, matching call IDs, screenshot and repeated tool settings. Two attempts used 3.8 Flash and one used 3.5 Flash-Lite. All three stopped at that first follow-up.
Once we improved the error logging, two attempts showed this message from Google:
Request blocked due to safety violations (harmful content). Please modify your input and retry.
We still don't know why it rejected that conversation or which safety check fired. A similar developer report describes the same first-follow-up problem. It was posted October 14 against SDK 2.25.0. Google staff asked for a reproduction, and the public thread had no established fix when we checked on November 5. Our version was 2.32.0. Current JavaScript guide.
We separately built and tested the GenerateContent route. Its first follow-up worked, and it's the default in the demo. We kept injection detection and the default safety policies enabled. The program never quietly changes APIs after a rejection, and we didn't disable a safety check to get a pass.
The first JavaScript request
This sends the task and screenshot, enables computer use, and tells the SDK to leave browser actions to our code:
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({
apiKey: process.env.GEMINI_API_KEY,
apiVersion: 'v1beta',
});
const config = {
tools: [
{
computerUse: {
environment: 'ENVIRONMENT_BROWSER',
enablePromptInjectionDetection: true,
},
},
],
thinkingConfig: { thinkingLevel: 'LOW' },
maxOutputTokens: 4096,
httpOptions: { timeout: 90_000, retryOptions: { attempts: 1 } },
automaticFunctionCalling: { disable: true },
};
const contents = [
{
role: 'user',
parts: [
{ text: task },
{ inlineData: { mimeType: 'image/png', data: screenshotBase64 } },
],
},
];
const response = await ai.models.generateContent({ model, contents, config });
Google calls each proposed model answer a candidate. The returned action is in candidate.content.parts[].functionCall. GenerateContent calls its arguments args; Interactions calls them arguments.
Before clicking anything, the demo checks whether Google blocked the request, whether the response finished properly, and whether an action needs approval. A finish reason of STOP can still come with a function call. It doesn't mean the whole support job is finished.
Send back what happened
After an allowed action, keep the complete original model message and add the matching action result with the new screenshot:
contents.push(candidate.content); // Keep opaque thought signatures unchanged.
contents.push({
role: 'user',
parts: [
{
functionResponse: {
...(call.id === undefined ? {} : { id: call.id }),
name: call.name,
response: { url: page.url(), executed: true },
parts: [
{
inlineData: {
mimeType: 'image/png',
data: nextScreenshotBase64,
},
},
],
},
},
],
});
const next = await ai.models.generateContent({ model, contents, config });
Those thoughtSignature values are tags Google includes in its response and may need back on the next request. We don't need to understand what's inside them, but we do need to keep them unchanged. We keep them in memory and leave them out of our logs. Rebuilding the response from only the action name and arguments can lose them. Image responses to function calls.
We found a snag in the documentation too. On November 5, one helper in the GenerateContent JavaScript guide still returned Interactions-style function_result objects, then inserted them into GenerateContent's contents[].parts. The SDK expects the functionResponse shape above. The guide also mixed the casing of the injection setting. We use the SDK's enablePromptInjectionDetection and test that it reaches the outgoing request. We haven't shown that the other spelling disables protection. GenerateContent example, SDK types.
Our offline tests use the real SDK with a fake HTTP connection to check these outgoing messages and conversation history. That catches a message-format mistake without spending money or pretending to test the model's ability.
The bugs and surprises worth knowing about
The page can change while Gemini is thinking
A reply to the announcement asked about a sidebar collapsing between the screenshot and the click. That's a useful test. Resizing the old coordinates won't help if the button itself moved somewhere else.
Before acting, our code takes another screenshot and compares its image, page address and dimensions with the version Gemini used. If they changed, an ordinary action gets rejected and Gemini receives the new picture. If an earlier action changes the screen, later actions planned from the old picture get rejected too.
That check also caught something we didn't expect. In the first full GenerateContent run, only 65 of the screenshot's 1,512,000 pixels changed around the rounded corners of the note field. The text and layout stayed put. Our exact comparison still rejected the typing action. Gemini tried again from the new picture, adding a 7.4-second request, and typed the note once.
The tiny changes came from how the browser drew the corners. We reproduced them after waiting 8 to 12 seconds. Making the demo's note field square kept those captures stable. The comparison still demands an exact match; we didn't add a tolerance that might hide a more serious change.
Later, an old screenshot caused trouble at Save. That proposed click required confirmation. We rejected it without clicking or acknowledging it, but Google then rejected the follow-up because it required the matching safety acknowledgement. Sending back an error wasn't enough. The demo now stops locally with STALE_CONFIRMATION if that happens.
The check still has a gap: a page can change after we take the checking screenshot but before the click lands. Moving clocks and animations can also cause harmless mismatches. For an app you own, checking that you're still on the same ticket and its data hasn't changed is stronger than comparing pictures. For someone else's website, the remaining gap limits what I'd allow an agent to do.
Typing needs a clear rule
One screenshot comment complained about duplicate typing in another product. That didn't prove a Gemini bug, but it gave us something worth checking.
Our type handler inserts exactly the supplied text with Playwright's keyboard.insertText. It doesn't silently clear the field first. To replace text, the model needs to select the existing text first. It can also request a select-all shortcut and Backspace to clear the field explicitly. The documented browser action doesn't include a separate append-or-replace switch. keyboard.press handles the explicit shortcuts.
The official JavaScript example made a different choice: it pressed Meta+A before every type. That can clear the wrong content or behave differently across operating systems. We also found that it listed triple_click without a branch that performed it, and omitted handlers for actions such as scrolling and hotkeys. Those are gaps in the example, not proof that the API can't do the actions. Browser action table and example.
Our demo handles its advertised browser actions and rejects unknown ones. It limits which key names it accepts, allows at most four keys in a shortcut, waits at most ten seconds per wait action, and types at most 4,000 characters per action. Those are tutorial limits you may need to revisit for another task.
Some dropdowns don't show up in the picture
Google's reference repository warns that dropdown menus drawn by the operating system can disappear from screenshots on some setups. You might see the open menu while Gemini receives a picture without it. The reference suggests another environment or controls drawn by the webpage itself.
We use visible priority buttons in this demo. That keeps this example easier to repeat. It doesn't fix menus on other websites or operating systems.
A failed request doesn't always mean nothing happened
The pinned Interactions SDK can retry eligible request errors up to four times by default, and has no request timeout unless you set one. See interactions-create.ts.
We set explicit timeouts and turn request retries off so we can count attempts clearly. GenerateContent uses httpOptions.retryOptions.attempts: 1 for one total attempt. Interactions uses retries: { strategy: 'none' } in the second argument. Its automatic_continuation option continues model decoding; it doesn't operate the browser for you.
A production service may retry a temporary planning error with a delay. Repeating a physical action needs more care. If a Save times out, check what got saved before clicking again. The first click may already have worked, and a second can save the note twice.
The model can also stop because it ran out of output room, got blocked or couldn't continue. We require a properly finished response and a separate check of what the page saved. We keep proposed and executed actions alongside the screenshots so we can work out which step failed.
What happens when a page tries to trick it
A support ticket is customer input. It should be treated as information about the problem, even when it contains text that sounds like an instruction to the agent.
Our malicious ticket tells the agent to close the ticket and send a reply. Both final attempts stopped once that text became visible. The general SAFETY response doesn't tell us whether Google's injection detector specifically caught it.
Several announcement replies pointed out that the extra injection detector defaults to false. We enable enablePromptInjectionDetection in GenerateContent and enable_prompt_injection_detection in Interactions. Google describes the feature as checking screenshots for hostile instructions. It's a setting you need to choose, rather than assume is already on. Injection detection.
Another reply asked about instructions hidden in white text. If text is truly absent from the screenshot, a model receiving only that screenshot can't read it there. Faint text, text inside images and text revealed after a click are different cases. An agent that also gets page code or accessibility information has other ways to encounter hidden text. We haven't proved protection against those attacks.
Save approval still needs your own rules
The first full GenerateContent run took 44.2 seconds and about $0.0111 in reported tokens to prepare the correct note. It then asked permission to Save. Nothing had been saved, so we recorded it as a handoff to a person.
Our approval check covers only that exact simulated Save. It verifies the open ticket, selected priority, note text and button location, then checks the screen again. Only an approved action that executes successfully gets safety_acknowledgement in its result. A changed screen at confirmation stops the run, as described above. Blocked or unknown safety decisions stop too. The approval flag can't approve Reply, Close or another target, and it doesn't turn a model safety policy off.
An earlier resized run saved the right note without asking for confirmation, while the earlier ordinary run did ask. The screens differed, so that isn't a controlled test of consistency. It does show why I'd write my own approval rules instead of waiting for the model to ask.
The fake Reply and Close controls deliberately remain available so we can detect a wrong action. Our final check catches a mistake afterward; it doesn't undo it. A real application should prevent forbidden actions before execution, whether or not the model asks permission.
The demo's browser page routes only allow the local portal. It starts without existing session cookies or customer credentials and offers no shell, general file tool or real message delivery. That's a small test environment, not an operating-system sandbox for arbitrary websites.
A local browser still sends screenshots to Google
The browser runs on your machine. The model runs at Google, and the screenshots go there.
Even though our code sends the conversation history with each GenerateContent request, Google can still store those requests. Projects created since October 26, 2026 log requests by default. Our demo leaves that setting unchanged. Project logs default to 55 days, with options of 7, 14, 28 or 55 days. Saved datasets don't expire automatically. config.store: false turns project logging off for that GenerateContent request, but separate abuse-monitoring retention still applies. Logging controls, data handling.
Interactions keeps its own stored conversation chain. Paid-tier retention defaults to 55 days, and you can't combine store: false with a chain using previous_interaction_id. Terms about using paid-service data for training are separate from how long data stays stored. Check both before sending business data. Interactions retention, paid-service terms.
That's another reason we used fake tickets. If you adapt this for real work, the screenshots and local logs can contain private information too. Keep production run records out of a public example repository.
What it costs and how to get access
Computer Use needs the paid Gemini API tier. You pay for the chosen model's input and output, with no separate Computer Use fee. A consumer Gemini subscription doesn't pay for this API. These prices were checked November 5, 2026. Pricing, API billing setup.
Create a project and key in Google AI Studio, then enable API billing. New prepaid accounts currently require at least a $5 purchase. Supported regions, model access and project quota can limit availability. Billing, supported regions.
Google recommends gemini-3.8-flash. Its Standard prices are in US dollars per million tokens, the units Google uses to count what the model processes and produces:
| 3.8 Flash usage | Through December 31, 2026 | Scheduled from January 1, 2027 |
|---|---|---|
| Input | $0.75 | $1.50 |
| Cached input | $0.075 | $0.15 |
| Output, including thinking | $3.75 | $7.50 |
The January prices are Google's published schedule. Other models and service tiers have their own rates, so recheck the price list before budgeting.
The cheapest supported starting point in the current table is 3.5 Flash-Lite: $0.30 per million input tokens, $0.03 for cached input, and $2.50 for output including thinking. Set GEMINI_MODEL=gemini-3.5-flash-lite to try it. It cost less on our ordinary task, but extra steps and failed runs can change the cost per finished job. Flash-Lite prices.
Count the whole conversation
Screenshots count as input. Earlier turns keep contributing to the work the model processes, whether your code resends them through GenerateContent or Google keeps the history through Interactions.
Thinking tokens are billed with output. Cached input is input the service reuses at a lower rate. It's already included in total input, so don't count it twice. GenerateContent reports promptTokenCount, cachedContentTokenCount, candidatesTokenCount and thoughtsTokenCount in usageMetadata. Our code converts those into the shared names below. Thinking and billing, GenerateContent response fields, Interactions reference.
const fields = [
'total_input_tokens',
'total_cached_tokens',
'total_output_tokens',
'total_thought_tokens',
];
const hasUsage = fields.every((field) => Number.isFinite(usage?.[field]));
const estimatedUSD = hasUsage
? ((usage.total_input_tokens - usage.total_cached_tokens) * 0.75 +
usage.total_cached_tokens * 0.075 +
(usage.total_output_tokens + usage.total_thought_tokens) * 3.75) /
1_000_000
: null; // Missing usage means an unavailable estimate, rather than zero cost.
Apply that calculation to every request and add the results. Some responses omitted a thinking count. We only count thinking as zero when Google's other reported token counts add up completely, leaving nothing unaccounted for. We label that calculation separately. If the numbers are missing or don't add up, we leave the cost unknown. That includes incomplete usage from rejected requests. Usage definitions.
As a separate arithmetic example, 90,000 uncached input tokens, 30,000 cached input tokens and 10,000 billed output tokens cost about $0.11 at the introductory Flash rates. Our measured demo costs are in the results table. Your bill also depends on screenshots, thinking, accumulated context and failures, plus any browser hosting, storage, tax or supervision costs.
The billing docs now describe prepaid balances and experimental monthly project spending caps. Usage reporting can lag, so a cap can still allow some overage. Older complaints about having no spending controls need that context. Our local turn limit only bounds this runner; it can't cap other requests using the same key. Keep the key out of browser JavaScript and use project controls too. Current billing controls.
What's available now, and what might come next
Google first released Gemini 2.5 Computer Use as a preview in October 2025. The API changelog dates general availability to October 30, 2026. The Google AI Studio post followed on November 4 and said there were no breaking changes from preview. Those are the release date and announcement date, respectively. Original release, changelog, announcement.
The current guide lists Gemini 4 Argon, 3.8 Flash, 3.5 Flash-Lite and 3 Flash Preview as supporting models. Your project still needs access to the one you choose. General availability and a compatible API don't tell you whether it will handle your particular screen correctly. Supported models.
The November 2 Gemini and Cua Driver guide uses a different setup. Cua supplies desktop controls that can work in the background. It gives Gemini tools, screenshots and accessibility information about controls, including element tokens. That can let it target a named element with an operation such as set_value, rather than choosing a point in an image.
That guide already shows how Antigravity can connect to Cua's tools through MCP. It doesn't establish that Google's computer_use tool is built into every Antigravity or Gemini app. Cua's background desktop controls also aren't a feature supplied by Google's JavaScript SDK alone.
Logan Kilpatrick's reply about hosted computer use suggests a direction for Google. It isn't a launch date or price for an available Google-managed browser. Our demo still starts its own Chromium process.
What we took from the comments
The comments helped us choose things to test: a changed layout, duplicate typing, prompt injection, permissions and waiting around. We checked the linked reports rather than treating every complaint as a measured Gemini defect.
An older Reddit billing complaint describes delayed usage visibility. A Gemini API reliability thread has users reporting overload errors and others reporting fewer problems. Those are accounts of the wider API, not measurements of this Computer Use release. They gave us reasons to log requests, test stopping and check spending controls.
The preview client's issue tracker is more directly relevant, with reports about coordinates and safety acknowledgements. A broken action handler in a client can look like a model failure. We tried to keep that distinction visible in our own results too.
I'd start with one job where you can check the saved result, using data you're allowed to send to Google. For this demo, that meant one open ticket, High priority and the exact note saved once. That's the result I'd want before handing the assistant a bigger queue.
Comments
Checking profile…