> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 4 Argon Text Generation

> Google's new flagship Gemini 4 Argon, live on APIYI from day one with Gemini native and OpenAI-compatible endpoints. Limited-time promotional rate: $2 in / $10 out per 1M tokens. Includes 400+ pre-launch test calls: 1M context, thinking levels, and must-fix migration items.

Gemini 4 Argon (`gemini-4-argon`) is the flagship Google announced on September 30, 2026 and the first model of the Gemini 4 family. Google positions it for long-horizon software engineering, enterprise knowledge work such as legal and finance, and cybersecurity defense. It opened to the paid tier of the Gemini API on October 13, and APIYI is among the first platforms with access. Both the **Gemini native** and **OpenAI-compatible** endpoints are open, and we ran 400+ test calls before launch with `gemini-3.1-pro-preview` as the reference.

<Info>
  **Gemini 4 Argon is live on APIYI**: model name `gemini-4-argon`, available in the `default` and `svip` groups, served from official Google capacity. Pricing currently follows Google's **limited-time promotional rate** of \$2 input / \$10 output per 1M tokens, valid through November 30, 2026. **From December 1, Google's price goes to \$4 / \$20, and APIYI will adjust at the same time.**
</Info>

<Warning>
  **One required change when migrating from Gemini 3.x**: Argon **does not support** `thinkingConfig.thinkingBudget`. Passing it may return a 400 (`Thinking budget is not supported for this model. Use thinking level instead.`) or may be ignored, so the outcome is not reliable. Google's migration guide says it is deprecated with a warning, but we have seen hard errors in practice. Remove `thinkingBudget` and use `thinkingLevel` (`low` / `medium` / `high`).
</Warning>

## Key Advantages

<CardGroup cols={2}>
  <Card title="Same accuracy, far less thinking" icon="gauge">
    On 12 auto-graded tasks run 3 times each, Argon and 3.1 Pro both scored 36/36, but Argon used about 1/12 of 3.1 Pro's thinking tokens, with a median latency of 15.4s vs 35.0s. Thinking tokens bill as output, so each task costs less in practice.
  </Card>

  <Card title="1M context, verified" icon="file-text">
    A 1.01M-token input returned normally; anything larger got a 400 that states the 1,048,576 limit. A needle-in-a-haystack test at 239K tokens was answered correctly in 29.7s, almost twice as fast as 3.1 Pro.
  </Card>

  <Card title="Top scores on Google's benchmarks" icon="trophy">
    Google reports DeepSWE v1.1 77.9％, LVBench (long video) 91.7％, AutomationBench 51.3％, #1 on the Vals Index, and a tie for #1 on CWE-bench v1.
  </Card>

  <Card title="Both endpoints, full tool chain" icon="git-fork">
    Native endpoint 14/14, OpenAI-compatible endpoint 12/13 (the one miss matches 3.1 Pro). Function calling (single / parallel / sequential), structured output, image and video understanding, code execution, and URL context all pass.
  </Card>
</CardGroup>

## Model Information

| Parameter | Value |
| - | - |
| **Model name** | `gemini-4-argon` |
| **Input modalities** | Text, image, video, audio (image and video tested) |
| **Output modality** | Text |
| **Context window** | 1M tokens, shared by input and output (measured input limit 1,048,576) |
| **Default max output** | 65,536 tokens (per Google; long decode beyond 64K needs the Interactions API, which APIYI does not support yet) |
| **Thinking** | Defaults to `medium`; `thinkingLevel` low / medium / high; **`thinkingBudget` not supported** |
| **Groups** | `default`, `svip` |
| **Endpoints** | `POST /v1beta/models/gemini-4-argon:generateContent` (native), `POST /v1/chat/completions` (OpenAI-compatible) |
| **Streaming** | ✅ Both endpoints |

## Official Benchmarks

All figures below are **published by Google** (the `blog.google` posts of 2026-09-30 and 10-13) and have not been reproduced by APIYI:

