{"slug": "how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long", "title": "How to Use Gemini 4 Argon in the Gemini API: Setup, Thinking Levels and Long Outputs", "summary": "Google made Gemini 4 Argon generally available to developers on October 13, 2026, offering a unified 1,048,576-token window shared across input, thinking and output, tunable thinking levels (low, medium, high), and single responses far longer than the previous 64K-token ceiling. The model is aimed at long multi-step work such as code migrations, agentic workflows and hard math and science problems, and is available only on the paid Gemini API tier or via a Google AI Ultra subscription. Introductory pricing runs at $2 per million input tokens and $10 per million output tokens through November 30, 2026, doubling to $4 and $20 from December 1.", "body_md": "Google made [Gemini](https://mangodeveloper.com/articles/how-to-turn-on-personal-intelligence-for-gemini-in-android-auto) 4 Argon generally available to developers on October 13, 2026. It is the company's most capable model in the Gemini API, aimed at long, multi-step work such as code migrations, agentic workflows, and hard math and science problems. Argon reasons for longer than earlier Gemini models, shares a single 1,048,576-token window across input, thinking and output, and can now write a single response far longer than the old 64K-token ceiling.\n\nThis guide is for developers who want to call Argon from their own code. It walks through access requirements, the first request in Python, JavaScript and REST, how to choose a thinking level, how to generate very long outputs with background execution, and the changes you need to make if you are moving an existing app over from an older Gemini model.\n\nThe model ID is gemini-4-argon. Its headline changes are a unified 1M-token limit for input and output together, long decode that lets one response run up to 1M tokens minus your input, tunable thinking levels (low, medium and high, with medium as the default), and support inside the Antigravity agent in Gemini Managed Agents. Agentic video understanding is also generally available alongside it.\n\nArgon is not available on the free tier of the Gemini API, and it is not included in the Google AI Pro plan. You need one of two things: a Gemini API project on the paid tier, or a Google AI Ultra subscription for trying it in Google AI Studio and in Google Antigravity.\n\nThrough November 30, 2026, Google is charging an introductory price of $2 per million input tokens and $10 per million output tokens, with thinking tokens billed as output. From December 1, 2026 the price rises to $4 and $20. Implicit caching discounts cached input by 95 percent, to $0.10 per million tokens during the introductory period and $0.20 afterward. Because Argon can spend a lot of tokens on thinking, budget for output costs carefully on hard prompts.\n\nYou will also need Python with pip or Node.js with npm if you plan to use an SDK, or curl and jq for the REST examples.\n\nOpen the API keys page in Google AI Studio. New users get a project and key created automatically; otherwise select Create API key.\n\nSelect Set up billing on the API keys or Projects page and follow the Cloud Billing dialog. Google requires you to link a billing account, add a payment method and prepay a minimum of $5 (or the local currency equivalent) in credits.\n\nStore the key in an environment variable so the SDKs can find it without hard-coding it:\n\n```\nBashCopy\n```\n\nexport GEMINI_API_KEY=\"YOUR_API_KEY\"\n\n```\nBashCopy\n```\n\nshell\n\npip install -U google-genai\n\nplaintext\n\n```\nBashCopy\n```\n\nshell\n\nnpm install @google/genai\n\nmarkdown\n\n```\nPythonCopy\n```\n\npython\n\nfrom google import genai\n\nclient = genai.Client()\n\ninteraction = client.interactions.create(\n\n    model=\"gemini-4-argon\",\n\n    input=\"Review this function for race conditions and suggest a safer locking strategy.\"\n\n)\n\nprint(interaction.output_text)\n\n```\nBashCopy\n```\n\nshell\n\ncurl \"[https://generativelanguage.googleapis.com/v1beta/interactions](https://generativelanguage.googleapis.com/v1beta/interactions)\" \\\n\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n\n  -H 'Content-Type: application/json' \\\n\n  -X POST \\\n\n  -d '{\n\n    \"model\": \"gemini-4-argon\",\n\n    \"input\": \"Explain the trade-offs between optimistic and pessimistic locking.\"\n\n  }'\n\nThe thinking level is your main control over quality, latency and cost. Low uses the fewest tokens and suits simpler or cost-sensitive work, though quality can drop on hard tasks. Medium is the default and is recommended for most jobs, including complex code and agents. High uses the most tokens and has the slowest first token, and is meant for the hardest reasoning, math, science and coding tasks.\n\n```\nPythonCopy\n```\n\npython\n\ninteraction = client.interactions.create(\n\n    model=\"gemini-4-argon\",\n\n    input=\"Plan a step-by-step migration of this service from callbacks to async/await.\",\n\n    generation_config={\"thinking_level\": \"medium\"}\n\n)\n\nBy default a response is capped at 65,536 tokens. To go further, set background to true and max_output_tokens above 65,536. The server then generates the answer in hops of up to 64K tokens, continuing each hop where the last one stopped, and adds a model_output step for every hop.\n\n```\nPythonCopy\n```\n\npython\n\nimport time\n\nfrom google import genai\n\ninteraction = client.interactions.create(\n\n    model=\"gemini-4-argon\",\n\n    input=\"Write full API documentation for the attached module.\",\n\n    background=True,\n\n    generation_config={\"max_output_tokens\": 262144, \"thinking_level\": \"high\"},\n\n)\n\nwhile interaction.status in (\"in_progress\", \"queued\"):\n\n    time.sleep(5)\n\n    interaction = client.interactions.get(id=interaction.id)\n\ntext = \"\".join(\n\n    c.text\n\n    for step in interaction.steps if step.type == \"model_output\"\n\n    for c in step.content if c.type == \"text\"\n\n)\n\nprint(text)\n\nIf you set background to true but leave out max_output_tokens, the server still stops at 64K tokens, so always set both.\n\nChange the model string to gemini-4-argon.\n\nReview max_output_tokens. If your app sets a limit below 32K, raise it to at least 32,768, because Argon can spend more of the budget on thinking. To save tokens, lower the thinking level instead of the limit.\n\nRemove temperature, top_p and top_k. Argon ignores them.\n\nRemove explicit context caching. Calls that create or reference cachedContents are not supported on Argon. Implicit caching is on by default for prompts of at least 4,096 tokens.\n\nRaise HTTP client timeouts to at least 15 minutes, or use background execution, because hard prompts can take several minutes.\n\nKeep multi-turn and function-calling state on the server by passing previous_interaction_id rather than resending history yourself.\n\nAndroid developers can reach Argon in [Android Studio](https://mangodeveloper.com/articles/how-to-connect-claude-codex-or-antigravity-to-android-studio-rabbit-2-with-bring-your-own-agent) through a paid-tier Gemini API key, or, with a Google AI Ultra subscription, by signing in to Antigravity in the latest Android Studio Canary. To connect an agent to local Android build tools from the terminal, install the official plugin for Antigravity, or initialize the [Android CLI](https://mangodeveloper.com/articles/how-to-trace-jetpack-compose-1-13-recompositions-automate-builds-android-cli-1-1) for any terminal agent:\n\n```\nBashCopy\n```\n\nshell\n\nagy plugin install android-cli-plugin\n\n```\nBashCopy\n```\n\nplaintext\n\nandroid init\n\nRequests to gemini-4-argon fail while other models work: check which tier your key belongs to. Argon is not offered on the free tier or through Google AI Pro, so the project needs billing set up.\n\nAnswers end abruptly: the response probably hit max_output_tokens, which counts thinking and output together. Raise the limit, or lower the thinking level so less of the budget goes to reasoning.\n\nOutput stops near 64K tokens: long decode needs both background set to true and max_output_tokens above 65,536.\n\nRequests time out: increase your client timeout to at least 15 minutes or switch to background execution and poll.\n\nCode that used caches.create breaks: explicit caching is not supported on Argon. Remove it and rely on implicit caching instead.\n\nTemperature changes have no effect: this is expected. Sampling parameters are ignored on Argon; use thinking_level to steer behavior.\n\nNo. It is not available on the Gemini API free tier or the Google AI Pro plan. You need the paid tier of the Gemini API, or a Google AI Ultra subscription to try it in AI Studio and Antigravity.\n\nInput, thinking and output share one window of 1,048,576 tokens. A single response can use up to 1M tokens minus your input when you enable background execution.\n\nStart with the default, medium. Then test low and high on your own prompts and keep the lowest level that still meets your quality bar.\n\nThey will not cause errors, but Argon ignores temperature, top_p and top_k. Remove them to keep your requests clean.\n\nOriginally published on [Mango Developer](https://mangodeveloper.com/articles/how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long-outpu).", "url": "https://wpnews.pro/news/how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long", "canonical_source": "https://dev.to/mango7777/how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long-outputs-2181", "published_at": "2026-11-29 10:30:00+00:00", "updated_at": "2026-11-29 10:44:06.608938+00:00", "lang": "en", "topics": ["large-language-models", "artificial-intelligence", "ai-agents", "ai-tools", "generative-ai"], "entities": ["Google", "Gemini 4 Argon", "Gemini API", "Google AI Studio", "Google AI Ultra", "Google Antigravity", "Gemini Managed Agents"], "also_reported_by": [], "takeaway": "Gemini 4 Argon shares one 1,048,576-token window across input, thinking and output, with thinking levels low/medium/high (medium default) and thinking tokens billed as output at $10 per million tokens during the introductory period.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long", "markdown": "https://wpnews.pro/news/how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long.md", "text": "https://wpnews.pro/news/how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long.txt", "jsonld": "https://wpnews.pro/news/how-to-use-gemini-4-argon-in-the-gemini-api-setup-thinking-levels-and-long.jsonld"}}