Skip to content
NorthstarPlatformPricingLogin

Create Responses

responses.create(ResponseCreateParams**kwargs) -> ResponseCreateResponse
POST/v1/responses

Create Responses

ParametersExpand Collapse
input: Union[str, Iterable[InputUnionMember1]]
One of the following:
str
Iterable[InputUnionMember1]
One of the following:
class InputUnionMember1EasyInputMessageParam:

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role. Messages with the assistant role are presumed to have been generated by the model in previous interactions.

content: Union[str, Iterable[InputUnionMember1EasyInputMessageParamContentUnionMember1]]
One of the following:
str
Iterable[InputUnionMember1EasyInputMessageParamContentUnionMember1]
One of the following:
class ResponseInputTextParam:

A text input to the model.

text: str
type: Literal["input_text"]
class ResponseInputImageParam:

An image input to the model.

Learn about image inputs.

detail: Literal["low", "high", "auto"]
One of the following:
"low"
"high"
"auto"
type: Literal["input_image"]
file_id: Optional[str]
image_url: Optional[str]
class ResponseInputFileParam:

A file input to the model.

type: Literal["input_file"]
file_data: Optional[str]
file_id: Optional[str]
file_url: Optional[str]
filename: Optional[str]
role: Literal["user", "assistant", "system", "developer"]
One of the following:
"user"
"assistant"
"system"
"developer"
type: Optional[Literal["message"]]
class InputUnionMember1Message:

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role.

content: Iterable[InputUnionMember1MessageContent]
One of the following:
class ResponseInputTextParam:

A text input to the model.

text: str
type: Literal["input_text"]
class ResponseInputImageParam:

An image input to the model.

Learn about image inputs.

detail: Literal["low", "high", "auto"]
One of the following:
"low"
"high"
"auto"
type: Literal["input_image"]
file_id: Optional[str]
image_url: Optional[str]
class ResponseInputFileParam:

A file input to the model.

type: Literal["input_file"]
file_data: Optional[str]
file_id: Optional[str]
file_url: Optional[str]
filename: Optional[str]
role: Literal["user", "system", "developer"]
One of the following:
"user"
"system"
"developer"
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Optional[Literal["message"]]
class InputUnionMember1ResponseOutputMessageParam:

An output message from the model.

id: str
content: Iterable[InputUnionMember1ResponseOutputMessageParamContent]
One of the following:
class InputUnionMember1ResponseOutputMessageParamContentResponseOutputTextParam:

A text output from the model.

annotations: Iterable[InputUnionMember1ResponseOutputMessageParamContentResponseOutputTextParamAnnotation]
One of the following:
class AnnotationFileCitation:

A citation to a file.

file_id: str
filename: str
index: int
type: Literal["file_citation"]
class AnnotationURLCitation:

A citation for a web resource used to generate a model response.

end_index: int
start_index: int
title: str
type: Literal["url_citation"]
url: str
class AnnotationContainerFileCitation:

A citation for a container file used to generate a model response.

container_id: str
end_index: int
file_id: str
filename: str
start_index: int
type: Literal["container_file_citation"]
class AnnotationFilePath:

A path to a file.

file_id: str
index: int
type: Literal["file_path"]
text: str
type: Literal["output_text"]
logprobs: Optional[Iterable[LogprobParam]]
token: str
bytes: List[int]
logprob: float
top_logprobs: List[TopLogprob]
token: str
bytes: List[int]
logprob: float
class InputUnionMember1ResponseOutputMessageParamContentResponseOutputRefusalParam:

A refusal from the model.

refusal: str
type: Literal["refusal"]
role: Literal["assistant"]
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["message"]
class InputUnionMember1ResponseFileSearchToolCallParam:

The results of a file search tool call.

See the file search guide for more information.

id: str
queries: SequenceNotStr[str]
status: Literal["in_progress", "searching", "completed", 2 more]
One of the following:
"in_progress"
"searching"
"completed"
"incomplete"
"failed"
type: Literal["file_search_call"]
results: Optional[Iterable[InputUnionMember1ResponseFileSearchToolCallParamResult]]
attributes: Optional[Dict[str, Union[str, float, bool]]]
One of the following:
str
float
bool
file_id: Optional[str]
filename: Optional[str]
score: Optional[float]
text: Optional[str]
class InputUnionMember1ResponseComputerToolCallParam:

A tool call to a computer use tool.

See the computer use guide for more information.

id: str
action: InputUnionMember1ResponseComputerToolCallParamAction

A click action.

One of the following:
class ActionClick:

A click action.

button: Literal["left", "right", "wheel", 2 more]
One of the following:
"left"
"right"
"wheel"
"back"
"forward"
type: Literal["click"]
x: int
y: int
class ActionDoubleClick:

A double click action.

type: Literal["double_click"]
x: int
y: int
class ActionDrag:

A drag action.

path: List[Path]
x: int
y: int
type: Literal["drag"]
class ActionKeypress:

A collection of keypresses the model would like to perform.

keys: List[str]
type: Literal["keypress"]
class ActionMove:

