所有伺服器工具
Apply patch
openrouter:apply_patch
讓程式設計代理透過結構化修補程式編輯檔案。模型會產生 V4A diff,OpenRouter 會驗證並傳回結構化的 apply_patch 呼叫,再由您的應用程式將變更套用至自己的檔案。
運作方式
可編輯檔案的程式開發代理的建構元件。
- 1
您的模型 寫入 V4A 差異檔以建立、更新或刪除檔案。
- 2
OpenRouter 驗證差異,並將無效的修補程式傳回模型以進行修正。
- 3
您的應用程式 將修補程式套用至自己的檔案,並在下一輪回報結果。
供應商與定價
OpenRouter validator
免費
OpenRouter 會驗證 V4A 差異,並傳回結構化的 apply_patch 呼叫。
每個請求皆適用標準模型 token 費用。
使用此工具
OpenRouter 會驗證差異內容,並以 apply_patch_call 輸出項目傳回。您的應用程式會將修補套用至自身檔案,並在下一輪以 apply_patch_call_output 傳回結果。
可透過 API 使用。 修補程式由您的應用程式套用,因此 Chatroom 中沒有可供編輯的檔案系統。
支援的 API:Responses。
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:apply_patch"
}
],
"input": "Rename the function greet to sayHello in src/index.ts."
}'設定、參數與範例請參閱文件。
閱讀整合指南常見問題
No. On the OpenRouter-handled path, OpenRouter validates the model’s V4A diff for create_file, update_file, or delete_file before returning a structured apply_patch_call output item to your application (when the default engine uses a provider’s native apply_patch, OpenRouter passes the tool through). Either way, your application applies the patch locally and sends back apply_patch_call_output on the next turn.
Apply patch is supported on the Responses API (/api/v1/responses). By default it uses the upstream provider’s native apply_patch tool when the endpoint supports it; set parameters.engine to openrouter to always use OpenRouter’s V4A validator.
相關工具
程式碼與執行