所有伺服器工具

Shell

openrouter:shell

透過 Responses 和 Messages API,為任何模型提供託管 shell。模型發出命令,OpenRouter 在隔離的容器中執行命令,再將 stdout 和 stderr 傳回模型。這是以沙箱為基礎、相當於 OpenAI 託管 shell 工具的功能。

運作方式

用於執行程式碼、指令碼和命令列工具。命令一律在託管環境中執行,絕不會在您的電腦上執行。

  1. 您的模型 傳送一批指令以供執行。

  2. OpenRouter 在隔離的 Linux 容器中逐一執行,並擷取 stdout、stderr 和結束代碼。

  3. 您的模型 讀取輸出,並可在同一個請求中執行更多指令。

供應商與定價

無論使用哪個模型或供應商,指令一律在 OpenRouter 沙箱中執行。Responses API 的原生 shell 工具可作為簡寫使用,並在同一個沙箱中執行。

  • OpenRouter sandbox

    US$0.0001 / second

    啟動容器的請求最低以 30.0s 計算

    指令會在伺服器端由 OpenRouter 營運的隔離容器中執行。

每個請求皆適用標準模型 token 費用。

使用此工具

OpenRouter 會在請求期間執行工具,並將結果傳回模型,因此不需要用戶端工具迴圈。

支援的 API:Responses and Anthropic Messages。

Shell
curl https://openrouter.ai/api/v1/responses \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "openai/gpt-5.2",
  "tools": [
    {
      "type": "openrouter:shell"
    }
  ],
  "input": "Create a Python script that prints the first 20 Fibonacci numbers and run it."
}'

設定、參數與範例請參閱文件。

閱讀整合指南

常見問題