A mouse move action.

type: Literal["move"]
x: int
y: int
class ActionScreenshot:

A screenshot action.

type: Literal["screenshot"]
class ActionScroll:

A scroll action.

scroll_x: int
scroll_y: int
type: Literal["scroll"]
x: int
y: int
class ActionType:

An action to type in text.

text: str
type: Literal["type"]
class ActionWait:

A wait action.

type: Literal["wait"]
class InputUnionMember1ResponseComputerToolCallParamActionActionPointAndType:

Click at a position then type text.

text: str
type: Literal["point_and_type"]
x: int
y: int
class InputUnionMember1ResponseComputerToolCallParamActionActionMouseDown:

Press and hold the left mouse button at a position.

type: Literal["mouse_down"]
x: int
y: int
class InputUnionMember1ResponseComputerToolCallParamActionActionMouseUp:

Release the left mouse button at a position.

type: Literal["mouse_up"]
x: int
y: int
class InputUnionMember1ResponseComputerToolCallParamActionActionKeyDown:

Press and hold a key.

keys: SequenceNotStr[str]
type: Literal["key_down"]
class InputUnionMember1ResponseComputerToolCallParamActionActionKeyUp:

Release a held key.

keys: SequenceNotStr[str]
type: Literal["key_up"]
call_id: str
pending_safety_checks: Iterable[InputUnionMember1ResponseComputerToolCallParamPendingSafetyCheck]
id: str
code: Optional[str]
message: Optional[str]
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["computer_call"]
class InputUnionMember1ComputerCallOutput:

The output of a computer tool call.

call_id: str
output: InputUnionMember1ComputerCallOutputOutput

A computer screenshot image used with the computer use tool.

type: Literal["computer_screenshot"]
file_id: Optional[str]
image_url: Optional[str]
type: Literal["computer_call_output"]
id: Optional[str]
acknowledged_safety_checks: Optional[Iterable[InputUnionMember1ComputerCallOutputAcknowledgedSafetyCheck]]
id: str
code: Optional[str]
message: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1ResponseFunctionWebSearchParam:

The results of a web search tool call.

See the web search guide for more information.

id: str
action: InputUnionMember1ResponseFunctionWebSearchParamAction

Action type "search" - Performs a web search query.

One of the following:
class InputUnionMember1ResponseFunctionWebSearchParamActionActionSearch:

Action type "search" - Performs a web search query.

query: str
type: Literal["search"]
queries: Optional[SequenceNotStr[str]]
sources: Optional[Iterable[ActionSearchSourceParam]]
type: Literal["url"]
url: str
class ActionOpenPage:

Action type "open_page" - Opens a specific URL from search results.

type: Literal["open_page"]
url: str
class ActionFind:

Action type "find": Searches for a pattern within a loaded page.

pattern: str
type: Literal["find"]
url: str
status: Literal["in_progress", "searching", "completed", "failed"]
One of the following:
"in_progress"
"searching"
"completed"
"failed"
type: Literal["web_search_call"]
class InputUnionMember1ResponseFunctionToolCallParam:

A tool call to run a function.

See the function calling guide for more information.

arguments: str
call_id: str
name: str
type: Literal["function_call"]
id: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1FunctionCallOutput:

The output of a function tool call.

call_id: str
output: Union[str, Iterable[InputUnionMember1FunctionCallOutputOutputUnionMember1]]
One of the following:
str
Iterable[InputUnionMember1FunctionCallOutputOutputUnionMember1]
One of the following:
class InputUnionMember1FunctionCallOutputOutputUnionMember1ResponseInputTextContentParam:

A text input to the model.

text: str
type: Literal["input_text"]
class InputUnionMember1FunctionCallOutputOutputUnionMember1ResponseInputImageContentParam:

An image input to the model.

Learn about image inputs

type: Literal["input_image"]
detail: Optional[Literal["low", "high", "auto"]]
One of the following:
"low"
"high"
"auto"
file_id: Optional[str]
image_url: Optional[str]
class InputUnionMember1FunctionCallOutputOutputUnionMember1ResponseInputFileContentParam:

A file input to the model.

type: Literal["input_file"]
file_data: Optional[str]
file_id: Optional[str]
file_url: Optional[str]
filename: Optional[str]
type: Literal["function_call_output"]
id: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1ResponseReasoningItemParam:

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your input to the Responses API for subsequent turns of a conversation if you are manually managing context.

id: str
summary: Iterable[SummaryParam]
text: str
type: Literal["summary_text"]
type: Literal["reasoning"]
content: Optional[Iterable[InputUnionMember1ResponseReasoningItemParamContent]]
text: str
type: Literal["reasoning_text"]
encrypted_content: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1ResponseCompactionItemParamParam:

A compaction item generated by the v1/responses/compact API.

encrypted_content: str
type: Literal["compaction"]
id: Optional[str]
class InputUnionMember1ImageGenerationCall:

An image generation request made by the model.

