> ## 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 文本生成

> 谷歌新一代旗艦 Gemini 4 Argon：API易 首批開通 Gemini 原生與 OpenAI 相容雙端點，限時優惠期輸入 $2、輸出 $10 每 1M tokens。含上線前 400 餘次實測：1M 上下文、思考檔位、遷移必改項。

Gemini 4 Argon（`gemini-4-argon`）是谷歌 2026 年 9 月 30 日釋出的新一代旗艦模型，也是 Gemini 4 家族的第一款，官方定位是長程軟體工程、法律 / 金融等企業知識工作和網路安全防禦。10 月 13 日起向 Gemini API 付費層開放，API易 是首批拿到呼叫權限的平臺之一，已開通 **Gemini 原生**與 **OpenAI 相容**雙端點，並在上線前以 `gemini-3.1-pro-preview` 為參照完成了 400 餘次實測。

<Info>
  **API易 已接入 Gemini 4 Argon**：模型名 `gemini-4-argon`，`default` / `svip` 分組可用，由谷歌官方資源承載。當前為谷歌官方**限時優惠期**定價（輸入 \$2 / 輸出 \$10 每 1M tokens，至 2026 年 11 月 30 日）；**12 月 1 日起谷歌恢復 \$4 / \$20，API易 同步調整**。
</Info>

<Warning>
  **從 Gemini 3.x 遷移有一處必改**：Argon **不支援** `thinkingConfig.thinkingBudget`，傳了可能直接返回 400（`Thinking budget is not supported for this model. Use thinking level instead.`），也可能被忽略，結果不穩定。谷歌遷移指南寫的是「棄用並告警」，實測會出現硬報錯。請刪掉 `thinkingBudget`，統一改用 `thinkingLevel`（`low` / `medium` / `high`）。
</Warning>

## 核心優勢

<CardGroup cols={2}>
  <Card title="同等正確率，思考少一個數量級" icon="gauge">
    實測 12 道可自動判分的題各 3 次，Argon 與 3.1 Pro 都是 36/36，但 Argon 的思考 tokens 只有 3.1 Pro 的約 1/12，P50 耗時 15.4 秒對 35.0 秒。思考 tokens 按輸出計費，單題實際花費更低。
  </Card>

  <Card title="1M 上下文實測可用" icon="file-text">
    實測 101 萬 tokens 的輸入正常返回，再大一點報 400，報錯資訊寫明上限 1,048,576。23.9 萬 tokens 大海撈針 29.7 秒答對，比 3.1 Pro 快近一半。
  </Card>

  <Card title="官方基準多項第一" icon="trophy">
    谷歌公佈：DeepSWE v1.1 77.9％、LVBench 長影片理解 91.7％、AutomationBench 51.3％，Vals Index 排名第一，CWE-bench v1 並列第一。
  </Card>

  <Card title="雙端點、工具鏈完整" icon="git-fork">
    原生端 14/14、OpenAI 相容端 12/13（唯一未過項與 3.1 Pro 相同）。函式呼叫（單次 / 並行 / 順序）、結構化輸出、圖片與影片理解、程式碼執行、URL context 均通過。
  </Card>
</CardGroup>

## 模型資訊

| 引數 | 值 |
| - | - |
| **模型名稱** | `gemini-4-argon` |
| **輸入模態** | 文本、影像、影片、音訊（影像與影片已實測） |
| **輸出模態** | 文本 |
| **上下文視窗** | 1M tokens，輸入與輸出共用（實測輸入上限 1,048,576） |
| **預設最大輸出** | 65,536 tokens（官方口徑；超過 64K 的 long decode 需 Interactions API，API易 暫未支援） |
| **深度思考** | 預設 `medium`；`thinkingLevel` 三檔 low / medium / high；**不支援 `thinkingBudget`** |
| **可用分組** | `default`、`svip` |
| **端點** | `POST /v1beta/models/gemini-4-argon:generateContent`（原生）、`POST /v1/chat/completions`（OpenAI 相容） |
| **流式輸出** | ✅ 兩端點均支援 |

