Prompt Buddy logoPrompt Buddy

openai · OpenAI Platform Docs

Background mode

Teaches how to implement asynchronous long-running tasks using background mode, including polling for status, cancelling in-flight requests, and managing streaming responses with cursors.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Background mode

Teaches how to implement asynchronous long-running tasks using background mode, including polling for status, cancelling in-flight requests, and managing streaming responses with cursors.

When To Use

Use when you need to execute complex reasoning tasks that exceed standard timeout limits or when you need to manage long-running asynchronous model responses via polling or streaming.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/background-mode-workflow-guide.mdA guide explaining how to poll, cancel, and stream background responses using the OpenAI API.Questions about a guide explaining how to poll, cancel, and stream background responses using the OpenAI API.
examples/background-mode-openai-api-background-mode-curl-request.bashA bash curl command demonstrating how to initiate an asynchronous API request using the background parameter.Exact payloads, commands, or snippets shown in A bash curl command demonstrating how to initiate an asynchronous API request using the background parameter.
examples/background-mode-openai-api-javascript-background-mode.javascriptA JavaScript code example demonstrating how to initiate an asynchronous request using the background parameter in the OpenAI client.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to initiate an asynchronous request using the background parameter in the...
examples/background-mode-openai-api-python-background-mode-request.pythonA Python script demonstrating how to initiate an asynchronous API request using the background parameter in the OpenAI client.Exact payloads, commands, or snippets shown in A Python script demonstrating how to initiate an asynchronous API request using the background parameter in the OpenA...
examples/background-mode-openai-api-background-mode-curl-request-2.bashA bash curl command demonstrating how to initiate a background mode request to the OpenAI API.Exact payloads, commands, or snippets shown in A bash curl command demonstrating how to initiate a background mode request to the OpenAI API.
examples/background-mode-openai-api-javascript-background-mode-polling.javascriptA JavaScript example demonstrating how to initiate an OpenAI API request with background mode enabled and poll the response status until completion.Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to initiate an OpenAI API request with background mode enabled and poll the re...
examples/background-mode-openai-api-python-background-mode-polling.pythonA Python script demonstrating how to initiate an asynchronous background request and poll for its status using the OpenAI client.Exact payloads, commands, or snippets shown in A Python script demonstrating how to initiate an asynchronous background request and poll for its status using the Op...
examples/background-mode-openai-api-background-mode-cancel-response-curl.bashA curl command demonstrating how to cancel a background mode response using the OpenAI API.Exact payloads, commands, or snippets shown in A curl command demonstrating how to cancel a background mode response using the OpenAI API.
examples/background-mode-openai-api-javascript-background-mode-cancel-response.javascriptA JavaScript example demonstrating how to cancel an ongoing background mode response using the OpenAI client.Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to cancel an ongoing background mode response using the OpenAI client.
examples/background-mode-openai-api-python-background-mode-cancel-response.pythonA Python script demonstrating how to use the OpenAI client to cancel a background mode response.Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the OpenAI client to cancel a background mode response.
examples/background-mode-openai-api-background-mode-curl-request-3.bashA bash script demonstrating how to initiate and resume an asynchronous background request using curl against the OpenAI API.Exact payloads, commands, or snippets shown in A bash script demonstrating how to initiate and resume an asynchronous background request using curl against the Open...
examples/background-mode-openai-api-javascript-background-mode-streaming-resume.javascriptA JavaScript example demonstrating how to initiate a background mode stream and use sequence numbers to resume streaming if a connection is interrupted.Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to initiate a background mode stream and use sequence numbers to resume stream...
examples/background-mode-openai-api-python-background-mode-streaming.pythonA Python script demonstrating how to initiate an asynchronous background response while simultaneously streaming events from the OpenAI API.Exact payloads, commands, or snippets shown in A Python script demonstrating how to initiate an asynchronous background response while simultaneously streaming even...

What This Skill Covers

  • To check the status of background requests, use the GET endpoint for Responses. Keep polling while the request is in the queued or inprogress state. When it...
  • Main sections: Polling background responses, Cancelling a background response, Streaming a background response, Limits.

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/background.md