Create and Poll a Response
A 4-step recipe with ChatGPT. We can help you get access.
Recipe · 4 steps
Create and Poll a Response
with ChatGPT · Artificial Intelligence Management
Create a Responses API response and poll until it reaches a terminal status.
- Submit the prompt to the Responses API as a stored response so it can be retrieved by id while it generates.
- Retrieve the stored response by id. Repeats while the status is still in_progress and then branches on the terminal status.
- Retrieve the settled response once more to capture the final generated text and token usage for a completed run.
- Retrieve the settled response to capture the failure error object or the reason the response is incomplete.
What you'll need to have ready
- apiKey: OpenAI API key used as the Bearer credential.
- model: Model ID used to generate the response (e.g. gpt-4o).
- input: The text prompt to send to the model.
- instructions: Optional system-level guidance for the model.
For your developer
Arazzo workflow chatgpt:create-and-poll-response, 4 operations: createResponse → getResponse → getResponse → getResponse. Specs on APIs.io.