Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/apply-patch-openai-api-workflow-guide.mdA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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