Class CreateResponseRequest
public sealed class CreateResponseRequest- Inheritance
- 
      
      CreateResponseRequest
- Inherited Members
Constructors
CreateResponseRequest()
public CreateResponseRequest()CreateResponseRequest(IResponseItem, Model, bool?, IEnumerable<string>, string, int?, IReadOnlyDictionary<string, string>, bool?, string, Prompt, Reasoning, string, bool?, double?, TextResponseFormat, JsonSchema, string, IEnumerable<Tool>, double?, Truncation, string, string, int?, string, string, int?)
public CreateResponseRequest(IResponseItem input, Model model = null, bool? background = null, IEnumerable<string> include = null, string instructions = null, int? maxOutputTokens = null, IReadOnlyDictionary<string, string> metadata = null, bool? parallelToolCalls = null, string previousResponseId = null, Prompt prompt = null, Reasoning reasoning = null, string serviceTier = null, bool? store = null, double? temperature = null, TextResponseFormat responseFormat = TextResponseFormat.Auto, JsonSchema jsonSchema = null, string toolChoice = null, IEnumerable<Tool> tools = null, double? topP = null, Truncation truncation = Truncation.Auto, string user = null, string conversationId = null, int? maxToolCalls = null, string promptCacheKey = null, string safetyIdentifier = null, int? topLogProbs = null)Parameters
- inputIResponseItem
- modelModel
- backgroundbool?
- includeIEnumerable<string>
- instructionsstring
- maxOutputTokensint?
- metadataIReadOnlyDictionary<string, string>
- parallelToolCallsbool?
- previousResponseIdstring
- promptPrompt
- reasoningReasoning
- serviceTierstring
- storebool?
- temperaturedouble?
- responseFormatTextResponseFormat
- jsonSchemaJsonSchema
- toolChoicestring
- toolsIEnumerable<Tool>
- topPdouble?
- truncationTruncation
- userstring
- conversationIdstring
- maxToolCallsint?
- promptCacheKeystring
- safetyIdentifierstring
- topLogProbsint?
CreateResponseRequest(IEnumerable<IResponseItem>, Model, bool?, IEnumerable<string>, string, int?, IReadOnlyDictionary<string, string>, bool?, string, Prompt, Reasoning, string, bool?, double?, TextResponseFormat, JsonSchema, string, IEnumerable<Tool>, double?, Truncation, string, string, int?, string, string, int?)
public CreateResponseRequest(IEnumerable<IResponseItem> input, Model model = null, bool? background = null, IEnumerable<string> include = null, string instructions = null, int? maxOutputTokens = null, IReadOnlyDictionary<string, string> metadata = null, bool? parallelToolCalls = null, string previousResponseId = null, Prompt prompt = null, Reasoning reasoning = null, string serviceTier = null, bool? store = null, double? temperature = null, TextResponseFormat responseFormat = TextResponseFormat.Auto, JsonSchema jsonSchema = null, string toolChoice = null, IEnumerable<Tool> tools = null, double? topP = null, Truncation truncation = Truncation.Auto, string user = null, string conversationId = null, int? maxToolCalls = null, string promptCacheKey = null, string safetyIdentifier = null, int? topLogProbs = null)Parameters
- inputIEnumerable<IResponseItem>
- modelModel
- backgroundbool?
- includeIEnumerable<string>
- instructionsstring
- maxOutputTokensint?
- metadataIReadOnlyDictionary<string, string>
- parallelToolCallsbool?
- previousResponseIdstring
- promptPrompt
- reasoningReasoning
- serviceTierstring
- storebool?
- temperaturedouble?
- responseFormatTextResponseFormat
- jsonSchemaJsonSchema
- toolChoicestring
- toolsIEnumerable<Tool>
- topPdouble?
- truncationTruncation
- userstring
- conversationIdstring
- maxToolCallsint?
- promptCacheKeystring
- safetyIdentifierstring
- topLogProbsint?
CreateResponseRequest(string, Model, bool?, IEnumerable<string>, string, int?, IReadOnlyDictionary<string, string>, bool?, string, Prompt, Reasoning, string, bool?, double?, TextResponseFormat, JsonSchema, string, IEnumerable<Tool>, double?, Truncation, string, string, int?, string, string, int?)
public CreateResponseRequest(string textInput, Model model = null, bool? background = null, IEnumerable<string> include = null, string instructions = null, int? maxOutputTokens = null, IReadOnlyDictionary<string, string> metadata = null, bool? parallelToolCalls = null, string previousResponseId = null, Prompt prompt = null, Reasoning reasoning = null, string serviceTier = null, bool? store = null, double? temperature = null, TextResponseFormat responseFormat = TextResponseFormat.Auto, JsonSchema jsonSchema = null, string toolChoice = null, IEnumerable<Tool> tools = null, double? topP = null, Truncation truncation = Truncation.Auto, string user = null, string conversationId = null, int? maxToolCalls = null, string promptCacheKey = null, string safetyIdentifier = null, int? topLogProbs = null)Parameters
- textInputstring
- modelModel
- backgroundbool?
- includeIEnumerable<string>
- instructionsstring
- maxOutputTokensint?
- metadataIReadOnlyDictionary<string, string>
- parallelToolCallsbool?
- previousResponseIdstring
- promptPrompt
- reasoningReasoning
- serviceTierstring
- storebool?
- temperaturedouble?
- responseFormatTextResponseFormat
- jsonSchemaJsonSchema
- toolChoicestring
- toolsIEnumerable<Tool>
- topPdouble?
- truncationTruncation
- userstring
- conversationIdstring
- maxToolCallsint?
- promptCacheKeystring
- safetyIdentifierstring
- topLogProbsint?
Properties
Background
Whether to run the model response in the background.
[JsonInclude]
[JsonPropertyName("background")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Background { get; }Property Value
- bool?
ConversationId
The conversation id that this response belongs to.
Items from this conversation are prepended to input_items for this response request.
Input items and output items from this response are automatically added to this conversation after this response completes.
[JsonInclude]
[JsonPropertyName("conversation")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string ConversationId { get; }Property Value
Include
Specify additional output data to include in the model response.
Currently supported values are:
- file_search_call.results: Include the search results of the file search tool call.
- message.input_image.image_url: Include image URLs from the computer call output.
- computer_call_output.output.image_url: Include image urls from the computer call output.
[JsonInclude]
[JsonPropertyName("include")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<string> Include { get; }Property Value
Input
Text, image, or file inputs to the model, used to generate a response.
[JsonInclude]
[JsonPropertyName("input")]
public IReadOnlyList<IResponseItem> Input { get; }Property Value
Instructions
Inserts a system (or developer) message as the first item in the model's context. When using along with PreviousResponseId, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
[JsonInclude]
[JsonPropertyName("instructions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Instructions { get; }Property Value
MaxOutputTokens
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
[JsonInclude]
[JsonPropertyName("max_output_tokens")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxOutputTokens { get; }Property Value
- int?
MaxToolCalls
The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.
[JsonInclude]
[JsonPropertyName("max_tool_calls")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxToolCalls { get; }Property Value
- int?
Metadata
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
[JsonInclude]
[JsonPropertyName("metadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyDictionary<string, string> Metadata { get; }Property Value
Model
Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.
[JsonInclude]
[JsonPropertyName("model")]
public string Model { get; }Property Value
ParallelToolCalls
Whether to allow the model to run tool calls in parallel.
[JsonInclude]
[JsonPropertyName("parallel_tool_calls")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? ParallelToolCalls { get; }Property Value
- bool?
PreviousResponseId
The unique ID of the previous response to the model. Use this to create multi-turn conversations.
[JsonInclude]
[JsonPropertyName("previous_response_id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string PreviousResponseId { get; }Property Value
Prompt
[JsonInclude]
[JsonPropertyName("prompt")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Prompt Prompt { get; }Property Value
PromptCacheKey
Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field.
[JsonInclude]
[JsonPropertyName("prompt_cache_key")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string PromptCacheKey { get; }Property Value
Reasoning
Configuration options for reasoning models.
[JsonInclude]
[JsonPropertyName("reasoning")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Reasoning Reasoning { get; }Property Value
Remarks
o-series models only!
SafetyIdentifier
A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information.
[JsonInclude]
[JsonPropertyName("safety_identifier")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string SafetyIdentifier { get; }Property Value
ServiceTier
Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:
- If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted.
- If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarantee.
- If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarantee.
- When not set, the default behavior is 'auto'.
 When this parameter is set, the response body will include the service_tier utilized.
[JsonInclude]
[JsonPropertyName("service_tier")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string ServiceTier { get; }Property Value
Store
Whether to store the generated model response for later retrieval via API.
[JsonInclude]
[JsonPropertyName("store")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Store { get; }Property Value
- bool?
Stream
If set to true, the model response data will be streamed to the client as it is generated using server-sent events.
[JsonInclude]
[JsonPropertyName("stream")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool Stream { get; }Property Value
Temperature
What sampling temperature to use, between 0 and 2.
Higher values like 0.8 will make the output more random, while lower values like 0.2 will
make it more focused and deterministic.
We generally recommend altering this or top_p but not both.
Defaults to 1
[JsonInclude]
[JsonPropertyName("temperature")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Temperature { get; }Property Value
TextResponseFormat
[JsonIgnore]
public TextResponseFormat TextResponseFormat { get; }Property Value
TextResponseFormatObject
Configuration options for a text response from the model. Can be plain text or structured JSON data.
[JsonInclude]
[JsonPropertyName("text")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TextResponseFormatObject TextResponseFormatObject { get; }Property Value
ToolChoice
How the model should select which tool (or tools) to use when generating a response. See the tools parameter to see how to specify which tools the model can call.
[JsonInclude]
[JsonPropertyName("tool_choice")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public object ToolChoice { get; }Property Value
Tools
A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
[JsonInclude]
[JsonPropertyName("tools")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<ITool> Tools { get; }Property Value
TopLogProbs
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.
[JsonInclude]
[JsonPropertyName("top_logprobs")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? TopLogProbs { get; }Property Value
- int?
TopP
An alternative to sampling with temperature, called nucleus sampling,
where the model considers the results of the tokens with top_p probability mass.
So 0.1 means only the tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or temperature but not both.
Defaults to 1
[JsonInclude]
[JsonPropertyName("top_p")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? TopP { get; }Property Value
Truncation
The truncation strategy to use for the model response.
- Auto: If the context of this response and previous ones exceeds the model's context window size,
the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.
- Disabled (default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
[JsonInclude]
[JsonPropertyName("truncation")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Truncation Truncation { get; }Property Value
User
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
[JsonInclude]
[JsonPropertyName("user")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string User { get; }Property Value
Operators
implicit operator CreateResponseRequest(string)
public static implicit operator CreateResponseRequest(string textInput)Parameters
- textInputstring