Anthropic: Claude Sonnet 5.5 (batch)
Claude Sonnet 5.5 適合需求明確的開發、分析與文件準備工作。它重視清楚的文字表達、視覺編排,以及循序運用工具完成任務。
關於模型
此說明介紹模型的能力。Ailoot 可用的輸入、輸出與選項,依所選方法列於下方。
需求明確的日常工作
Claude Sonnet 5.5 著重需求明確的任務:撰寫程式碼、修正錯誤、分析資訊,以及準備專業資料。Anthropic 表示,這個版本適合快速反覆調整的工作流程,讓使用者檢視成果、補充要求,再繼續工作。廠商特別強調清楚的文字表達、整齊的文件編排,以及對介面設計的重視。
任務可以結合閱讀資料與產出最終內容。廠商介紹的一種情境,是分析公司的季度資料及演講逐字稿,再依指定的視覺風格準備簡報。模型可透過應用程式提供的功能協助處理文件、試算表與投影片;成品檔案由應用程式環境產出。
視覺資料與任務延續
模型接受文字與影像,本身以文字作答。它可將視覺資訊與文字指令連結,支援長時間的多步驟工作。圖表、表格與文件頁面提供分析素材;進一步操作檔案或介面,則需要應用程式提供工具。
廠商支援的一般影像輸入格式為 JPEG/PNG/GIF/WebP;動畫使用第一個影格。模型直接分析影像時,長邊為 2576 像素,視覺 token 為 4784;較大的影像會先縮小再分析。檔案與參數的支援情況由應用程式採用的方法決定。
上下文視窗為 1 百萬個 token,一般模式的最大回覆為 128 千個 token。內建知識的可靠截止時間為 2026 年六月。廠商提供在對話中調整推理力度及可用工具,以及按要求壓縮歷史紀錄的功能;這些功能需要環境支援。若應用程式傳回先前保存的推理,Sonnet 5.5 可讀取自己的推理區塊,以及 Sonnet 5、Opus 4.8、Haiku 4.5 和更早模型的區塊;Opus 5、Opus 5.5、Fable 與 Mythos 的區塊則不相容。能否將它的區塊轉交其他模型,取決於具體模型配對及方法支援。不相容的區塊會被排除,之後的回合會在沒有先前推理的情況下進行。修改較早的訊息、系統指令或工具定義,可能破壞區塊的綁定關係;檢查這些關係時,請求可能被拒絕,或受影響的區塊被排除。
自適應推理與工具呼叫之間的工作
標準模式為自適應推理,effort 預設為 high。可用的五種力度等級是 low、medium、high、xhigh 與 max。對需求清楚的代理任務,Anthropic 建議從 medium 開始;較困難且耗時較長的工作則從 high 開始。適合的等級取決於任務與所需的細緻程度。
獨立的 between_tools 模式省略第一次行動前的初步推理,但保留工具呼叫之間的推理。它只支援 low、medium 與 high;xhigh 和 max 必須使用自適應模式。Sonnet 5.5 不支援完全關閉推理,也不支援為 extended thinking 手動設定預算。
執行的具體條件
若採用的方法支援工具控制,可使用自動選擇 auto 或停用工具 none。廠商的模型不支援強制呼叫任意工具的 any,也不支援依名稱指定工具的 tool。在 between_tools 模式中,不能於對話途中變更推理力度;一般自適應模式則提供這項設定。使用工具結果時,必須保留一致的歷史紀錄。
在支援這些設定的方法中,temperature、top_p 與 top_k 不接受非預設值;所需的回覆格式與風格應透過指令指定。
這個版本更新後的 token 切分方式保留 Sonnet 5 世代的特性。估算請求大小時,應考量資料內容,而不只計算字元數。一般開發與研究是模型的主要用途,但保護機制會限制部分敏感請求。
Ailoot Ultra · 批次處理(Batch) POST /v1/batches anthropic/claude-sonnet-5.5:batch
anthropic/claude-sonnet-5.5:batch
anthropic/claude-sonnet-5.5:batch入門
Claude Sonnet 5.5 適合需求明確的開發、分析與文件準備工作。它重視清楚的文字表達、視覺編排,以及循序運用工具完成任務。
- 接受的輸入
- 文字
- 結果
- 文字
Ailoot 可用 · 輸入與方法
Ailoot Ultra · 批次處理(Batch) POST /v1/batches
- 輸入
text- 輸出
text- 輸出格式
- 內嵌的 results[].response.body JSON
| 欄位 | 類型 | 要求 | 值與限制 | 預設值 |
|---|---|---|---|---|
欄位endpoint | 類型string | 要求必填 | 值與限制 /v1/chat/completions | 預設值— |
欄位model | 類型string | 要求必填 | 值與限制 anthropic/claude-sonnet-5.5:batch | 預設值— |
欄位requests | 類型batch_item[] | 要求必填 | 值與限制 項目數下限: 1 | 預設值— |
欄位requests[].custom_id | 類型string | 要求必填 | 值與限制 | 預設值— |
欄位requests[].body.messages | 類型message[] | 要求必填 | 值與限制 | 預設值— |
欄位completion_window | 類型string | 要求選填 | 值與限制 24h | 預設值— |
欄位provider | 類型object|null | 要求選填 | 值與限制 | 預設值— |
欄位requests[].body.model | 類型string | 要求選填 | 值與限制 anthropic/claude-sonnet-5.5:batch, anthropic/claude-sonnet-5.5 | 預設值— |
欄位provider.only | 類型string[] | 要求選填 | 值與限制 anthropic | 預設值— |
欄位provider.allow_fallbacks | 類型boolean|null | 要求選填 | 值與限制 false, null | 預設值— |
方法參數與生命週期
| 參數 | 規格 |
|---|---|
參數content_type | 規格application/json |
參數required | 規格endpoint, model, requests |
參數material_types | 規格text |
參數representation | 規格內嵌的 requests[];每個項目皆含 custom_id 與 body |
參數request_endpoint_profile | 規格/v1/chat/completions |
參數file_material | 規格呼叫端可在本機將實際的 UTF-8 JSONL 讀入 requests[]。此流程不使用上傳用途、input_file_id 或檔案參照。若缺少客戶素材或素材為空,應在 POST 前停止準備。 |
參數serialization_order | 規格endpoint, model, provider(如有提供), completion_window(如有提供), requests 放在最後 |
參數optional_controls | 規格provider.only, provider.allow_fallbacks, completion_window |
參數schema_scope | 規格依文件規定的內嵌 Batch 封裝格式提供文字 Chat Completions 請求主體。 |
生命週期: asynchronous
GET /v1/batches/{operation_id} · 原始建立回應中實際回傳的 response.id;使用相同使用者/金鑰/群組
方案
費率資訊不會增加請求選項。支援的參數列於所選方法中。
- 快速模式
- 未指定 選取快速模式時
- flex 模式
- 未指定 選取 flex 模式時
- 最高推理強度
- 未指定 最高推理強度採用 default 調整值時
- 顯式快取計價
- 已啟用 請求顯式快取時
Ailoot 費率
各設定的價格
請逐一核對各項費用與所列條件。每組互為替代選項的設定只套用一種費率。
| 設定 | 費率表 | 上下文 Token 數大於 | 上下文 Token 數小於或等於 | 費用 |
|---|---|---|---|---|
| 設定詞元基本費率 | 費率表基本費率 | 上下文 Token 數大於— | 上下文 Token 數小於或等於無上限 | 費用 輸入 · 輸入 Token $0.002 / 1K Token 輸出 · 輸出 Token $0.01 / 1K Token 輸入 · 讀取快取 $0.0001 / 1K Token 輸入 · 寫入快取 $0.0025 / 1K Token 輸入 · 寫入快取,1 小時 $0.004 / 1K Token |
| 設定請求長度級距 1 | 費率表— | 上下文 Token 數大於0 | 上下文 Token 數小於或等於無上限 | 費用 輸入 · 輸入 Token $0.002 / 1K Token 輸出 · 輸出 Token $0.01 / 1K Token 輸入 · 讀取快取 $0.0001 / 1K Token 輸入 · 寫入快取 $0.0025 / 1K Token 輸入 · 寫入快取,1 小時 $0.004 / 1K Token |
Ailoot 會在請求前預留估算金額。取得結果後,依實測用量結算最終費用。串流結算採用最終用量紀錄。預留金額與結算的運作方式 →
請求範例
Ailoot Ultra · 批次處理(Batch)
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
python3 - <<'PY_REQUEST'
import json
from pathlib import Path
body=json.loads('{"endpoint":"/v1/chat/completions","model":"anthropic/claude-sonnet-5.5:batch","requests":[{"custom_id":"req-0001","body":{"messages":[{"role":"user","content":"Hello!"}],"max_tokens":16}}]}')
Path("batch-request.json").write_text(json.dumps(body,ensure_ascii=False),encoding="utf-8")
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/batches \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @batch-request.json -D batch-response-headers.txt -o batch-create-response.json
import json, os
from pathlib import Path
from urllib.request import Request, urlopen
def prepare_requests(customer_path):
path = Path(customer_path)
if not path.is_file(): raise ValueError("Customer JSONL file is missing")
items = [json.loads(line) for line in path.read_text(encoding="utf-8").splitlines() if line.strip()]
if not items: raise ValueError("Customer JSONL contains no requests")
ids = set()
for item in items:
if set(item) != {"custom_id", "body"}: raise ValueError("Each item needs custom_id and body")
cid = item["custom_id"]
if not isinstance(cid, str) or not cid.strip() or cid in ids: raise ValueError("custom_id must be nonempty and unique")
ids.add(cid)
if not isinstance(item["body"], dict) or not item["body"].get("messages"): raise ValueError("Supply actual text messages")
supplied_model = item["body"].get("model")
if supplied_model is not None and supplied_model not in ['anthropic/claude-sonnet-5.5:batch', 'anthropic/claude-sonnet-5.5']: raise ValueError("body.model must be an exact documented caller or wire ID")
return {"endpoint":"/v1/chat/completions", "model":"anthropic/claude-sonnet-5.5:batch", "requests":items}
if __name__ == "__main__":
material = os.environ.get("AILOOT_BATCH_REQUESTS_JSONL", "")
if not material: raise SystemExit("Set AILOOT_BATCH_REQUESTS_JSONL to your actual customer file")
body = prepare_requests(material)
key = os.environ.get("AILOOT_API_KEY", "")
if not key: raise SystemExit("Set AILOOT_API_KEY")
request = Request("https://api.ailoot.ai/v1/batches", data=json.dumps(body, ensure_ascii=False).encode("utf-8"), headers={"Authorization":"Bearer " + key, "Content-Type":"application/json"}, method="POST")
with urlopen(request) as response:
raw = response.read()
Path("batch-create-response.json").write_bytes(raw)
print(raw.decode("utf-8"))
import json
from pathlib import Path
raw = Path("batch-status-response.json").read_bytes()
response = json.loads(raw)
if response.get("status") != "completed":
raise SystemExit("Keep the original operation; read its status without resubmitting")
results = response.get("results")
if not isinstance(results, list) or not results:
raise SystemExit("Preserve the original response; completed results are missing")
Path("batch-results.jsonl").write_text("".join(json.dumps(item, ensure_ascii=False) + "\n" for item in results), encoding="utf-8")
# Preserve batch-status-response.json with aggregate usage and every result/error.
接收並儲存結果
Ailoot Ultra · 批次處理(Batch)
內嵌的 results[].response.body JSON
GET /v1/batches/{operation_id}
查看工作狀態
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
BATCH_OPERATION_ID="$(python3 - <<'PY_ID'
import json
from pathlib import Path
from urllib.parse import quote
response = json.loads(Path("batch-create-response.json").read_text(encoding="utf-8"))
operation = response.get("id")
if not isinstance(operation, str) or not operation: raise SystemExit("No actual original operation ID; preserve the response and do not resubmit")
print(quote(operation, safe=""))
PY_ID
)"
curl --fail-with-body --silent --show-error "https://api.ailoot.ai/v1/batches/$BATCH_OPERATION_ID" \
-H "Authorization: Bearer $AILOOT_API_KEY" -o batch-status-response.json
保留所有已完成的結果
請保留所有完整傳回的回應、檔案與內容區塊。
保留完整的原始狀態 JSON、每個結果/custom_id,以及完整的回應或錯誤主體。將已完成的 results[] 儲存為 JSONL,不得篩除任何項目。
需要檢查原始回應時
保留原始作業 ID。503 result_pending_check 回應帶有 X-Should-Retry:false;請勿重新提交狀態不明的原始批次。
回應欄位
| 欄位 | 類型 |
|---|---|
欄位results[].custom_id | 類型string |
欄位results[].response.body.choices[].message.content | 類型string|null |
欄位results[].error | 類型object|null |
欄位usage | 類型object|null |
欄位id | 類型string |
欄位model | 類型string |
欄位endpoint | 類型string |
欄位status | 類型string |
欄位request_counts | 類型object |
欄位results[].id | 類型string |
欄位results[].response.status_code | 類型integer |
欄位results[].response.request_id | 類型string |
錯誤與後續步驟
| 回應 | 條件 | 下一步 |
|---|---|---|
回應400 · invalid_request_error | 條件文件規定的內嵌封裝格式無效、索引鍵重複、項目識別有誤,或與已設定的模型能力衝突。 | 下一步再次提交前,請先修正指出的欄位。 |
回應401 · authentication_error | 條件API 金鑰無效。 | 下一步使用已獲授權的 Ailoot 金鑰。 |
回應403 · permission_error | 條件批次處理群組無法使用。 | 下一步檢查金鑰/群組的使用權限。 |
回應422 · invalid_request_error | 條件批次處理採用餘額計費;透過訂閱建立批次的請求會遭拒絕。 | 下一步使用已獲授權、以餘額計費的群組。 |
回應422 · price_unavailable | 條件無法為批次輸入估價。 | 下一步保留回應;使用文件規定的該 API 家族輸入格式。 |
回應402 · billing_error | 條件批次處理的預留額度無法取得。 | 下一步提交新請求前,請先解決請求受理問題。 |
回應503 · price_unavailable | 條件批次處理方法的價格/原生費率無法取得。 | 下一步保留回應;請勿替換價格。 |
回應503 · api_error | 條件指定的供應商路由無法使用。 | 下一步保留回應,以供修復路由。 |
回應503 · result_pending_check | 條件原始結果需要檢查;X-Should-Retry:false。 | 下一步保留原始 operation_id/id 並讀取其狀態;請勿重複原始 POST。 |
回應404 · not_found | 條件查詢批次狀態所需的作業不存在,或屬於其他身分。 | 下一步使用完全相同的原始 id,以及相同的使用者/金鑰/群組。 |
別名
模型別名
Ailoot Ultra anthropic/claude-sonnet-5.5:batch
方法路徑別名
請使用上方列出的 API 方法路徑。
相關呼叫用 ID
FAQ · Anthropic: Claude Sonnet 5.5 (batch)
- 可以使用哪些輸入與結果?
POST /v1/batches·anthropic/claude-sonnet-5.5:batch:text→text- 請求使用哪些欄位?
POST /v1/batches·anthropic/claude-sonnet-5.5:batch:endpoint,model,requests,completion_window,provider- 適用哪些限制?
POST /v1/batches·anthropic/claude-sonnet-5.5:batch:requests.min_items:1