## 官方基準

以下資料均為**谷歌官方公佈**（`blog.google` 2026-09-30 與 10-13 兩篇釋出文），未經 API易 復現：

| 基準 | 衡量內容 | Gemini 4 Argon |
| - | - | - |
| DeepSWE v1.1 | 真實世界長程軟體工程 | 77.9％（官方稱 SOTA） |
| Vals Index | 金融 / 程式設計 / 法律 / 稅務綜合 | 第 1 名 |
| AutomationBench（Zapier） | 端到端業務流程執行 | 51.3％（第 1 名） |
| LVBench | 長影片理解 | 91.7％（官方稱 SOTA） |
| CWE-bench v1 | 安全漏洞修復 | 68％（並列第 1） |
| ERQA | 具身 / 空間推理 | 87％ |
| Gray Swan IPI | 間接提示注入攻擊成功率（越低越好） | 0.7％ |

## 實測能力矩陣

API易 於 2026 年 10 月 13 日 \~ 14 日 (UTC+8) 實測，相容性部分每個用例與 `gemini-3.1-pro-preview` **同時發起**：

| 能力 | Gemini 原生 | OpenAI 相容 | 與 3.1 Pro 對比 |
| - | - | - | - |
| 基礎對話（非流式 / 流式） | ✅ / ✅ | ✅ / ✅ | 一致 |
| 系統指令、多輪對話 | ✅ | ✅ | 一致 |
| 長上下文定位（8.6K tokens 字首 + 128 輸出上限） | ✅ 2/2 | ✅ | **3.1 Pro 0/2**（思考把 128 上限吃光） |
| 大海撈針 35K / 239K tokens | ✅ / ✅ | — | 一致，Argon 更快 |
| 結構化輸出 | ✅ responseJsonSchema（推薦）/ responseSchema | ✅ json\_schema | 一致 |
| Function calling（單次 / 回傳 / 順序） | ✅ | ✅ | 一致 |
| **並行 Function calling** | ✅ 4/4 | ✅ | **3.1 Pro 在 OpenAI 端 0/2** |
| 影像理解 / 影片理解 | ✅ 2/2 / ✅ 2/2 | ✅ / ✅ | 一致 |
| 程式碼執行（`codeExecution`） | ✅ | — 原生專屬 | 一致 |
| URL context（`urlContext`） | ✅ 回 `urlContextMetadata` | — 原生專屬 | 一致 |
| `stopSequences` / `stop` | ✅ 嚴格執行 | ⚠️ 不生效 | 一致 |
| `safetySettings` | ✅ 回 `safetyRatings` | — 原生專屬 | 一致 |
| Google 搜尋 grounding | ⚠️ 請求被接受但未回 `groundingMetadata` | — 原生專屬 | 一致 |
| 隱式快取 | ⚠️ 命中率不高（見下方「快取」） | 同左 | — |
| 顯式快取 `cachedContents` / `:countTokens` | ❌ 不支援（官方也不支援顯式快取） | — | 一致 |
| Interactions API | ❌ API易 閘道暫未支援 | — | — |

<Warning>
  **搜尋 grounding 待確認**：傳 `tools: [{"googleSearch": {}}]` 返回 200，但響應裡**沒有 `groundingMetadata`**，說明答案來自模型自身知識而非即時檢索。3.1 Pro 在同一輪測試中表現相同，更可能是鏈路的開通狀態問題，而非模型能力差異。依賴即時檢索的場景請先小流量驗證。
</Warning>

## 定價

| 專案 | 限時優惠期（至 2026-11-30） | 2026-12-01 起 |
| - | - | - |
| 輸入 | \$2 / 1M tokens | \$4 / 1M tokens |
| 輸出（含思考） | \$10 / 1M tokens | \$20 / 1M tokens |
| 快取讀取 | \$0.1 / 1M tokens | 隨官方調整 |

