

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Gemma 4 31B
<a name="model-card-google-gemma-4-31b"></a>

## ![Google logo with multicolored G letter icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/models/google.png) Google — Gemma 4 31B
<a name="model-card-google-gemma-4-31b-header"></a>

## 模型詳細資訊
<a name="model-card-google-gemma-4-31b-details"></a>

Gemma 4 31B 是 Google 的 30.7 億參數密集模型，具有內建推理、原生函數呼叫，以及跨文字和影像的多模態輸入，支援 256K 字符內容視窗。如需模型開發和效能的詳細資訊，請參閱[模型/服務卡](https://huggingface.co/google/gemma-4-31B-it)。
+ **模型啟動日期：**2025 年 6 月 10 日
+ **模型 EOL 日期：**不適用
+ **最終使用者授權合約和使用條款：**[檢視](https://ai.google.dev/gemma/apache_2)
+ **模型生命週期：**作用中
+ **內容視窗：**256K 權杖


| **輸入模式** | **輸出模式** | **[支援的 APIs ](https://docs.aws.amazon.com/bedrock/latest/userguide/apis.html)** | **[支援的端點](https://docs.aws.amazon.com/bedrock/latest/userguide/endpoints.html)** | 
| --- | --- | --- | --- | 
| ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) 音訊 | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) 內嵌 | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) Responses | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) bedrock-runtime | 
| ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) 影像 | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) 影像 | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) Chat Completions | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) bedrock-mantle | 
| ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) 語音 | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) 語音 | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) Invoke |  | 
| ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) 文字 | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) 文字 | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) Converse |  | 
| ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) 影片 | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) 影片 | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) Messages |  | 

**注意**  
Gemma 4 模型僅適用於`bedrock-mantle`端點。  
此模型可在`bedrock-mantle`端點的 `openai/v1/responses` 路徑上使用。這與回應端點上其他模型使用的`v1/responses`路徑不同。

## 功能和功能
<a name="model-card-google-gemma-4-31b-capabilities"></a>

***Bedrock 功能***

**使用`bedrock-mantle`端點支援的功能**


| **支援的** | **不支援** | 
| --- | --- | 
|  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/model-card-google-gemma-4-31b.html)  | — | 

## 定價
<a name="model-card-google-gemma-4-31b-pricing"></a>

