OpenAI | Responses
The Responses API is the core API for interacting with OpenAI models. It supports text and image inputs, tool use, streaming, and structured outputs.
Simple Example
Create a response using the Responses API.
OpenAI := TsgcHTTP_API_OpenAI.Create(nil);
OpenAI.OpenAIOptions.ApiKey := 'API_KEY';
WriteLn(OpenAI._CreateResponse('gpt-4o', 'What is the capital of France?'));
Methods
- CreateResponse: Creates a model response given a model and input.
- Model: ID of the model to use (e.g. gpt-4o, gpt-4o-mini).
- Input: Text or structured input for the model.
- RetrieveResponse: Retrieves a previously created response by its ID.
- ResponseId: The ID of the response to retrieve.
- DeleteResponse: Deletes a response by its ID.
- ResponseId: The ID of the response to delete.
- CancelResponse: Cancels an in-progress response.
- ResponseId: The ID of the response to cancel.
- ListInputItems: Returns a list of input items for a given response.
- ResponseId: The ID of the response.