<Note>模型價格與官網對齊，且可能隨官網調整；上表僅供參考，具體以頂部導航「模型價格」欄目為準：[模型價格](/zh-Hant/models/index)。</Note>

**計費已實測核對**：三次呼叫合計實扣與按上表單價算出的金額相差 1.5％ 以內。思考 tokens 計入輸出——Argon 在多數請求裡思考很少，這是它比同檔模型實際更省錢的主要原因。折扣通過充值加贈體現，詳見 [充值優惠](/zh-Hant/faq/recharge-promotions)。

## 思考控制

官方預設檔位是 `medium`。同一道組合數學證明題的實測（原生端點）：

| 配置 | 思考 tokens | 耗時 |
| - | - | - |
| 不傳（預設 medium） | 0 | 9.0s |
| `thinkingLevel: "low"` | 0 | 9.5s |
| `thinkingLevel: "medium"` | 0 | 8.6s |
| `thinkingLevel: "high"` | 1,097 | 28.5s |
| `thinkingBudget`（任意值） | — | **不支援**，可能 400 |
| `thinkingLevel: "minimal"` | — | **不支援**，400 |

<Tip>
  low / medium 會按題目難度**自適應**，這類題它判斷不需要思考就直接作答。需要穩定拿到深度推理（多檔案排障、形式化數學、架構設計）時請**顯式傳 `high`**。要看思考過程傳 `includeThoughts: true`，用量看 `usageMetadata.thoughtsTokenCount`。
</Tip>

<Warning>
  **OpenAI 相容端的 `reasoning_effort` 效果不明顯**：`minimal` / `low` / `medium` / `high` 均返回 200，但 `usage.completion_tokens_details.reasoning_tokens` 不回顯，各檔 completion tokens 相近。Argon 不能關閉思考，**不要傳 `reasoning_effort: "none"`**，可能返回 400。需要可控的深度思考請走 Gemini 原生端點並傳 `thinkingLevel: "high"`。
</Warning>

## 快取

谷歌官方稱 Argon **自動開啟隱式快取**、不支援顯式快取。API易 實測命中率不高：多數同字首重複請求沒有命中，只在部分請求上觀察到命中（7 萬 tokens 字首連發 4 次，後兩次命中約 6.8 萬 tokens，按快取價計費）。

<Warning>
  **請不要按快取命中做成本預算**。Gemini 系列的隱式快取命中率本來就不穩定，Argon 也是如此，按全額輸入價估算更穩妥，命中了算額外節省。判斷是否命中請以控制台「快取計費詳情」為準。
</Warning>

## 呼叫示例

### Gemini 原生格式（推薦，能力最全）

