openai · OpenAI Platform Docs
Apply Patch | OpenAI API
Explains how to use the Apply Patch functionality to programmatically update or modify existing content using diffs or patches within the OpenAI API workflow.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Apply Patch | OpenAI API
Explains how to use the Apply Patch functionality to programmatically update or modify existing content using diffs or patches within the OpenAI API workflow.
When To Use
Use when you need to implement a workflow that modifies existing text or code blocks by applying specific changes rather than regenerating the entire content.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/apply-patch-openai-api-workflow-guide.md | A guide explaining how to use the apply-patch tool to create, update, and delete files in a codebase using structured diffs. | Questions about a guide explaining how to use the apply-patch tool to create, update, and delete files in a codebase using structured... |
examples/apply-patch-openai-api-openai-api-apply-patch-python.text | A Python code example demonstrating how to use the OpenAI client to apply a patch to a file context. | Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the OpenAI client to apply a patch to a file context. |
examples/apply-patch-openai-api-openai-api-apply-patch-operation-json.text | A JSON object representing an applypatchcall operation containing a file update diff. | Exact payloads, commands, or snippets shown in A JSON object representing an applypatchcall operation containing a file update diff. |
examples/apply-patch-openai-api-openai-apply-patch-python-implementation.text | A Python code example demonstrating the implementation of an apply_operation function to process patch calls. | Exact payloads, commands, or snippets shown in A Python code example demonstrating the implementation of an applyoperation function to process patch calls. |
examples/apply-patch-openai-api-openai-api-apply-patch-failed-call.text | A text representation of a failed apply-patch-call output showing a file not found error. | Exact payloads, commands, or snippets shown in A text representation of a failed apply-patch-call output showing a file not found error. |
examples/apply-patch-openai-api-openai-api-apply-patch-workspace-editor-typescrip.text | A TypeScript implementation of a WorkspaceEditor class demonstrating how to apply a diff to create file content using the applyPatch operation. | Exact payloads, commands, or snippets shown in A TypeScript implementation of a WorkspaceEditor class demonstrating how to apply a diff to create file content using... |
examples/apply-patch-openai-api-openai-apply-patch-python-agent-workspace-editor.text | A Python code example demonstrating the implementation of a WorkspaceEditor class using the ApplyPatchTool within an agentic workflow. | Exact payloads, commands, or snippets shown in A Python code example demonstrating the implementation of a WorkspaceEditor class using the ApplyPatchTool within an... |
examples/apply-patch-openai-api-openai-api-apply-patch-error-response.text | A text representation of an error response from the apply-patch tool when a specified file path is not found. | Exact payloads, commands, or snippets shown in A text representation of an error response from the apply-patch tool when a specified file path is not found. |
examples/apply-patch-openai-api-openai-api-apply-patch-failed-context.text | A text representation of a failed apply-patch-call output showing an invalid context error. | Exact payloads, commands, or snippets shown in A text representation of a failed apply-patch-call output showing an invalid context error. |
What This Skill Covers
- The applypatch tool lets GPT-5.1 create, update, and delete files in your codebase using structured diffs. Instead of just suggesting edits, the model emits...
- Main sections:
When to use,Use apply patch tool with Responses API,Example: Renaming a function with Apply Patch Tool,Apply patch operations,Implementing the patch harness.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.openai.com/api/docs/guides/tools-apply-patch
