Python 88.3%
TypeScript 7.6%
Shell 4.1%
1// STATUS: LIVE_VERIFIED — executed 2026-09-18 (exit 0 in 13.0s)2// Thinking: thinkingBudget + includeThoughts on gemini-3.5-flash (thought summary part + thoughtsTokenCount), then thinkingLevel low on the same model.3// Run: node --env-file=.env --experimental-strip-types examples/gemini/thinking/thinking.ts (@google/genai 2.23 reads GEMINI_API_KEY)4import { GoogleGenAI } from "@google/genai";5import { appendFileSync } from "node:fs";67const ai = new GoogleGenAI({});8const MODEL = "gemini-3.5-flash";9const log = (method: string, path: string, status: number, cost: number, note: string) =>10 appendFileSync("reports/live-requests.jsonl", JSON.stringify({ ts: new Date().toISOString().replace(/\.\d+Z$/, "Z"), provider: "gemini", method, path, status, est_cost_usd: cost, note }) + "\n");11const r = await ai.models.generateContent({ model: MODEL, contents: "What is 17*23? Reply with the number only.", config: { maxOutputTokens: 600, thinkingConfig: { thinkingBudget: 256, includeThoughts: true } } });12log("POST", "/v1beta/models/{model}:generateContent", 200, 0.0012, "example thinking/thinking.ts (budget 256)");13for (const p of r.candidates?.[0]?.content?.parts ?? []) console.log(p.thought ? "THOUGHT:" : "ANSWER:", (p.text ?? "").slice(0, 120).replace(/\n/g, " "));14console.log("thoughtsTokenCount:", r.usageMetadata?.thoughtsTokenCount, "candidates:", r.usageMetadata?.candidatesTokenCount);15if (!r.text?.includes("391")) throw new Error("wrong answer");16const r2 = await ai.models.generateContent({ model: MODEL, contents: "Reply with OK.", config: { maxOutputTokens: 32, thinkingConfig: { thinkingLevel: "low" } } });17log("POST", "/v1beta/models/{model}:generateContent", 200, 0.00003, "example thinking/thinking.ts (level low)");18console.log("level low:", r2.text, r2.usageMetadata?.thoughtsTokenCount);19