Create response endpoint - OpenResponses API
const url = 'https://example.com/v1/responses';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"background":true,"dry_allowed_length":1,"dry_base":1,"dry_multiplier":1,"dry_sequence_breakers":["example"],"frequency_penalty":1,"grammar":{"type":"regex","value":"example"},"include":["file_search_call.results"],"input":[{"content":[{"text":"example","type":"input_text"}],"role":"example","type":"message"}],"instructions":"example","logit_bias":"example","logprobs":true,"max_output_tokens":1,"max_tool_calls":1,"metadata":"example","min_p":1,"model":"example","n":1,"parallel_tool_calls":true,"presence_penalty":1,"previous_response_id":"example","reasoning":{"effort":"none","summary":"concise"},"repetition_penalty":1,"response_format":{"type":"text"},"stop":"example","store":true,"stream":true,"stream_options":{"include_usage":true},"temperature":1,"text":{"format":{"type":"text"}},"tool_choice":"none","tools":[{"function":{"description":"example","name":"example","parameters":"example","strict":true},"type":"function"}],"top_k":1,"top_logprobs":1,"top_p":1,"truncation":"auto","web_search_options":{"extract_description":"example","search_context_size":"low","search_description":"example","user_location":{"approximate":{"city":"example","country":"example","region":"example","timezone":"example"},"type":"approximate"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/responses \ --header 'Content-Type: application/json' \ --data '{ "background": true, "dry_allowed_length": 1, "dry_base": 1, "dry_multiplier": 1, "dry_sequence_breakers": [ "example" ], "frequency_penalty": 1, "grammar": { "type": "regex", "value": "example" }, "include": [ "file_search_call.results" ], "input": [ { "content": [ { "text": "example", "type": "input_text" } ], "role": "example", "type": "message" } ], "instructions": "example", "logit_bias": "example", "logprobs": true, "max_output_tokens": 1, "max_tool_calls": 1, "metadata": "example", "min_p": 1, "model": "example", "n": 1, "parallel_tool_calls": true, "presence_penalty": 1, "previous_response_id": "example", "reasoning": { "effort": "none", "summary": "concise" }, "repetition_penalty": 1, "response_format": { "type": "text" }, "stop": "example", "store": true, "stream": true, "stream_options": { "include_usage": true }, "temperature": 1, "text": { "format": { "type": "text" } }, "tool_choice": "none", "tools": [ { "function": { "description": "example", "name": "example", "parameters": "example", "strict": true }, "type": "function" } ], "top_k": 1, "top_logprobs": 1, "top_p": 1, "truncation": "auto", "web_search_options": { "extract_description": "example", "search_context_size": "low", "search_description": "example", "user_location": { "approximate": { "city": "example", "country": "example", "region": "example", "timezone": "example" }, "type": "approximate" } } }'Request Body required
Section titled “Request Body required ”OpenResponses API create request
object
Whether to run the request in background (async)
DRY allowed length (mistral.rs extension)
DRY base (mistral.rs extension)
DRY multiplier (mistral.rs extension)
DRY sequence breakers (mistral.rs extension)
Frequency penalty (-2.0 to 2.0)
object
object
object
object
Top-level grammar configuration for LLGuidance
object
List of grammar configurations
Grammar configuration with lexer settings
object
The JSON schema that the grammar should generate
The Lark grammar that the grammar should generate
The name of this grammar, can be used in GenGrammar nodes
Maximum number of tokens to generate
object
Specifies additional content to include in the response
Simple text input
Array of input items (OpenResponses format)
object
object
object
object
Additional instructions that guide the model’s behavior
Logit bias for token manipulation
Whether to return log probabilities
Maximum number of output tokens to generate
Maximum number of tool calls allowed.
NOTE: This parameter is not supported. Setting any value will return an error as mistral.rs does not support limiting the number of tool calls.
User-provided metadata (up to 16 key-value pairs)
Min-p sampling (mistral.rs extension)
The model to use for this request
Number of completions to generate
Whether to allow parallel tool calls.
NOTE: Only true (default) or None is supported. Setting this to false
will return an error as mistral.rs does not support disabling parallel tool calls.
Presence penalty (-2.0 to 2.0)
ID of a previous response for multi-turn conversations
Repetition penalty (mistral.rs extension)
Multiple possible stop sequences
Single stop sequence
Whether to store the response for later retrieval
Whether to stream the response using server-sent events
Temperature for sampling (0-2)
Text output configuration
object
Plain text output
object
JSON output with optional schema
object
Name for the schema
JSON Schema definition
Whether to use strict schema validation
JSON object output
object
Disallow selection of tools.
Allow automatic selection of any given tool, or none.
Force selection of a given tool.
object
Force selection of a given tool.
object
Function definition for a tool
object
When true, the tool’s parameters JSON schema is enforced on the
generated arguments via constrained decoding (llguidance).
Type of tool
Tool definitions available for the model to call
Tool definition
object
Function definition for a tool
object
When true, the tool’s parameters JSON schema is enforced on the
generated arguments via constrained decoding (llguidance).
Type of tool
Top-k sampling (mistral.rs extension)
Number of top log probabilities to return
Top-p (nucleus) sampling parameter (0-1)
Web search options (mistral.rs extension)
object
Override the description for the extraction tool.
Override the description for the search tool.
Responses
Section titled “ Responses ”Response created