How to Call Gemini 4 Argon with the OpenAI SDK: Streaming, reasoning_effort and the Real Cost of Each Request A developer at API gateway apimodels.app published a guide showing how to call Google's Gemini 4 Argon reasoning model through the OpenAI Python SDK by swapping the base_url, covering streaming, the reasoning_effort parameter, and per-request cost tracking. The writeup notes that Argon always reasons before answering and that Google bills thinking tokens at the output rate, with the author's own tests showing a one-word "OK" reply consumed 66 thinking tokens on 14 October 2026, and 105 at low versus 302 at high effort the next day. The author recommends setting thinking levels deliberately and reading reasoning_tokens from every response, since high-effort prompts ran 8 to 10 minutes. You send Gemini 4 Argon a one-line question, get a one-word answer, and the usage block says you paid for about 70 output tokens. That is not a bug. Argon thinks before every answer, and thinking is billed as output. Gemini 4 Argon gemini-4-argon is Google's flagship reasoning model, available on the paid tier of the Gemini API since 13 October 2026, with a 1M-token context window shared by input and output and up to 65,536 output tokens per response. This tutorial calls it through an OpenAI-compatible endpoint with the official openai Python package, streams long answers, sets the thinking level with reasoning effort , and reads back exactly what each request cost. Disclosure up front: the endpoint in the examples is apimodels.app, the API gateway I work on. The same code runs against Google's own OpenAI-compatible endpoint if you swap the base URL; I note the differences where they matter. This post was drafted with AI assistance from our docs and test notes, and every command was checked against those sources. pip install openai curl for the first check export APIMODELS API KEY="sk your key here" https://api.apimodels.app/v1 with Google directly, it is https://generativelanguage.googleapis.com/v1beta/openai/ and a Gemini API key Argon always reasons before it answers, and Google bills those thinking tokens at the output rate. Google's pricing page says it plainly: "Output price including thinking tokens ". Google's thinking guide https://ai.google.dev/gemini-api/docs/thinking lists three levels for Argon low, medium, high , sets medium as the default, and thinking cannot be turned off. Our own measurements show the effect. On 14 October 2026, asking Argon to reply with just "OK" used 66 thinking tokens. On 15 October, the same prompt used 105 thinking tokens at low and 302 at high . On one hard reasoning prompt, high ran for 8 to 10 minutes. So two habits matter from the first line of code: set the thinking level on purpose, and read the thinking count from every response. This request asks a short question at the lowest thinking level, which keeps the first test fast. curl https://api.apimodels.app/v1/chat/completions \ -H "Authorization: Bearer $APIMODELS API KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-4-argon", "messages": {"role": "user", "content": "In one sentence: what does a database index trade off?"} , "reasoning effort": "low", "max tokens": 4000 }' You get a standard chat-completion object. Look at usage : completion tokens already includes thinking, and completion tokens details.reasoning tokens tells you how much of it was thinking. The OpenAI SDK needs only a different base url . Using with raw response keeps the response headers, which carry the request ID and, for non-streaming calls on apimodels.app, the amount charged. python import os from openai import OpenAI client = OpenAI api key=os.environ "APIMODELS API KEY" , base url="https://api.apimodels.app/v1", timeout=900, high-effort runs can take minutes raw = client.chat.completions.with raw response.create model="gemini-4-argon", messages= {"role": "user", "content": "Explain the N+1 query problem in two sentences."} , reasoning effort="low", max tokens=4000, resp = raw.parse print resp.choices 0 .message.content u = resp.usage thinking = getattr u.completion tokens details, "reasoning tokens", 0 or 0 print "input:", u.prompt tokens, "| output incl. thinking:", u.completion tokens, "| thinking:", thinking print "request id:", raw.headers.get "x-apimodels-request-id" print "charged USD :", raw.headers.get "x-apimodels-cost" The last two lines are apimodels.app-specific headers; with Google directly they are absent and you calculate cost from usage yourself. Streaming is the safe default for Argon, because a long, high-effort answer can take minutes. Ask for usage in the final chunk with stream options . stream = client.chat.completions.create model="gemini-4-argon", messages= {"role": "user", "content": "Write a step-by-step plan to migrate a Flask app from SQLAlchemy 1.4 to 2.0."} , reasoning effort="medium", stream=True, stream options={"include usage": True}, usage = None for chunk in stream: if chunk.choices and chunk.choices 0 .delta.content: print chunk.choices 0 .delta.content, end="", flush=True if chunk.usage: usage = chunk.usage print "\n\nusage:", usage In one test on 15 October 2026, a stream of 16,599 output tokens took 144 seconds, with the first token after 8.7 seconds, about 120 tokens per second after that. On api.apimodels.app a streamed Argon response can run for up to 30 minutes; a non-streaming request is cut off at 13 minutes limits as of 17 October 2026 . Use the api.apimodels.app host for long jobs. reasoning effort maps to Argon's three thinking levels. apimodels.app sends none and minimal as low Argon cannot turn thinking off , medium as medium , and high , xhigh and max as high ; any other value is dropped and the model's default medium applies. Google's own OpenAI-compatible endpoint maps minimal to low for Argon as well. A practical split: Do not use max tokens as your cost control. Google's docs warn that when the limit is hit during reasoning, the answer can come back truncated or empty while the thinking tokens are still billed. Lower the thinking level instead, and keep max tokens generous. The ceiling for a normal request is 65,536; anything above that returns a 400 error. Tool calling works through the same endpoint: in our tests on 15 October 2026, single tools, three parallel tools, streaming and multi-turn tool conversations all passed. One schema detail trips people up. Some JSON Schema generators add a top-level "$schema" key, and Gemini rejects it: Invalid JSON payload received. Unknown name "$schema" at 'tools 0 .function declarations 0 .parameters' Strip it before you send the tool definition: php def clean parameters schema: dict - dict: schema = dict schema schema.pop "$schema", None return schema Every successful LLM response from apimodels.app carries an x-apimodels-request-id header, streaming included. Pass that ID to the records endpoint to get the settled amount. curl https://api.apimodels.app/v1/records/