id: str
result: Optional[str]
status: Literal["in_progress", "completed", "generating", "failed"]
One of the following:
"in_progress"
"completed"
"generating"
"failed"
type: Literal["image_generation_call"]
class InputUnionMember1ResponseCodeInterpreterToolCallParam:

A tool call to run code.

id: str
code: Optional[str]
container_id: str
outputs: Optional[Iterable[InputUnionMember1ResponseCodeInterpreterToolCallParamOutput]]
One of the following:
class OutputLogs:

The logs output from the code interpreter.

logs: str
type: Literal["logs"]
class OutputImage:

The image output from the code interpreter.

type: Literal["image"]
url: str
status: Literal["in_progress", "completed", "incomplete", 2 more]
One of the following:
"in_progress"
"completed"
"incomplete"
"interpreting"
"failed"
type: Literal["code_interpreter_call"]
class InputUnionMember1LocalShellCall:

A tool call to run a command on the local shell.

id: str
action: InputUnionMember1LocalShellCallAction

Execute a shell command on the server.

command: SequenceNotStr[str]
env: Dict[str, str]
type: Literal["exec"]
timeout_ms: Optional[int]
user: Optional[str]
working_directory: Optional[str]
call_id: str
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["local_shell_call"]
class InputUnionMember1LocalShellCallOutput:

The output of a local shell tool call.

id: str
output: str
type: Literal["local_shell_call_output"]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1ShellCall:

A tool representing a request to execute one or more shell commands.

action: InputUnionMember1ShellCallAction

The shell commands and limits that describe how to run the tool call.

commands: SequenceNotStr[str]
max_output_length: Optional[int]
timeout_ms: Optional[int]
call_id: str
type: Literal["shell_call"]
id: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1ShellCallOutput:

The streamed output items emitted by a shell tool call.

call_id: str
output: Iterable[InputUnionMember1ShellCallOutputOutput]
outcome: InputUnionMember1ShellCallOutputOutputOutcome

Indicates that the shell call exceeded its configured time limit.

One of the following:
class InputUnionMember1ShellCallOutputOutputOutcomeOutcomeTimeout:

Indicates that the shell call exceeded its configured time limit.

type: Literal["timeout"]
class InputUnionMember1ShellCallOutputOutputOutcomeOutcomeExit:

Indicates that the shell commands finished and returned an exit code.

exit_code: int
type: Literal["exit"]
stderr: str
stdout: str
type: Literal["shell_call_output"]
id: Optional[str]
max_output_length: Optional[int]
class InputUnionMember1ApplyPatchCall:

A tool call representing a request to create, delete, or update files using diff patches.

call_id: str
operation: InputUnionMember1ApplyPatchCallOperation

Instruction for creating a new file via the apply_patch tool.

One of the following:
class InputUnionMember1ApplyPatchCallOperationApplyPatchCallOperationCreateFile:

Instruction for creating a new file via the apply_patch tool.

diff: str
path: str
type: Literal["create_file"]
class InputUnionMember1ApplyPatchCallOperationApplyPatchCallOperationDeleteFile:

Instruction for deleting an existing file via the apply_patch tool.

path: str
type: Literal["delete_file"]
class InputUnionMember1ApplyPatchCallOperationApplyPatchCallOperationUpdateFile:

Instruction for updating an existing file via the apply_patch tool.

diff: str
path: str
type: Literal["update_file"]
status: Literal["in_progress", "completed"]
One of the following:
"in_progress"
"completed"
type: Literal["apply_patch_call"]
id: Optional[str]
class InputUnionMember1ApplyPatchCallOutput:

The streamed output emitted by an apply patch tool call.

call_id: str
status: Literal["completed", "failed"]
One of the following:
"completed"
"failed"
type: Literal["apply_patch_call_output"]
id: Optional[str]
output: Optional[str]
class InputUnionMember1McpListTools:

A list of tools available on an MCP server.

id: str
server_label: str
tools: Iterable[InputUnionMember1McpListToolsTool]
input_schema: object
name: str
annotations: Optional[object]
description: Optional[str]
type: Literal["mcp_list_tools"]
error: Optional[str]
class McpApprovalRequest:

A request for human approval of a tool invocation.

id: str
arguments: str
name: str
server_label: str
type: Literal["mcp_approval_request"]
class InputUnionMember1McpApprovalResponse:

A response to an MCP approval request.

approval_request_id: str
approve: bool
type: Literal["mcp_approval_response"]
id: Optional[str]
reason: Optional[str]
class InputUnionMember1McpCall:

An invocation of a tool on an MCP server.

id: str
arguments: str
name: str
server_label: str
type: Literal["mcp_call"]
approval_request_id: Optional[str]
error: Optional[str]
output: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete", 2 more]]
One of the following:
"in_progress"
"completed"
"incomplete"
"calling"
"failed"
class InputUnionMember1ResponseCustomToolCallOutputParam:

The output of a custom tool call from your code, being sent back to the model.

