所有服务器工具
通过 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."
}'文档中提供了设置、参数和示例。
阅读集成指南常见问题
Shell follows the Responses API hosted shell shape and works on the Responses and Messages APIs. Bash follows the Anthropic bash tool shape and is only available on the Anthropic Messages API.
相关工具
代码与执行