Cancel a response

Cancel an in-progress response. Only responses created for background processing can be cancelled.

POST /responses/{response_id}/cancel

Cancel a background model response by ID.

Parameters

Path parameters

FieldTypeRequiredDescription
response_idstringYesThe ID of the response to cancel.

Response

HTTP 200 — OK

Content Type: application/json

CancelResponseResponse

python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.meta.ai/v1",
api_key=os.environ["MODEL_API_KEY"],
)
response = client.responses.cancel("resp_abc123")
print(response.model_dump_json(indent=2))

For usage examples and background-processing guidance, see the Responses feature page.