call_id: str
output: Union[str, Iterable[InputUnionMember1ResponseCustomToolCallOutputParamOutputUnionMember1]]
One of the following:
str
Iterable[InputUnionMember1ResponseCustomToolCallOutputParamOutputUnionMember1]
One of the following:
class ResponseInputTextParam:

A text input to the model.

text: str
type: Literal["input_text"]
class ResponseInputImageParam:

An image input to the model.

Learn about image inputs.

detail: Literal["low", "high", "auto"]
One of the following:
"low"
"high"
"auto"
type: Literal["input_image"]
file_id: Optional[str]
image_url: Optional[str]
class ResponseInputFileParam:

A file input to the model.

type: Literal["input_file"]
file_data: Optional[str]
file_id: Optional[str]
file_url: Optional[str]
filename: Optional[str]
type: Literal["custom_tool_call_output"]
id: Optional[str]
class InputUnionMember1ResponseCustomToolCallParam:

A call to a custom tool created by the model.

call_id: str
input: str
name: str
type: Literal["custom_tool_call"]
id: Optional[str]
class InputUnionMember1ItemReference:

An internal identifier for an item to reference.

id: str
type: Optional[Literal["item_reference"]]
class InputUnionMember1ResponseOutputMessage:

An output message from the model.

id: str
content: Iterable[InputUnionMember1ResponseOutputMessageContent]
One of the following:
class InputUnionMember1ResponseOutputMessageContentResponseOutputText:

A text output from the model.

annotations: Iterable[InputUnionMember1ResponseOutputMessageContentResponseOutputTextAnnotation]
One of the following:
class AnnotationFileCitation:

A citation to a file.

file_id: str
filename: str
index: int
type: Literal["file_citation"]
class AnnotationURLCitation:

A citation for a web resource used to generate a model response.

end_index: int
start_index: int
title: str
type: Literal["url_citation"]
url: str
class AnnotationContainerFileCitation:

A citation for a container file used to generate a model response.

container_id: str
end_index: int
file_id: str
filename: str
start_index: int
type: Literal["container_file_citation"]
class AnnotationFilePath:

A path to a file.

file_id: str
index: int
type: Literal["file_path"]
text: str
type: Literal["output_text"]
logprobs: Optional[Iterable[LogprobParam]]
token: str
bytes: List[int]
logprob: float
top_logprobs: List[TopLogprob]
token: str
bytes: List[int]
logprob: float
class InputUnionMember1ResponseOutputMessageContentResponseOutputRefusal:

A refusal from the model.

refusal: str
type: Literal["refusal"]
role: Literal["assistant"]
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["message"]
class InputUnionMember1ResponseFileSearchToolCall:

The results of a file search tool call.

See the file search guide for more information.

id: str
queries: SequenceNotStr[str]
status: Literal["in_progress", "searching", "completed", 2 more]
One of the following:
"in_progress"
"searching"
"completed"
"incomplete"
"failed"
type: Literal["file_search_call"]
results: Optional[Iterable[InputUnionMember1ResponseFileSearchToolCallResult]]
attributes: Optional[Dict[str, Union[str, float, bool]]]
One of the following:
str
float
bool
file_id: Optional[str]
filename: Optional[str]
score: Optional[float]
text: Optional[str]
class InputUnionMember1ResponseFunctionToolCall:

A tool call to run a function.

See the function calling guide for more information.

arguments: str
call_id: str
name: str
type: Literal["function_call"]
id: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1ResponseFunctionWebSearch:

The results of a web search tool call.

See the web search guide for more information.

id: str
action: InputUnionMember1ResponseFunctionWebSearchAction

Action type "search" - Performs a web search query.

One of the following:
class InputUnionMember1ResponseFunctionWebSearchActionActionSearch:

Action type "search" - Performs a web search query.

query: str
type: Literal["search"]
queries: Optional[SequenceNotStr[str]]
sources: Optional[Iterable[ActionSearchSourceParam]]
type: Literal["url"]
url: str
class ActionOpenPage:

Action type "open_page" - Opens a specific URL from search results.

type: Literal["open_page"]
url: str
class ActionFind:

Action type "find": Searches for a pattern within a loaded page.

pattern: str
type: Literal["find"]
url: str
status: Literal["in_progress", "searching", "completed", "failed"]
One of the following:
"in_progress"
"searching"
"completed"
"failed"
type: Literal["web_search_call"]
class InputUnionMember1ResponseComputerToolCall:

A tool call to a computer use tool.

See the computer use guide for more information.

id: str
action: InputUnionMember1ResponseComputerToolCallAction

A click action.

One of the following:
class ActionClick:

A click action.

button: Literal["left", "right", "wheel", 2 more]
One of the following:
"left"
"right"
"wheel"
"back"
"forward"
type: Literal["click"]
x: int
y: int
class ActionDoubleClick:

A double click action.

type: Literal["double_click"]
x: int
y: int
class ActionDrag:

A drag action.

path: List[Path]
x: int
y: int
type: Literal["drag"]
class ActionKeypress:

A collection of keypresses the model would like to perform.

keys: List[str]
type: Literal["keypress"]
class ActionMove:

A mouse move action.

type: Literal["move"]
x: int
y: int
class ActionScreenshot:

A screenshot action.

type: Literal["screenshot"]
class ActionScroll:

A scroll action.

scroll_x: int
scroll_y: int
type: Literal["scroll"]
x: int
y: int
class ActionType:

An action to type in text.

text: str
type: Literal["type"]
class ActionWait:

A wait action.

type: Literal["wait"]
class InputUnionMember1ResponseComputerToolCallActionActionPointAndType:

Click at a position then type text.

text: str
type: Literal["point_and_type"]
x: int
y: int
class InputUnionMember1ResponseComputerToolCallActionActionMouseDown:

Press and hold the left mouse button at a position.

type: Literal["mouse_down"]
x: int
y: int
class InputUnionMember1ResponseComputerToolCallActionActionMouseUp:

Release the left mouse button at a position.

type: Literal["mouse_up"]
x: int
y: int
class InputUnionMember1ResponseComputerToolCallActionActionKeyDown:

Press and hold a key.

keys: SequenceNotStr[str]
type: Literal["key_down"]
class InputUnionMember1ResponseComputerToolCallActionActionKeyUp:

Release a held key.

keys: SequenceNotStr[str]
type: Literal["key_up"]
call_id: str
pending_safety_checks: Iterable[InputUnionMember1ResponseComputerToolCallPendingSafetyCheck]
id: str
code: Optional[str]
message: Optional[str]
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["computer_call"]
class InputUnionMember1ResponseReasoningItem:

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your input to the Responses API for subsequent turns of a conversation if you are manually managing context.

id: str
summary: Iterable[SummaryParam]
text: str
type: Literal["summary_text"]
type: Literal["reasoning"]
content: Optional[Iterable[InputUnionMember1ResponseReasoningItemContent]]
text: str
type: Literal["reasoning_text"]
encrypted_content: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class InputUnionMember1ResponseCompactionItem:

A compaction item generated by the v1/responses/compact API.

id: str
encrypted_content: str
type: Literal["compaction"]
created_by: Optional[str]
class InputUnionMember1ImageGenerationCall:

An image generation request made by the model.

id: str
status: Literal["in_progress", "completed", "generating", "failed"]
One of the following:
"in_progress"
"completed"
"generating"
"failed"
type: Literal["image_generation_call"]
result: Optional[str]
class InputUnionMember1ResponseCodeInterpreterToolCall:

A tool call to run code.

id: str
container_id: str
status: Literal["in_progress", "completed", "incomplete", 2 more]
One of the following:
"in_progress"
"completed"
"incomplete"
"interpreting"
"failed"
type: Literal["code_interpreter_call"]
code: Optional[str]
outputs: Optional[Iterable[InputUnionMember1ResponseCodeInterpreterToolCallOutput]]
One of the following:
class OutputLogs:

The logs output from the code interpreter.

logs: str
type: Literal["logs"]
class OutputImage:

The image output from the code interpreter.

type: Literal["image"]
url: str
class InputUnionMember1LocalShellCall:

A tool call to run a command on the local shell.

id: str
action: InputUnionMember1LocalShellCallAction

Execute a shell command on the server.

command: SequenceNotStr[str]
env: Dict[str, str]
type: Literal["exec"]
timeout_ms: Optional[int]
user: Optional[str]
working_directory: Optional[str]
call_id: str
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["local_shell_call"]
class InputUnionMember1ResponseFunctionShellToolCall:

A tool call that executes one or more shell commands in a managed environment.

id: str
action: InputUnionMember1ResponseFunctionShellToolCallAction

The shell commands and limits that describe how to run the tool call.

commands: SequenceNotStr[str]
max_output_length: Optional[int]
timeout_ms: Optional[int]
call_id: str
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["shell_call"]
created_by: Optional[str]
class InputUnionMember1ResponseFunctionShellToolCallOutput:

The output of a shell tool call that was emitted.

id: str
call_id: str
output: Iterable[InputUnionMember1ResponseFunctionShellToolCallOutputOutput]
outcome: InputUnionMember1ResponseFunctionShellToolCallOutputOutputOutcome

Indicates that the shell call exceeded its configured time limit.

One of the following:
class InputUnionMember1ResponseFunctionShellToolCallOutputOutputOutcomeOutputOutcomeTimeout:

Indicates that the shell call exceeded its configured time limit.

type: Literal["timeout"]
class InputUnionMember1ResponseFunctionShellToolCallOutputOutputOutcomeOutputOutcomeExit:

Indicates that the shell commands finished and returned an exit code.

exit_code: int
type: Literal["exit"]
stderr: str
stdout: str
created_by: Optional[str]
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["shell_call_output"]
created_by: Optional[str]
max_output_length: Optional[int]
class InputUnionMember1ResponseApplyPatchToolCall:

A tool call that applies file diffs by creating, deleting, or updating files.

id: str
call_id: str
operation: InputUnionMember1ResponseApplyPatchToolCallOperation

Instruction describing how to create a file via the apply_patch tool.