如需定價，請參閱 [Amazon Bedrock 定價](https://aws.amazon.com/bedrock/pricing/)頁面。

## 程式設計存取
<a name="model-card-google-gemma-4-31b-programmatic-access"></a>

使用以下模型 IDs和端點 URLs以程式設計方式存取此模型。如需可用 APIs和端點的詳細資訊，請參閱[支援的 APIs](https://docs.aws.amazon.com/bedrock/latest/userguide/apis.html)和[支援的端點](https://docs.aws.amazon.com/bedrock/latest/userguide/endpoints.html)。


| **端點** | **模型 ID** | **區域端點 URL** | **地理推論 ID** | **全域推論 ID** | 
| --- | --- | --- | --- | --- | 
| bedrock-mantle | google.gemma-4-31b | https://bedrock-mantle.{region}.api.aws/openai/v1 | 不支援 | 不支援 | 

*例如，如果區域是 us-east-1 （維吉尼亞北部），則 bedrock-mantle 端點 URL 將為 "https://bedrock-mantle.us-east-1.api.aws/openai/v1"。*

## 服務層
<a name="model-card-google-gemma-4-31b-tiers"></a>

Amazon Bedrock 提供多個服務層，以符合您的工作負載需求。**Standard** pay-per-token的存取，無需任何承諾。**優先順序**透過以時間為基礎的承諾提供更高的輸送量。**Flex** 為彈性、non-time-sensitive工作負載提供較低成本的存取。**預留**為可預測工作負載提供專用輸送量與期限承諾。如需詳細資訊，請參閱 [服務方案](https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html)。


| **標準** | **優先順序** | **Flex** | **預留** | 
| --- | --- | --- | --- | 
| ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | 

## 區域可用性
<a name="model-card-google-gemma-4-31b-regional-availability"></a>

***區域可用性一目了然***

Bedrock 提供三種推論選項：**為嚴格合規，區域內**將請求保留在單一 區域內，地理 （美國、歐洲等） 內區域間的**地理跨區域**路由可提高輸送量，同時遵守資料駐留，而全球**跨區域**路由則可在無駐留限制的情況下，在全球任何地方提供最大輸送量。如需詳細資訊，請參閱 [區域可用性](models-region-compatibility.md)頁面。


| **區域** | **區域內** | **地理** | **全域** | 
| --- | --- | --- | --- | 
| us-east-1 （維吉尼亞北部） | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | 
| us-east-2 （俄亥俄） | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | 
| us-west-2 （奧勒岡） | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | 
| eu-central-1 （法蘭克福） | ![Green circle with white checkmark icon.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/images/icons/icon-no.png) | 

## 配額和限制
<a name="model-card-google-gemma-4-31b-quotas"></a>

您的 AWS 帳戶具有預設配額，可維持服務的效能，並確保適當使用 Amazon Bedrock。指派給帳戶的預設配額可能會根據區域因素、付款歷史記錄、詐騙使用量和/或配額[增加請求](https://docs.aws.amazon.com/bedrock/latest/userguide/quotas-increase.html)的核准而更新。如需詳細資訊，請參閱 [Amazon Bedrock 的配額](quotas.md) 文件並查看模型[的限制](https://docs.aws.amazon.com/general/latest/gr/bedrock.html#limits_bedrock)。

在`bedrock-mantle`端點上消耗隨需輸送量時，[可用的輸送量會隨著時間而擴展](https://docs.aws.amazon.com/bedrock/latest/userguide/scaling-throughput-best-practices.html#scaling-ramp-up)。並非所有配額內的請求都保證在高需求期間成功，因此逐步漸進很重要。對於此模型，預設限制不會直接透過 Service Quotas 顯示，因此我們建議您遵循漸進測試作為指南。

## 範例程式碼
<a name="model-card-google-gemma-4-31b-sample-code"></a>

**步驟 1 - AWS 帳戶：**如果您已經有 AWS 帳戶，請略過此步驟。如果您是初次使用 AWS，請註冊 [AWS 帳戶](https://portal.aws.amazon.com/billing/signup)。

**步驟 2 - API 金鑰：**前往 [Amazon Bedrock 主控台](https://console.aws.amazon.com/bedrock/home#/api-keys/long-term/create)並產生長期 API 金鑰。

**步驟 3 - 取得 SDK：**若要使用此入門指南，您必須已安裝 Python。然後，根據您使用的 APIs相關軟體。

```
pip install openai
```

**步驟 4 - 設定環境變數：**設定您的環境以使用 API 金鑰進行身分驗證。

```
OPENAI_API_KEY="<provide your Bedrock API key>"
OPENAI_BASE_URL="https://bedrock-mantle.<your-region>.api.aws/openai/v1"
```

**步驟 5 - 執行您的第一個推論請求：**將檔案儲存為 `bedrock-first-request.py`

------
#### [ Chat Completions API ]

```
from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="google.gemma-4-31b",
    messages=[{"role": "user", "content": "Can you explain the features of Amazon Bedrock?"}]
    )
print(response)
```

------
#### [ Responses API ]

```
from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="google.gemma-4-31b",
    input="Explain the benefits of mixture-of-experts architectures for production inference.",
    max_output_tokens=512,
)
print(response.output_text)
```

------

## 用量考量和限制
<a name="model-card-google-gemma-4-31b-considerations"></a>
+ **推理模式** — 在聊天完成和回應 APIs 上都遵守推理工作，而且模型在這兩種情況下都會執行延長推理。不過，推理內容只會由 Responses API 傳回。聊天完成 API 不會傳回推理權杖，因為 OpenAI 聊天完成規格不支援傳回權杖。
+ **平行工具呼叫** — 目前不支援一次請求多個工具呼叫。請求工具一次呼叫一個 。
+ **請求承載大小** — Gemma 4 31B 的總請求內文承載，包括映像和影片，支援大小上限為 3.5 MB。