Python 88.3%
TypeScript 7.6%
Shell 4.1%
1// STATUS: UNVERIFIED (ACCOUNT_RESTRICTED) — REST create returned 400 FAILED_PRECONDITION "Precondition check failed." on2// 2026-09-18 (free-tier key; Batch API has no free tier). Paid key: BATCH_STATE_PENDING → RUNNING → SUCCEEDED.3// Run: node --env-file=.env --experimental-strip-types examples/gemini/batch/batch-inline.ts4import { GoogleGenAI } from "@google/genai";56const ai = new GoogleGenAI({});7const req = { contents: [{ role: "user", parts: [{ text: "Reply with OK." }] }], config: { maxOutputTokens: 8 } };8let job = await ai.batches.create({ model: "gemini-3.5-flash-lite", src: [req, req], config: { displayName: "atlas-example" } });9console.log("created", job.name, job.state);10const terminal = new Set(["JOB_STATE_SUCCEEDED", "JOB_STATE_FAILED", "JOB_STATE_CANCELLED", "JOB_STATE_EXPIRED"]);11const t0 = Date.now();12while (!terminal.has(String(job.state)) && Date.now() - t0 < 300_000) {13 await new Promise((r) => setTimeout(r, 20_000));14 job = await ai.batches.get({ name: job.name! });15 console.log(`t+${Math.round((Date.now() - t0) / 1000)}s`, job.state);16}17for (const r of job.dest?.inlinedResponses ?? []) console.log(JSON.stringify(r.metadata), r.response?.text ?? JSON.stringify(r.error));18if (job.dest?.fileName) console.log("responses file:", job.dest.fileName);19await ai.batches.delete({ name: job.name! });20