One of the following:
class InputUnionMember1ResponseApplyPatchToolCallOperationOperationCreateFile:

Instruction describing how to create a file via the apply_patch tool.

diff: str
path: str
type: Literal["create_file"]
class InputUnionMember1ResponseApplyPatchToolCallOperationOperationDeleteFile:

Instruction describing how to delete a file via the apply_patch tool.

path: str
type: Literal["delete_file"]
class InputUnionMember1ResponseApplyPatchToolCallOperationOperationUpdateFile:

Instruction describing how to update a file via the apply_patch tool.

diff: str
path: str
type: Literal["update_file"]
status: Literal["in_progress", "completed"]
One of the following:
"in_progress"
"completed"
type: Literal["apply_patch_call"]
created_by: Optional[str]
class InputUnionMember1ResponseApplyPatchToolCallOutput:

The output emitted by an apply patch tool call.

id: str
call_id: str
status: Literal["completed", "failed"]
One of the following:
"completed"
"failed"
type: Literal["apply_patch_call_output"]
created_by: Optional[str]
output: Optional[str]
class InputUnionMember1McpCall:

An invocation of a tool on an MCP server.

id: str
arguments: str
name: str
server_label: str
type: Literal["mcp_call"]
approval_request_id: Optional[str]
error: Optional[str]
output: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete", 2 more]]
One of the following:
"in_progress"
"completed"
"incomplete"
"calling"
"failed"
class InputUnionMember1McpListTools:

A list of tools available on an MCP server.

id: str
server_label: str
tools: Iterable[InputUnionMember1McpListToolsTool]
input_schema: object
name: str
annotations: Optional[object]
description: Optional[str]
type: Literal["mcp_list_tools"]
error: Optional[str]
class McpApprovalRequest:

A request for human approval of a tool invocation.

id: str
arguments: str
name: str
server_label: str
type: Literal["mcp_approval_request"]
class InputUnionMember1ResponseCustomToolCall:

A call to a custom tool created by the model.

call_id: str
input: str
name: str
type: Literal["custom_tool_call"]
id: Optional[str]
background: Optional[bool]
cache_salt: Optional[str]

If specified, the prefix cache will be salted with the provided string to prevent an attacker to guess prompts in multi-user environments. The salt should be random, protected from access by 3rd parties, and long enough to be unpredictable (e.g., 43 characters base64-encoded, corresponding to 256 bit).

enable_response_messages: Optional[bool]

Dictates whether or not to return messages as part of the response object. Currently only supported fornon-background and gpt-oss only.

include: Optional[List[Literal["code_interpreter_call.outputs", "computer_call_output.output.image_url", "file_search_call.results", 3 more]]]
One of the following:
"code_interpreter_call.outputs"
"computer_call_output.output.image_url"
"file_search_call.results"
"message.input_image.image_url"
"message.output_text.logprobs"
"reasoning.encrypted_content"
include_stop_str_in_output: Optional[bool]
instructions: Optional[str]
logit_bias: Optional[Dict[str, float]]
max_output_tokens: Optional[int]
max_tool_calls: Optional[int]
metadata: Optional[Dict[str, str]]
mm_processor_kwargs: Optional[Dict[str, object]]

Additional kwargs to pass to the HF processor.

model: Optional[str]
parallel_tool_calls: Optional[bool]
previous_input_messages: Optional[Iterable[PreviousInputMessage]]
One of the following:
class Message:
author: Author
role: Literal["user", "assistant", "system", 2 more]

The role of a message author (mirrors chat::Role).

One of the following:
"user"
"assistant"
"system"
"developer"
"tool"
name: Optional[str]
channel: Optional[str]
content: Optional[List[object]]
content_type: Optional[str]
recipient: Optional[str]
Dict[str, object]
previous_response_id: Optional[str]
priority: Optional[int]

The priority of the request (lower means earlier handling; default: 0). Any priority other than 0 will raise an error if the served model does not use priority scheduling.

prompt: Optional[Prompt]

Reference to a prompt template and its variables. Learn more.

id: str
variables: Optional[Dict[str, PromptVariables]]
One of the following:
str
class PromptVariablesResponseInputText:

A text input to the model.

text: str
type: Literal["input_text"]
class PromptVariablesResponseInputImage:

An image input to the model.

Learn about image inputs.

detail: Literal["low", "high", "auto"]
One of the following:
"low"
"high"
"auto"
type: Literal["input_image"]
file_id: Optional[str]
image_url: Optional[str]
class PromptVariablesResponseInputFile:

A file input to the model.

type: Literal["input_file"]
file_data: Optional[str]
file_id: Optional[str]
file_url: Optional[str]
filename: Optional[str]
version: Optional[str]
prompt_cache_key: Optional[str]

A key that was used to read from or write to the prompt cache.Note: This field has not been implemented yet and vLLM will ignore it.

reasoning: Optional[Reasoning]

gpt-5 and o-series models only

Configuration options for reasoning models.

