OpenRouter now supports "apply_patch," a server tool that lets any model propose file edits using V4A diffs through the Responses API. The model generates a patch (create, update, or delete a file). OpenRouter validates the diff syntax server-side.
OpenRouter apply_patch Tool Standardizes Code Edits Across Hundreds of AI Models
· Updated
OpenRouter introduced apply_patch, a server-side tool that enables any LLM to propose file creations, updates, or deletions using a unified diff format. By validating diff syntax server-side, the tool allows developers to build model-agnostic coding agents without writing custom parsing logic for every provider's unique output style.
Responses API. The tool lets models generate patches using V4A diffs to create, modify, or delete files. OpenRouter validates diff syntax on its own servers before passing the structured result to the user's application.This update addresses a core friction in agentic coding where providers lack a standard edit format. This capability follows OpenRouter's Agentic Web Tools which standardized search; apply_patch does the same for file manipulation, preventing developers from being locked into a single model's specific patching behavior.
You can now implement multi-step file editing by passing the apply_patch tool to any supported model. OpenAI models stream these diffs incrementally, while others return complete patches. The tool is in beta, with an engine parameter available to toggle between native provider logic and OpenRouter's server-side validation.
Still wondering? A few quick answers below.
Every HeadsUpAI update is written based on its original source and reviewed before it's published. Read our editorial standards →
