Responses
Create a Response
Creates a model response for the given input. Returns a response object or a stream of server-sent events.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.responses.create()
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
Show Parameters
Show Parameters
Fallback models to try if the primary model fails. Each entry specifies a model in provider/model format.
Penalize new tokens based on their frequency in the text so far. Between -2.0 and 2.0.
Input to the model: a string or an array of input items (messages, files, etc.).
System prompt / instructions for the model.
Maximum number of tokens in the response output.
Maximum number of tool call rounds in the agentic loop.
Developer-defined key-value pairs attached to the response (OpenAI spec: Map<string, string>). Non-string values are rejected with a 400.
The model to use in provider/model format (e.g. openai/gpt-4o). Use agent/<key> to invoke a pre-configured agent from the orq.ai platform.
Whether to allow parallel tool calls.
Penalize new tokens based on their presence in the text so far. Between -2.0 and 2.0.
The ID of a previous response to continue from. Requires store to be true (default) on the original response.
Key for prompt caching across requests.
Show Properties of retry
Show Properties of retry
Number of retries (1-5).
Safety identifier for content filtering.
Whether to persist the response (default: true). When false, the response cannot be retrieved later and previous_response_id will not work for follow-up requests.
If true, returns a stream of server-sent events.
Sampling temperature between 0 and 2.
Template engine for variable substitution in instructions. Defaults to the agent manifest’s engine when invoking an agent, otherwise text.
Configuration for text output.
Show Properties of text
Show Properties of text
The output format: plain text or structured JSON schema.
How the model should use the provided tools. Can be a string shorthand or a specific function selector.
Tools available to the model.
Number of most likely tokens to return at each position.
Nucleus sampling parameter.
Retrieve a Response
Retrieves a previously created response by its ID.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.responses.get(response_id="<id>")
# Handle response
print(res)
Show Parameters
Show Parameters
The request object to use for the request.
Show Response
Show Response
Array of input items (messages, function call outputs, etc.)
Developer-defined key-value pairs attached to the response (OpenAI spec: Map<string, string>).
Always “response”
Array of output items (messages, function calls, reasoning, etc.)
Text output configuration including format and verbosity
Tool choice setting: “auto”, “none”, “required”, or a specific function
Array of tool configurations used in this response
Show Properties of usage
Show Properties of usage
Cost (USD) of input tokens. Present when billing was computed for this response.
Show Properties of inputTokensDetails
Show Properties of inputTokensDetails
Cost (USD) of output tokens. Present when billing was computed for this response.
Total cost (USD) of the response. Present when billing was computed for this response.