Overview
This page follows paid tools from quoting through reservation, asynchronous execution, settlement, and artifact retrieval. Track long-running work by execution ID instead of keeping an HTTP connection open.Understand execution and billing
POST /tools/quote returns the price version, minimum charge, and maximum reservation for the current input. Quotes are free: they neither invoke external services nor reserve funds.
To execute, use the same tool and arguments as the quote and add these two fields:
priceVersion— The price version returned by the quotemaximumChargeMicros— The maximum reservation returned by the quote
Reserve and settle charges
When paid work is accepted, the maximum reservation is temporarily held from the prepaid USD balance. After completion, the actual charge is settled and the unused reservation is returned to the balance.
Failures and cancellations can still settle actual costs already incurred by external processing. Charges never automatically exceed the maximum reservation.
Track execution status
Acceptance returns HTTP 202 and an execution ID. FollowRetry-After: 5 and poll the same ID at intervals of at least five seconds.
Prevent duplicates with idempotency keys
An idempotency key identifies a request so that accidentally sending it multiple times does not create separate executions. PaidPOST /tools/{tool} requests require the Idempotency-Key header.
Keys must be 8–128 characters using letters, digits, ., _, :, or -. Generate one per logical request and store it with the execution ID.
- Resending the same API key, body, and idempotency key returns the same execution.
- Changing the body or API key while reusing the idempotency key returns HTTP 409.
- After a connection failure, resend without changing the body or idempotency key.
- Resending a
needs_reviewrequest with a new idempotency key creates another paid execution.
Cancel an execution
POST /tools/executions/{id}/cancel requests that work which has not started be stopped. The key that created the execution or a project ADMIN can request cancellation.
Once external processing has started, a cancellation request may not undo the work or its cost. Check cancelRequested and the final status and chargedMicros.
Retrieve artifacts
Generated images, audio, and video appear inoutput.artifacts as file IDs, formats, sizes, hashes, and expiration dates. The execution result does not contain file contents or permanent URLs.
Call GET /tools/executions/{id}/artifacts/{artifactId}/download to obtain a download URL valid for up to five minutes. Stored files expire after 30 days.
Even temporary download URLs grant access to private data. Do not log or publish them, and do not append the Developer Platform API key to them.