<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": "用一句話介紹你自己"}]}],
      "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="找出這段程式碼的併發問題並給出修復方案：...",
      config=types.GenerateContentConfig(
          thinking_config=types.ThinkingConfig(thinking_level="high")
      )
  )
  print(response.text)
  ```
</CodeGroup>

<Note>
  原生端點兩種認證方式都可用：`x-goog-api-key` 請求頭（官方 SDK 預設）或 `Authorization: Bearer`，令牌都是 API易 的 `sk-` 令牌。
</Note>

### OpenAI 相容格式（存量程式碼零改造）

<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": "設計一個支援百萬併發的短鏈服務，給出架構與關鍵取捨"}]
  )
  print(response.choices[0].message.content)
  ```

  ```javascript Node.js（流式） 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: '寫一份 Rust 遷移評估報告的大綱' }],
    stream: true
  });

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

## 遷移指南

<AccordionGroup>
  <Accordion title="從 gemini-3.1-pro-preview 遷移">
    改模型名，再檢查三處：① 刪掉 `thinkingBudget`，改 `thinkingLevel`（否則可能 400）；② 不再依賴 `temperature` / `topP` / `topK`，官方說明 Argon 會忽略自定義取樣值（實測傳了不報錯，但不保證生效）；③ 去掉顯式快取 `cachedContents` 相關呼叫。價格方面，限時優惠期內輸入比 3.1 Pro 略高、輸出略低，加上思考量少得多，大多數任務的實際花費更低。
  </Accordion>

  <Accordion title="客戶端超時要設多長？">
    官方建議複雜推理請求把 HTTP 超時設到 **15\~20 分鐘**。日常請求實測序列與 16 路併發都在 2\~4 秒返回；但首發時段我們觀察到過偶發的數分鐘級排隊，生產環境請務必放寬超時並配好重試。
  </Accordion>

  <Accordion title="能輸出超過 64K tokens 嗎？">
    官方的 long decode（單次生成最多到「1M 減輸入」）需要 Interactions API 的 `background=True`，或 generateContent 上的客戶端續寫協議。API易 閘道目前**不支援 Interactions API**（實測 404），所以請按預設 65,536 輸出上限設計；超長產物建議拆成多輪生成。
  </Accordion>

  <Accordion title="多輪工具呼叫要注意什麼？">
    原生端點做 Function Calling 時，第二輪請求要把模型上一輪返回的內容**原樣帶回**，包括 part 裡的 `thoughtSignature`，不要刪改或自己拼接。官方 google-genai SDK 用 chat 會話或直接回傳 `response.candidates[0].content` 時會自動處理。OpenAI 相容端由閘道處理簽名，按標準 `tool_calls` / `tool` 訊息回傳即可，實測兩輪呼叫 10/10 通過。偶發返回 400 `Invalid thought signature` / `Corrupted thought signature` 時，把這一輪請求原樣重發一次即可，不需要改請求內容。
  </Accordion>

  <Accordion title="Codex 等客戶端怎麼接入？">
    Argon 目前只支援 `/v1/chat/completions` 和 Gemini 原生端點，**不支援 `/v1/responses`**（會返回 `contents is required`）。Codex 這類預設走 Responses API 的客戶端，請把 provider 配置成 chat 協議（`wire_api = "chat"`）。
  </Accordion>

  <Accordion title="結構化輸出用 responseSchema 還是 responseJsonSchema？">
    兩種都可用，推薦 `responseJsonSchema`（標準 JSON Schema 寫法）。`responseSchema` 是 OpenAPI 子集，**不認 `additionalProperties`** 等欄位，寫了可能返回 400 `Unknown name "additionalProperties"`。OpenAI 相容端用 `response_format: {"type": "json_schema", ...}` 即可。
  </Accordion>

  <Accordion title="原生端點需要 Google API Key 嗎？">
    不需要。API易 令牌（`sk-` 開頭）直接放在 `x-goog-api-key` 請求頭即可，官方 google-genai SDK 只需把 `base_url` 改為 `https://api.apiyi.com`。
  </Accordion>

  <Accordion title="哪些能力只有原生端點有？">
    程式碼執行、URL context、`safetySettings`、`stopSequences` 嚴格執行、可控的思考檔位都只在 Gemini 原生端點可用。OpenAI 相容端覆蓋常規能力（對話 / 流式 / Function Call / JSON Schema / 視覺），但 `stop` 不生效、`reasoning_effort` 效果不明顯。
  </Accordion>
</AccordionGroup>

## 相關文件

* [Gemini 4 Argon 上線說明（含完整實測資料）](/news/gemini-4-argon-launch)
* [Gemini 3.8 Flash 概覽](/zh-Hant/api-capabilities/gemini-3-8-flash/overview)
* [Gemini 原生呼叫通用指南](/zh-Hant/api-capabilities/gemini/native)
* [Gemini Interactions API 說明](/zh-Hant/api-capabilities/gemini/interactions-api)


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