Skip to main content
Use this runtime for native Gemini embeddings, tasks, Alpha Search, and Midjourney status. Run Node.js 22.18+ or 24 LTS from the documentation directory. API_ROOT_URL is the gateway origin plus an optional deployment prefix, without /v1 or /v1beta. API_KEY is a gateway token.
When copying scripts to another project, also copy examples/http-client.mjs. It sends Bearer credentials only to the configured gateway, rejects redirects, and rejects credentials, queries, or fragments in the base URL. Each request has a 60-second timeout including body consumption and a 1 MiB JSON limit. These are example limits; there are no automatic retries. Errors do not print raw responses or keys. JSON requests validate HTTP, Content-Type, and error envelopes before each example validates business fields. HTTP 200 does not prove completion. The task example separately limits binary downloads to 20 MiB. After a generation transport failure, inspect any known task before submitting again. This support module cannot call a model on its own. Existing Python / SDK examples continue to use API_BASE_URL including /v1; do not confuse the variables.
阅读中文版