| Benchmark | What it measures | Gemini 4 Argon |
| - | - | - |
| DeepSWE v1.1 | Real-world long-horizon software engineering | 77.9％ (SOTA per Google) |
| Vals Index | Finance / coding / legal / tax | #1 |
| AutomationBench (Zapier) | End-to-end business workflow execution | 51.3％ (#1) |
| LVBench | Long video understanding | 91.7％ (SOTA per Google) |
| CWE-bench v1 | Security vulnerability remediation | 68％ (tied #1) |
| ERQA | Embodied / spatial reasoning | 87％ |
| Gray Swan IPI | Indirect prompt injection success rate (lower is better) | 0.7％ |

## Tested Capability Matrix

Tested by APIYI on October 13–14, 2026 (UTC+8). In the compatibility suite, every case was fired **at the same time** as `gemini-3.1-pro-preview`:

| Capability | Gemini native | OpenAI-compatible | vs 3.1 Pro |
| - | - | - | - |
| Basic chat (non-streaming / streaming) | ✅ / ✅ | ✅ / ✅ | Same |
| System instruction, multi-turn | ✅ | ✅ | Same |
| Long-context lookup (8.6K-token prefix + 128 max output) | ✅ 2/2 | ✅ | **3.1 Pro 0/2** (thinking used up the 128-token limit) |
| Needle in a haystack, 35K / 239K tokens | ✅ / ✅ | — | Same, Argon faster |
| Structured output | ✅ responseJsonSchema (recommended) / responseSchema | ✅ json\_schema | Same |
| Function calling (single / round trip / sequential) | ✅ | ✅ | Same |
| **Parallel function calling** | ✅ 4/4 | ✅ | **3.1 Pro 0/2 on the OpenAI endpoint** |
| Image / video understanding | ✅ 2/2 / ✅ 2/2 | ✅ / ✅ | Same |
| Code execution (`codeExecution`) | ✅ | — native only | Same |
| URL context (`urlContext`) | ✅ returns `urlContextMetadata` | — native only | Same |
| `stopSequences` / `stop` | ✅ enforced | ⚠️ not enforced | Same |
| `safetySettings` | ✅ returns `safetyRatings` | — native only | Same |
| Google Search grounding | ⚠️ accepted, but no `groundingMetadata` returned | — native only | Same |
| Implicit caching | ⚠️ low hit rate (see "Caching") | Same | — |
| Explicit caching `cachedContents` / `:countTokens` | ❌ not supported (Google does not support explicit caching either) | — | Same |
| Interactions API | ❌ not yet supported by the APIYI gateway | — | — |

<Warning>
  **Search grounding is unconfirmed**: passing `tools: [{"googleSearch": {}}]` returns 200, but the response has **no `groundingMetadata`**, so the answer comes from the model's own knowledge rather than a live search. 3.1 Pro behaved the same in the same run, which points to how the route is provisioned rather than to the model. If you rely on live retrieval, validate with a small amount of traffic first.
</Warning>

## Pricing

| Item | Promotional rate (through 2026-11-30) | From 2026-12-01 |
| - | - | - |
| Input | \$2 / 1M tokens | \$4 / 1M tokens |
| Output (incl. thinking) | \$10 / 1M tokens | \$20 / 1M tokens |
| Cache read | \$0.1 / 1M tokens | Follows Google's change |

<Note>Model prices are aligned with the official site and may change with it; the table above is for reference only, and the **Model Pricing** tab in the top navigation is authoritative: [Model Pricing](/en/models/index).</Note>

**Billing was checked against real charges**: across three calls, the amount actually deducted was within 1.5％ of what the unit prices above give. Thinking tokens bill as output, and Argon thinks very little on most requests, which is the main reason it costs less in practice than models in the same tier. Discounts come from top-up bonuses; see [Top-up Promotions](/en/faq/recharge-promotions).

## Thinking Control

Google's default level is `medium`. Results on one combinatorics proof (native endpoint):

| Setting | Thinking tokens | Latency |
| - | - | - |
| Not set (default medium) | 0 | 9.0s |
| `thinkingLevel: "low"` | 0 | 9.5s |
| `thinkingLevel: "medium"` | 0 | 8.6s |
| `thinkingLevel: "high"` | 1,097 | 28.5s |
| `thinkingBudget` (any value) | — | **Not supported**, may 400 |
| `thinkingLevel: "minimal"` | — | **Not supported**, 400 |

<Tip>
  Low and medium **adapt to the difficulty of the task**: on this problem the model decided no thinking was needed and answered directly. When you need reliable deep reasoning (multi-file debugging, formal math, architecture design), **pass `high` explicitly**. To see the thinking, pass `includeThoughts: true`; usage shows up in `usageMetadata.thoughtsTokenCount`.
</Tip>

<Warning>
  **`reasoning_effort` on the OpenAI-compatible endpoint has little visible effect**: `minimal`, `low`, `medium` and `high` all return 200, but `usage.completion_tokens_details.reasoning_tokens` is never returned and completion tokens are similar across levels. Thinking cannot be turned off on Argon, so **do not pass `reasoning_effort: "none"`**; it may return a 400. For controllable deep thinking, use the Gemini native endpoint with `thinkingLevel: "high"`.
</Warning>

## Caching

Google says Argon has **implicit caching on by default** and does not support explicit caching. In APIYI's tests the hit rate is low: most repeated same-prefix requests did not hit, and hits showed up only on some requests (a 70K-token prefix sent four times hit about 68K tokens on the last two, billed at the cache rate).

<Warning>
  **Do not budget on cache hits.** Implicit cache hit rates on the Gemini family have never been steady, and Argon is no exception. Budgeting at the full input price is the safer assumption; treat any hit as extra savings. To check whether a request hit the cache, use **Cache billing details** in the console.
</Warning>

## Code Examples

### Gemini Native Format (recommended, most complete)

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.apiyi.com/v1beta/models/gemini-4-argon:generateContent" \
    -H "x-goog-api-key: sk-your-apiyi-key" \
    -H "Content-Type: application/json" \
    -d '{
      "contents": [{"parts": [{"text": "Introduce yourself in one sentence"}]}],
      "generationConfig": {"thinkingConfig": {"thinkingLevel": "low"}}
    }'
  ```

  ```python Python (google-genai SDK) theme={null}
  from google import genai
  from google.genai import types

  client = genai.Client(
      api_key="sk-your-apiyi-key",
      http_options=types.HttpOptions(base_url="https://api.apiyi.com", timeout=1200_000)
  )

  response = client.models.generate_content(
      model="gemini-4-argon",
      contents="Find the concurrency bugs in this code and propose fixes: ...",
      config=types.GenerateContentConfig(
          thinking_config=types.ThinkingConfig(thinking_level="high")
      )
  )
  print(response.text)
  ```
</CodeGroup>

<Note>
  The native endpoint accepts either authentication style: the `x-goog-api-key` header (the official SDK default) or `Authorization: Bearer`. Both take your APIYI `sk-` key.
</Note>

### OpenAI-Compatible Format (no changes to existing code)

<CodeGroup>
  ```python Python (OpenAI SDK) theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="sk-your-apiyi-key",
      base_url="https://api.apiyi.com/v1",
      timeout=1200
  )

  response = client.chat.completions.create(
      model="gemini-4-argon",
      messages=[{"role": "user", "content": "Design a URL shortener that handles a million concurrent users. Cover the architecture and key trade-offs."}]
  )
  print(response.choices[0].message.content)
  ```

  ```javascript Node.js (streaming) theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    apiKey: 'sk-your-apiyi-key',
    baseURL: 'https://api.apiyi.com/v1'
  });

  const stream = await client.chat.completions.create({
    model: 'gemini-4-argon',
    messages: [{ role: 'user', content: 'Outline an assessment report for a Rust migration' }],
    stream: true
  });

  for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
  }
  ```
</CodeGroup>

## Migration Guide

<AccordionGroup>
  <Accordion title="Migrating from gemini-3.1-pro-preview">
    Change the model name, then check three things: (1) remove `thinkingBudget` and use `thinkingLevel` instead, or you may get a 400; (2) stop relying on `temperature`, `topP` and `topK`, since Google says Argon ignores custom sampling values (passing them does not error in our tests, but there is no guarantee they apply); (3) remove explicit caching calls (`cachedContents`). On price, during the promotional period input is slightly higher than 3.1 Pro and output slightly lower, and because Argon thinks much less, most tasks cost less overall.
  </Accordion>

  <Accordion title="How long should the client timeout be?">
    Google recommends an HTTP timeout of **15 to 20 minutes** for hard reasoning requests. In our tests, everyday requests returned in 2 to 4 seconds both sequentially and at 16-way concurrency, but during the launch window we did see occasional queuing of several minutes. In production, set a generous timeout and configure retries.
  </Accordion>

  <Accordion title="Can it output more than 64K tokens?">
    Google's long decode (generating up to "1M minus your input" in one go) needs `background=True` on the Interactions API, or the client-side continuation protocol on generateContent. The APIYI gateway **does not support the Interactions API yet** (it returns 404), so design around the default 65,536-token output limit and split very long outputs across several turns.
  </Accordion>

  <Accordion title="What should I watch for in multi-turn tool calls?">
    On the native endpoint, the second request of a function-calling exchange must send back the model's previous turn **unchanged**, including the `thoughtSignature` in its parts. Do not edit or rebuild it yourself. The official google-genai SDK handles this automatically when you use a chat session or pass back `response.candidates[0].content`. On the OpenAI-compatible endpoint the gateway handles signatures, so standard `tool_calls` / `tool` messages are enough; two-turn calls passed 10/10 in our tests. If you occasionally get a 400 `Invalid thought signature` or `Corrupted thought signature`, resend the same request once; there is no need to change it.
  </Accordion>

  <Accordion title="How do I connect Codex and similar clients?">
    Argon currently supports `/v1/chat/completions` and the Gemini native endpoint only. **`/v1/responses` is not supported** (it returns `contents is required`). For clients such as Codex that default to the Responses API, configure the provider to use the chat protocol (`wire_api = "chat"`).
  </Accordion>

  <Accordion title="Should I use responseSchema or responseJsonSchema for structured output?">
    Both work; we recommend `responseJsonSchema` (standard JSON Schema). `responseSchema` is an OpenAPI subset and **does not accept fields such as `additionalProperties`**; including them may return a 400 `Unknown name "additionalProperties"`. On the OpenAI-compatible endpoint, use `response_format: {"type": "json_schema", ...}`.
  </Accordion>

  <Accordion title="Do I need a Google API key for the native endpoint?">
    No. Put your APIYI key (starting with `sk-`) in the `x-goog-api-key` header. With the official google-genai SDK, just set `base_url` to `https://api.apiyi.com`.
  </Accordion>

  <Accordion title="Which capabilities are native-only?">
    Code execution, URL context, `safetySettings`, enforced `stopSequences`, and controllable thinking levels are only available on the Gemini native endpoint. The OpenAI-compatible endpoint covers the common features (chat, streaming, function calling, JSON Schema, vision), but `stop` is not enforced and `reasoning_effort` has little visible effect.
  </Accordion>
</AccordionGroup>

## Related Docs

* [Gemini 4 Argon launch notes (with full test data)](/en/news/gemini-4-argon-launch)
* [Gemini 3.8 Flash Overview](/en/api-capabilities/gemini-3-8-flash/overview)
* [Gemini native calling guide](/en/api-capabilities/gemini/native)
* [Gemini Interactions API](/en/api-capabilities/gemini/interactions-api)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.