effort: Optional[Literal["none", "minimal", "low", 3 more]]
One of the following:
"none"
"minimal"
"low"
"medium"
"high"
"xhigh"
generate_summary: Optional[Literal["auto", "concise", "detailed"]]
One of the following:
"auto"
"concise"
"detailed"
summary: Optional[Literal["auto", "concise", "detailed"]]
One of the following:
"auto"
"concise"
"detailed"
request_id: Optional[str]

The request_id related to this request. If the caller does not set it, a random_uuid will be generated. This id is used through out the inference process and return in response.

service_tier: Optional[Literal["auto", "default", "flex", 2 more]]
One of the following:
"auto"
"default"
"flex"
"scale"
"priority"
skip_special_tokens: Optional[bool]
store: Optional[bool]
stream: Optional[bool]
temperature: Optional[float]
text: Optional[Text]

Configuration options for a text response from the model.

Can be plain text or structured JSON data. Learn more:

format: Optional[TextFormat]

Default response format. Used to generate text responses.

One of the following:
class TextFormatResponseFormatText:

Default response format. Used to generate text responses.

type: Literal["text"]
class TextFormatResponseFormatTextJsonSchemaConfig:

JSON Schema response format.

Used to generate structured JSON responses. Learn more about Structured Outputs.

name: str
schema: Dict[str, object]
type: Literal["json_schema"]
description: Optional[str]
strict: Optional[bool]
class TextFormatResponseFormatJsonObject:

JSON object response format.

An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

type: Literal["json_object"]
verbosity: Optional[Literal["low", "medium", "high"]]
One of the following:
"low"
"medium"
"high"
tool_choice: Optional[ToolChoice]

Constrains the tools available to the model to a pre-defined set.

One of the following:
Literal["none", "auto", "required"]
One of the following:
"none"
"auto"
"required"
class ToolChoiceToolChoiceAllowed:

Constrains the tools available to the model to a pre-defined set.

mode: Literal["auto", "required"]
One of the following:
"auto"
"required"
tools: Iterable[Dict[str, object]]
type: Literal["allowed_tools"]
class ToolChoiceToolChoiceTypes:

Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.

type: Literal["computer_use_preview"]
class ToolChoiceToolChoiceFunction:

Use this option to force the model to call a specific function.

name: str
type: Literal["function"]
class ToolChoiceToolChoiceCustom:

Use this option to force the model to call a specific custom tool.

name: str
type: Literal["custom"]
tools: Optional[Iterable[Tool]]
One of the following:
class ToolFunctionTool:

Defines a function in your own code the model can choose to call.

Learn more about function calling.

name: str
type: Literal["function"]
description: Optional[str]
parameters: Optional[Dict[str, object]]
strict: Optional[bool]
class ToolCustomTool:

A custom tool that processes input using a specified format.

Learn more about custom tools

name: str
type: Literal["custom"]
description: Optional[str]
format: Optional[ToolCustomToolFormat]

Unconstrained free-form text.

One of the following:
class ToolCustomToolFormatText:

Unconstrained free-form text.

type: Literal["text"]
class ToolCustomToolFormatGrammar:

A grammar defined by the user.

definition: str
syntax: Literal["lark", "regex"]
One of the following:
"lark"
"regex"
type: Literal["grammar"]
class ToolComputerTool:

A tool that controls a virtual computer.

Learn more about the computer tool.

display_height: int
display_width: int
environment: Literal["windows", "mac", "linux", 2 more]
One of the following:
"windows"
"mac"
"linux"
"ubuntu"
"browser"
type: Literal["computer_use_preview"]
top_k: Optional[int]
top_logprobs: Optional[int]
top_p: Optional[float]
truncation: Optional[Literal["auto", "disabled"]]
One of the following:
"auto"
"disabled"
user: Optional[str]
ReturnsExpand Collapse
class ResponseCreateResponse:

The response object returned by the Responses API.

id: str
created_at: int
model: str
object: Literal["response"]
output: List[Output]
One of the following:
class OutputResponseOutputMessage:

An output message from the model.

id: str
content: List[OutputResponseOutputMessageContent]
One of the following:
class OutputResponseOutputMessageContentResponseOutputText:

A text output from the model.

annotations: List[OutputResponseOutputMessageContentResponseOutputTextAnnotation]
One of the following:
class AnnotationFileCitation:

A citation to a file.

file_id: str
filename: str
index: int
type: Literal["file_citation"]
class AnnotationURLCitation:

A citation for a web resource used to generate a model response.

end_index: int
start_index: int
title: str
type: Literal["url_citation"]
url: str
class AnnotationContainerFileCitation:

A citation for a container file used to generate a model response.

container_id: str
end_index: int
file_id: str
filename: str
start_index: int
type: Literal["container_file_citation"]
class AnnotationFilePath:

A path to a file.

file_id: str
index: int
type: Literal["file_path"]
text: str
type: Literal["output_text"]
logprobs: Optional[List[Logprob]]
token: str
bytes: List[int]
logprob: float
top_logprobs: List[TopLogprob]
token: str
bytes: List[int]
logprob: float
class OutputResponseOutputMessageContentResponseOutputRefusal:

