Lets coding agents edit files with structured patches. The model emits a V4A diff, OpenRouter validates it and returns a structured apply_patch call, and your application applies the change to its own files.
Standard model token costs apply to every request.
Using this tool
OpenRouter validates the diff and returns it as an apply_patch_call output item. Your application applies the patch to its own files and sends the result back as apply_patch_call_output on the next turn.
Available through the API. Patches are applied by your application, so there is no file system to edit in the chatroom.
Supported APIs: 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."
}'