Source: https://ailoot.ai/models/zh-hant-tw/google-gemini-3-1-pro-preview-customtools/
Canonical: https://ailoot.ai/models/zh-hant-tw/google-gemini-3-1-pro-preview-customtools/
Language: zh-hant-tw

# Google: Gemini 3.1 Pro Preview Custom Tools

[Markdown](https://ailoot.ai/models/zh-hant-tw/google-gemini-3-1-pro-preview-customtools/index.md) · [JSON](https://ailoot.ai/models/zh-hant-tw/google-gemini-3-1-pro-preview-customtools/facts.json)

## [Google: Gemini 3.1 Pro Preview Custom Tools](https://ailoot.ai/models/zh-hant-tw/google-gemini-3-1-pro-preview-customtools/)

Gemini 3.1 Pro Preview Custom Tools 是獨立的代理導向變體，會優先使用應用程式定義的工具，並搭配終端機命令。當讀取檔案或搜尋程式碼等操作應主導多步驟任務時可使用，由應用程式執行各工具並回傳結果。

- [**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions` `google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/google-gemini-3-1-pro-preview-customtools/#method-0)
- [**Ailoot Ultra · Anthropic Messages** `POST /v1/messages` `google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/google-gemini-3-1-pro-preview-customtools/#method-1)

關於模型

此說明介紹模型的能力。Ailoot 可用的輸入、輸出與選項，依所選方法列於下方。

Gemini 3.1 Pro Preview Custom Tools 是 Google 專為混用終端機命令與自訂工具的代理工作流程提供的變體。其特色行為是優先使用應用程式定義的工具，製造商以 view\_file 及 search\_code 為例。它是 Gemini 3.1 Pro Preview 的獨立具名變體，並非所有 Pro 請求的另一種名稱。實用任務應仰賴合適工具取得證據，再準備最終文字結果。

Pro Preview 系列接收文字、圖像、影片、音訊與 PDF，回傳文字。開發者列出的此系列輸入上限為 1,048,576 token，輸出上限為 65,536 token。儲存庫調查可結合原始碼檔案、書面要求及介面截圖；文件流程可結合頁面與問題。請標示來源並定義最終成果，讓大型輸入預算支持特定任務，而非漫無目的地傾倒封存資料。

軟體代理應定義目標、可用工具及所需變更範圍。自訂搜尋工具可回傳相符檔案位置，讀檔工具則提供確切相關內容。請指定可接受的引數及回傳欄位。應用程式執行接受的呼叫，將結果傳回模型，模型再依實際發生的情況選擇下一步。回傳路徑是搜尋結果的證據，並不能證明檔案已變更或測試已執行。

Custom Tools 變體適用於這些專用操作應優先於一般 bash 命令的情況。例如代理可先搜尋某個具名行為的實作，讀取關聯檔案，與使用者要求比較，再提出範圍明確的變更。請定義必須保持完整的介面與行為，要求最終列出變更建議及使用的來源資訊。若有受控測試執行器，應先回傳實際結果，再要求對變更作出結論。

開發者的 3.1 Pro 文件包含 thinking、結構化輸出、函式呼叫，以及程式碼執行、搜尋 grounding、Google Maps grounding、URL context 及快取。檔案搜尋項目明確限定於 Google AI Studio。因此，工具可用性是所選原始模型介面及應用程式設定的一部分。變體偏好自訂工具的特性本身不會提供工具，也不會執行外部操作。每項已完成應用程式操作都應記錄函式名稱、經驗證的引數及結果。

Gemini 3 指南描述 3.1 Pro 的 low、medium、high thinking 等級，預設為 high。它們是相對分析額度，而非嚴格 token 保證。請依任務選擇等級，並提供直接指令，而非複雜的提示儀式。需要結構化輸出時，應定義欄位、類型及缺漏值規則。實作報告的最終紀錄可指出檢查的檔案、所需行為、修改建議及剩餘問題。請檢查每筆內容是否來自實際工具或來源結果。

多回合代理必須保留對話及必要推理脈絡。開發者指南說明 thought signatures，並區分受管理的有狀態歷史與手動管理的無狀態歷史。請在所選介面使用文件記載的處理方式，尤其是在工具結果之後繼續時。長來源素材應先放脈絡，再放具體問題，並將所需答案與問題連結。指南也建議使用預設 temperature 1.0，而非移植可能在複雜任務造成迴圈的低 temperature 設定。

製造商提醒，不受益於自訂工具的用途可能出現品質波動。這是有意義的選擇界線：應將此設定用於以工具為核心的代理，而非假設它能普遍改善每個獨立提示。文字輸出可為計畫、程式碼提案、解說或結構化結果；圖像或音訊輸入不會讓此變體變成媒體生成器。請檢查程式碼建議、核對計算，並區分已確認操作與建議。保留確切 Custom Tools 模型身分、任務、工具定義及回傳證據，讓後續延續流程有具體依據。

實用任務

### 實用任務

英文技術範例

```
Interpret custom-tool evidence

Use this supplied tool transcript. search_code returned settings.py:12 and view_file returned: 'RETRY_LIMIT = 3'. No edit or test result is present. Requirement: increase the retry limit to five. Return the examined file, the exact proposed edit and the remaining check. Distinguish the retrieved value from actions that have not occurred.
```

#### 預期結果

```
A file-linked proposed edit and an explicitly unexecuted validation step.
```

#### 檢查結果

```
The answer must not claim that settings.py was changed or a test passed.
```

**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions` `google/gemini-3.1-pro-preview-customtools`

[`google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Fgemini-3.1-pro-preview-customtools&route=Ultra&caller=google%2Fgemini-3.1-pro-preview-customtools&fmt=chat)

Google /`google/gemini-3.1-pro-preview-customtools`

### 入門

Gemini 3.1 Pro Preview Custom Tools 是獨立的代理導向變體，會優先使用應用程式定義的工具，並搭配終端機命令。當讀取檔案或搜尋程式碼等操作應主導多步驟任務時可使用，由應用程式執行各工具並回傳結果。

接受的輸入

文字

結果

文字

### Ailoot 可用 · 輸入與方法

**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions`

輸入

`text`

輸出

`text`

輸出格式

json 或 SSE

| 欄位 | 類型 | 要求 | 值與限制 | 預設值 |
| --- | --- | --- | --- | --- |
| 欄位`model` | 類型`string` | 要求必填 | 值與限制 google/gemini-3.1-pro-preview-customtools | 預設值— |
| 欄位`messages` | 類型`message[]` | 要求必填 | 值與限制 項目數下限: 1 | 預設值— |
| 欄位`messages[].role` | 類型`string` | 要求必填 | 值與限制 範例：system, user, assistant, tool, function 條件: 這些角色由 原始碼中的相容型別明確表示；確切角色集合仍依模型而定。 依模型而定 | 預設值— |
| 欄位`messages[].content` | 類型`string\|content_part[]\|null` | 要求選填 | 值與限制 | 預設值— |
| 欄位`messages[].tool_calls` | 類型`tool_call[]` | 要求選填 | 值與限制 | 預設值— |
| 欄位`messages[].tool_call_id` | 類型`string` | 要求選填 | 值與限制 適用條件: role=tool；使用實際回傳的 ID | 預設值— |
| 欄位`messages[].name` | 類型`string` | 要求選填 | 值與限制 | 預設值— |
| 欄位`messages[].reasoning_content` | 類型`string` | 要求選填 | 值與限制 適用條件: 此模型使用推理內容時，將實際回傳的推理內容帶回後續請求 | 預設值— |
| 欄位`messages[].reasoning_details` | 類型`object\|array` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`max_tokens` | 類型`integer` | 要求選填 | 值與限制 最小值: 1 依模型而定 | 預設值— |
| 欄位`max_completion_tokens` | 類型`integer` | 要求選填 | 值與限制 最小值: 1 依模型而定 | 預設值— |
| 欄位`stream` | 類型`boolean` | 要求選填 | 值與限制 | 預設值false |
| 欄位`stream_options.include_usage` | 類型`boolean` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`temperature` | 類型`number` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`top_p` | 類型`number` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`stop` | 類型`string\|string[]` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`tools` | 類型`function_tool[]` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`tools[].type` | 類型`string` | 要求選填 | 值與限制 function 依模型而定 | 預設值— |
| 欄位`tools[].function.name` | 類型`string` | 要求必填 | 值與限制 適用條件: 已提供函式工具 | 預設值— |
| 欄位`tools[].function.description` | 類型`string` | 要求選填 | 值與限制 | 預設值— |
| 欄位`tools[].function.parameters` | 類型`JSON_schema` | 要求選填 | 值與限制 | 預設值— |
| 欄位`tool_choice` | 類型`string\|object` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`parallel_tool_calls` | 類型`boolean` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`response_format` | 類型`object` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`reasoning_effort` | 類型`string` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`reasoning` | 類型`object` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`service_tier` | 類型`string` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`instructions` | 類型`string` | 要求選填 | 值與限制 相容性欄位 | 預設值— |
| 欄位`functions` | 類型`function[]` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`function_call` | 類型`string\|object` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`prompt_cache_options` | 類型`object` | 要求選填 | 值與限制 依模型而定 | 預設值— |
| 欄位`modalities` | 類型`string[]` | 要求選填 | 值與限制 text | 預設值— |
| 欄位`provider` | 類型`object` | 要求選填 | 值與限制 條件: 此 Ultra 文字路由拒絕 provider.options | 預設值— |
| 欄位`cache_control.ttl` | 類型`string` | 要求選填 | 值與限制 條件: 實際提示詞快取位置拒絕 1h | 預設值— |

輸入素材組合

**文字** · UTF8 文字

`messages[].content`

方法參數與生命週期

| 參數 | 規格 |
| --- | --- |
| 參數`content_type` | 規格application/json |
| 參數`required` | 規格model, messages |
| 參數`material_types` | 規格text |
| 參數`messages` | 規格具有 role/content 結構的訊息陣列 |
| 參數`file_material` | 規格實際 UTF-8 文件以原文文字插入；不推定檔案 ID |
| 參數`optional_controls` | 規格stream, temperature, top\_p, stop, max\_tokens, max\_completion\_tokens, reasoning, response\_format, tools, tool\_choice |
| 參數`control_scope` | 規格依模型而定；使用者函式工具與託管工具不同 |
| 參數`output_modalities` | 規格text |
| 參數`hosted_operations` | 規格false |
| 參數`multimodal_input_binding` | 規格null |

生命週期： `synchronous_or_streamed`

將確切模型 ID 與 messages 一併送出。

上下文長度不是輸出上限。

文字檔案可提供原文文字；圖片／音訊／檔案物件輸入需要精確綁定。

### 方案

費率資訊不會增加請求選項。支援的參數列於所選方法中。

快速模式

標準費率 選取快速模式時

flex 模式

標準費率 選取 flex 模式時

最高推理強度

標準費率 最高推理強度採用 default 調整值時

推理強度 · high

標準費率 推理強度設為 high 時

推理強度 · low

標準費率 推理強度設為 low 時

推理強度 · medium

標準費率 推理強度設為 medium 時

顯式快取計價

未啟用 請求顯式快取時

推理輸出

推理詞元已包含在彙總輸出中，並按列出的子集費率計費；切勿重複計入這些詞元。 輸出包含推理詞元時

#### Ailoot 費率

#### 各設定的價格

請逐一核對各項費用與所列條件。每組互為替代選項的設定只套用一種費率。

| 設定 | 費率表 | 上下文 Token 數大於 | 上下文 Token 數小於或等於 | 費用 |
| --- | --- | --- | --- | --- |
| 設定詞元基本費率 | 費率表基本費率 | 上下文 Token 數大於— | 上下文 Token 數小於或等於無上限 | 費用 輸入 · 輸入 Token **$0.004** / 1K Token 輸出 · 輸出 Token **$0.024** / 1K Token 輸入 · 讀取快取 **$0.0004** / 1K Token 輸入 · 寫入快取 **$0.00075** / 1K Token 輸入 · 寫入快取，1 小時 **—** / 1K Token 輸出 · 推理輸出詞元 **$0.024** / 1K Token |
| 設定請求長度級距 1 | 費率表— | 上下文 Token 數大於0 | 上下文 Token 數小於或等於200,000 | 費用 輸入 · 輸入 Token **$0.004** / 1K Token 輸出 · 輸出 Token **$0.024** / 1K Token 輸入 · 讀取快取 **$0.0004** / 1K Token 輸入 · 寫入快取 **$0.00075** / 1K Token 輸入 · 寫入快取，1 小時 **—** / 1K Token |
| 設定請求長度級距 2 | 費率表— | 上下文 Token 數大於200,000 | 上下文 Token 數小於或等於無上限 | 費用 輸入 · 輸入 Token **$0.008** / 1K Token 輸出 · 輸出 Token **$0.036** / 1K Token 輸入 · 讀取快取 **$0.0008** / 1K Token 輸入 · 寫入快取 **$0.00075** / 1K Token 輸入 · 寫入快取，1 小時 **—** / 1K Token |

Ailoot 會在請求前預留估算金額。取得結果後，依實測用量結算最終費用。串流結算採用最終用量紀錄。[預留金額與結算的運作方式 →](https://ailoot.ai/docs/zh-hant-tw/billing/reserve/)

### 請求範例

#### Ailoot Ultra · OpenAI Chat

curlPython SDKPython 串流

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "google/gemini-3.1-pro-preview-customtools", "messages": [{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}]}')

Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
r=json.loads(Path("result.json").read_text())
for x in r.get("choices",[]):
    if x.get("message",{}).get("content"): print(x["message"]["content"])
PY_RESULT
```

```python
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.chat.completions.create(model='google/gemini-3.1-pro-preview-customtools',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}])
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(result.to_dict(mode="json"))
```

```python
from openai import OpenAI
import os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.chat.completions.stream(model='google/gemini-3.1-pro-preview-customtools',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_completion()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### 接收並儲存結果

#### Ailoot Ultra · OpenAI Chat

json 或 SSE

##### 保留所有已完成的結果

請保留所有完整傳回的回應、檔案與內容區塊。

保留每個候選項及其內容／工具呼叫／推理。SSE 中依候選項／工具索引組合增量，保留最終完成原因與用量。

##### 需要檢查原始回應時

保留請求／回應 ID 與標頭。未提供通用的文字工作擷取 URL。

回應欄位

| 欄位 | 類型 |
| --- | --- |
| 欄位`choices[].index` | 類型integer |
| 欄位`choices[].message.content` | 類型string\|null |
| 欄位`choices[].message.tool_calls` | 類型tool\_call\[\] |
| 欄位`choices[].message.reasoning_content` | 類型string |
| 欄位`choices[].message.reasoning_details` | 類型object\|array |
| 欄位`choices[].finish_reason` | 類型string\|null |
| 欄位`usage` | 類型object |

錯誤與後續步驟

| 回應 | 條件 | 下一步 |
| --- | --- | --- |
| 回應400 · `invalid_request_error` | 條件必要欄位、素材表示方式或參數值無效 | 下一步提出新的建立請求前，先修正指定欄位。 |

### 別名

#### 模型別名

**Ailoot Ultra** [`google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Fgemini-3.1-pro-preview-customtools&route=Ultra&caller=google%2Fgemini-3.1-pro-preview-customtools&fmt=chat)

#### 方法路徑別名

請使用上方列出的 API 方法路徑。

#### 相關呼叫用 ID

[`google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Fgemini-3.1-pro-preview-customtools&route=Ultra&caller=google%2Fgemini-3.1-pro-preview-customtools&fmt=chat)

**Ailoot Ultra · Anthropic Messages** `POST /v1/messages` `google/gemini-3.1-pro-preview-customtools`

[`google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Fgemini-3.1-pro-preview-customtools&route=Ultra&caller=google%2Fgemini-3.1-pro-preview-customtools&fmt=messages)

Google /`google/gemini-3.1-pro-preview-customtools`

### 入門

Gemini 3.1 Pro Preview Custom Tools 是獨立的代理導向變體，會優先使用應用程式定義的工具，並搭配終端機命令。當讀取檔案或搜尋程式碼等操作應主導多步驟任務時可使用，由應用程式執行各工具並回傳結果。

接受的輸入

文字

結果

json · sse

### Ailoot 可用 · 輸入與方法

**Ailoot Ultra · Anthropic Messages** `POST /v1/messages`

輸入

`text`

輸出

`json`, `sse`

輸出格式

JSON 或 SSE

| 欄位 | 類型 | 要求 | 值與限制 | 預設值 |
| --- | --- | --- | --- | --- |
| 欄位`model` | 類型`string` | 要求必填 | 值與限制 google/gemini-3.1-pro-preview-customtools | 預設值— |
| 欄位`messages` | 類型`message[]` | 要求必填 | 值與限制 | 預設值— |
| 欄位`messages[].role` | 類型`string` | 要求必填 | 值與限制 user, assistant | 預設值— |
| 欄位`messages[].content` | 類型`string` | 要求必填 | 值與限制 | 預設值— |
| 欄位`max_tokens` | 類型`integer` | 要求必填 | 值與限制 | 預設值— |
| 欄位`stream` | 類型`boolean` | 要求選填 | 值與限制 | 預設值false |

輸入素材組合

**文字** · UTF-8 文字

`messages[].content 字串`

方法參數與生命週期

| 參數 | 規格 |
| --- | --- |
| 參數`content_type` | 規格application/json |
| 參數`required` | 規格model, messages, max\_tokens |
| 參數`optional_controls` | 規格stream |
| 參數`material_types` | 規格text |
| 參數`text_file_material` | 規格讀取實際 UTF-8 文件，將文字放入指定的 input 或訊息內容字串。 |

生命週期： `synchronous_or_streamed`

### 方案

費率資訊不會增加請求選項。支援的參數列於所選方法中。

快速模式

標準費率 選取快速模式時

flex 模式

標準費率 選取 flex 模式時

最高推理強度

標準費率 最高推理強度採用 default 調整值時

推理強度 · high

標準費率 推理強度設為 high 時

推理強度 · low

標準費率 推理強度設為 low 時

推理強度 · medium

標準費率 推理強度設為 medium 時

顯式快取計價

未啟用 請求顯式快取時

推理輸出

推理詞元已包含在彙總輸出中，並按列出的子集費率計費；切勿重複計入這些詞元。 輸出包含推理詞元時

#### Ailoot 費率

#### 各設定的價格

請逐一核對各項費用與所列條件。每組互為替代選項的設定只套用一種費率。

| 設定 | 費率表 | 上下文 Token 數大於 | 上下文 Token 數小於或等於 | 費用 |
| --- | --- | --- | --- | --- |
| 設定詞元基本費率 | 費率表基本費率 | 上下文 Token 數大於— | 上下文 Token 數小於或等於無上限 | 費用 輸入 · 輸入 Token **$0.004** / 1K Token 輸出 · 輸出 Token **$0.024** / 1K Token 輸入 · 讀取快取 **$0.0004** / 1K Token 輸入 · 寫入快取 **$0.00075** / 1K Token 輸入 · 寫入快取，1 小時 **—** / 1K Token 輸出 · 推理輸出詞元 **$0.024** / 1K Token |
| 設定請求長度級距 1 | 費率表— | 上下文 Token 數大於0 | 上下文 Token 數小於或等於200,000 | 費用 輸入 · 輸入 Token **$0.004** / 1K Token 輸出 · 輸出 Token **$0.024** / 1K Token 輸入 · 讀取快取 **$0.0004** / 1K Token 輸入 · 寫入快取 **$0.00075** / 1K Token 輸入 · 寫入快取，1 小時 **—** / 1K Token |
| 設定請求長度級距 2 | 費率表— | 上下文 Token 數大於200,000 | 上下文 Token 數小於或等於無上限 | 費用 輸入 · 輸入 Token **$0.008** / 1K Token 輸出 · 輸出 Token **$0.036** / 1K Token 輸入 · 讀取快取 **$0.0008** / 1K Token 輸入 · 寫入快取 **$0.00075** / 1K Token 輸入 · 寫入快取，1 小時 **—** / 1K Token |

Ailoot 會在請求前預留估算金額。取得結果後，依實測用量結算最終費用。串流結算採用最終用量紀錄。[預留金額與結算的運作方式 →](https://ailoot.ai/docs/zh-hant-tw/billing/reserve/)

### 請求範例

#### Ailoot Ultra · Anthropic Messages

完整的最小 JSON 請求主體curl · 使用您的 UTF-8 文件Python · 儲存完整結果

```json
{
  "model": "google/gemini-3.1-pro-preview-customtools",
  "max_tokens": 128,
  "messages": [
    {
      "role": "user",
      "content": "Summarize the incident report."
    }
  ],
  "stream": false
}
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 document}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json, os
from pathlib import Path

source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
    raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
    raise SystemExit('Choose a document containing text')
payload = {'model': 'google/gemini-3.1-pro-preview-customtools', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
Path('request.json').write_text(json.dumps(payload, ensure_ascii=False), encoding='utf-8')
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path

result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
PY_RESULT
```

```python
import json, os
from pathlib import Path

source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
    raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
    raise SystemExit('Choose a document containing text')
payload = {'model': 'google/gemini-3.1-pro-preview-customtools', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
from urllib.request import Request, urlopen
from urllib.error import HTTPError

api_key = os.environ['AILOOT_API_KEY']
if not api_key.strip():
    raise SystemExit('Set AILOOT_API_KEY before making a request')
headers = {'x-api-key': 'PLACEHOLDER_KEY', 'anthropic-version': '2023-06-01', 'Content-Type': 'application/json'}
headers['x-api-key'] = api_key
request = Request('https://api.ailoot.ai/v1/messages', data=json.dumps(payload, ensure_ascii=False).encode('utf-8'), headers=headers, method='POST')
try:
    with urlopen(request, timeout=120) as response:
        raw = response.read()
        Path('response-headers.txt').write_text(str(response.headers), encoding='utf-8')
except HTTPError as error:
    Path('result.json').write_bytes(error.read())
    Path('response-headers.txt').write_text(str(error.headers), encoding='utf-8')
    raise
Path('result.json').write_bytes(raw)
import json
from pathlib import Path

result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
```

### 接收並儲存結果

#### Ailoot Ultra · Anthropic Messages

JSON 或 SSE

##### 保留所有已完成的結果

請保留所有完整傳回的回應、檔案與內容區塊。

保留所有內容區塊、思考簽章與實際工具使用 ID。組合所有 SSE 區塊增量；第一個文字區塊不是完整輸出。

##### 需要檢查原始回應時

保留請求／回應 ID 與標頭。未提供通用的文字工作擷取 URL。

回應欄位

| 欄位 | 類型 |
| --- | --- |
| 欄位`id` | 類型string |
| 欄位`model` | 類型string |
| 欄位`content[]` | 類型text\|thinking\|tool\_use\|other content block |
| 欄位`stop_reason` | 類型string\|null |
| 欄位`usage` | 類型object |

錯誤與後續步驟

| 回應 | 條件 | 下一步 |
| --- | --- | --- |
| 回應400 · `invalid_request_error` | 條件必要欄位、素材表示方式或參數值無效 | 下一步提出新的建立請求前，先修正指定欄位。 |

### 別名

#### 模型別名

**Ailoot Ultra** [`google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Fgemini-3.1-pro-preview-customtools&route=Ultra&caller=google%2Fgemini-3.1-pro-preview-customtools&fmt=messages)

#### 方法路徑別名

請使用上方列出的 API 方法路徑。

#### 相關呼叫用 ID

[`google/gemini-3.1-pro-preview-customtools`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Fgemini-3.1-pro-preview-customtools&route=Ultra&caller=google%2Fgemini-3.1-pro-preview-customtools&fmt=messages)

FAQ · Google: Gemini 3.1 Pro Preview Custom Tools

可以使用哪些輸入與結果？

`POST /v1/chat/completions` · `google/gemini-3.1-pro-preview-customtools`: `text` → `text` `POST /v1/messages` · `google/gemini-3.1-pro-preview-customtools`: `text` → `json`, `sse`

請求使用哪些欄位？

`POST /v1/chat/completions` · `google/gemini-3.1-pro-preview-customtools`: `model`, `messages`, `stream`, `modalities`, `provider` `POST /v1/messages` · `google/gemini-3.1-pro-preview-customtools`: `model`, `messages`, `max_tokens`, `stream`

適用哪些限制？

`POST /v1/chat/completions` · `google/gemini-3.1-pro-preview-customtools`: `messages.min_items`: `1`

將 Ailoot 串接 Claude Code、OpenCode、Hermes 或自己的應用程式。

## 公司及其專案組合

公司及其專案組合：數百萬客戶，每月銷售額達數十億。

## 優惠購買 token。

訂閱優惠適合持續工作，折扣碼購買 token 最高可折 50%。

訂閱

為定期請求選擇優惠方案。

最高 50% 折扣碼

購買時輸入代碼，價格依活動重算。

歷史中的費用

每次請求保存模型、token 與金額。

[選擇訂閱](https://ailoot.ai/docs/zh-hant-tw/billing/subscriptions/) · [查看模型價格](https://ailoot.ai/models/zh-hant-tw/)

## 將 API 加入 你銷售的產品。

依 Ailoot 正式服務條款與授權合約串接 SaaS、應用程式與機器人；轉售請申請經銷授權。

商用應用程式

在付費功能加入文字、圖片、影片與聲音生成。

經銷授權

提供專案說明與存取方式，要求書面使用和轉售條件。

網站文件

串接前可閱讀正式服務條款、授權合約與資料處理政策。

[申請經銷授權](mailto:support@ailoot.ai) · [正式服務條款與授權合約](https://ailoot.ai/legal/offer?lang=zh-hant-tw)

## Ailoot · 公司及其專案組合





Ailoot以累積的營運經驗、廣大的客戶群、穩定的服務及持續的KPI管理為基礎。





公司及其專案組合：數百萬客戶，每月銷售額達數十億。





Ailoot將這些營運經驗用於API存取，讓客戶的產品、代理、應用程式及自動化流程使用AI功能。