A refusal from the model.

refusal: str
type: Literal["refusal"]
role: Literal["assistant"]
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["message"]
class OutputResponseFunctionToolCall:

A tool call to run a function.

See the function calling guide for more information.

arguments: str
call_id: str
name: str
type: Literal["function_call"]
id: Optional[str]
status: Optional[Literal["in_progress", "completed", "incomplete"]]
One of the following:
"in_progress"
"completed"
"incomplete"
class OutputResponseComputerToolCall:

A tool call to a computer use tool.

See the computer use guide for more information.

id: str
action: OutputResponseComputerToolCallAction

A click action.

One of the following:
class ActionClick:

A click action.

button: Literal["left", "right", "wheel", 2 more]
One of the following:
"left"
"right"
"wheel"
"back"
"forward"
type: Literal["click"]
x: int
y: int
class ActionDoubleClick:

A double click action.

type: Literal["double_click"]
x: int
y: int
class ActionDrag:

A drag action.

path: List[Path]
x: int
y: int
type: Literal["drag"]
class ActionKeypress:

A collection of keypresses the model would like to perform.

keys: List[str]
type: Literal["keypress"]
class ActionMove:

A mouse move action.

type: Literal["move"]
x: int
y: int
class ActionScreenshot:

A screenshot action.

type: Literal["screenshot"]
class ActionScroll:

A scroll action.

scroll_x: int
scroll_y: int
type: Literal["scroll"]
x: int
y: int
class ActionType:

An action to type in text.

text: str
type: Literal["type"]
class ActionWait:

A wait action.

type: Literal["wait"]
class OutputResponseComputerToolCallActionActionPointAndType:

Click at a position then type text.

text: str
type: Literal["point_and_type"]
x: int
y: int
class OutputResponseComputerToolCallActionActionMouseDown:

Press and hold the left mouse button at a position.

type: Literal["mouse_down"]
x: int
y: int
class OutputResponseComputerToolCallActionActionMouseUp:

Release the left mouse button at a position.

type: Literal["mouse_up"]
x: int
y: int
class OutputResponseComputerToolCallActionActionKeyDown:

Press and hold a key.

keys: List[str]
type: Literal["key_down"]
class OutputResponseComputerToolCallActionActionKeyUp:

Release a held key.

keys: List[str]
type: Literal["key_up"]
call_id: str
pending_safety_checks: List[OutputResponseComputerToolCallPendingSafetyCheck]
id: str
code: Optional[str]
message: Optional[str]
status: Literal["in_progress", "completed", "incomplete"]
One of the following:
"in_progress"
"completed"
"incomplete"
type: Literal["computer_call"]
Dict[str, object]
status: Literal["completed", "failed", "in_progress", 2 more]
One of the following:
"completed"
"failed"
"in_progress"
"incomplete"
"cancelled"
error: Optional[Dict[str, object]]
tools: Optional[List[Dict[str, object]]]
usage: Optional[Usage]
input_tokens: Optional[int]
output_tokens: Optional[int]
total_tokens: Optional[int]

Create Responses

import os
from tzafon import Lightcone

client = Lightcone(
    api_key=os.environ.get("TZAFON_API_KEY"),  # This is the default and can be omitted
)
response = client.responses.create(
    input="string",
)
print(response.id)
{
  "id": "id",
  "created_at": 0,
  "model": "model",
  "object": "response",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "annotations": [
            {
              "file_id": "file_id",
              "filename": "filename",
              "index": 0,
              "type": "file_citation"
            }
          ],
          "text": "text",
          "type": "output_text",
          "logprobs": [
            {
              "token": "token",
              "bytes": [
                0
              ],
              "logprob": 0,
              "top_logprobs": [
                {
                  "token": "token",
                  "bytes": [
                    0
                  ],
                  "logprob": 0
                }
              ]
            }
          ]
        }
      ],
      "role": "assistant",
      "status": "in_progress",
      "type": "message"
    }
  ],
  "status": "completed",
  "error": {
    "foo": "bar"
  },
  "tools": [
    {
      "foo": "bar"
    }
  ],
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0
  }
}
Returns Examples
{
  "id": "id",
  "created_at": 0,
  "model": "model",
  "object": "response",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "annotations": [
            {
              "file_id": "file_id",
              "filename": "filename",
              "index": 0,
              "type": "file_citation"
            }
          ],
          "text": "text",
          "type": "output_text",
          "logprobs": [
            {
              "token": "token",
              "bytes": [
                0
              ],
              "logprob": 0,
              "top_logprobs": [
                {
                  "token": "token",
                  "bytes": [
                    0
                  ],
                  "logprob": 0
                }
              ]
            }
          ]
        }
      ],
      "role": "assistant",
      "status": "in_progress",
      "type": "message"
    }
  ],
  "status": "completed",
  "error": {
    "foo": "bar"
  },
  "tools": [
    {
      "foo": "bar"
    }
  ],
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0
  }
}