Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai python Response Custom Tool Call Output

From Leeroopedia
Knowledge Sources
Domains API_Types, Responses_API
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete response type representing the output of a custom tool call sent back to the model, provided by the openai-python SDK.

Description

ResponseCustomToolCallOutput is a Pydantic model representing the output from a custom tool call in your code that is sent back to the model. It contains a call_id to map this output to the original tool call, an output field that can be either a plain string or a list of OutputOutputContentList items (a discriminated union of ResponseInputText, ResponseInputImage, and ResponseInputFile), a fixed type of "custom_tool_call_output", and an optional id field for the platform identifier. This type is auto-generated from the OpenAI OpenAPI specification by Stainless.

Usage

Import ResponseCustomToolCallOutput when constructing input items for a follow-up Responses API request that provides the output from a previously invoked custom tool call.

Code Reference

Source Location

Signature

class ResponseCustomToolCallOutput(BaseModel):
    """The output of a custom tool call from your code, being sent back to the model."""

    call_id: str
    output: Union[str, List[OutputOutputContentList]]
    type: Literal["custom_tool_call_output"]
    id: Optional[str] = None

Import

from openai.types.responses import ResponseCustomToolCallOutput

I/O Contract

Fields

Name Type Required Description
call_id str Yes The call ID, used to map this output to a custom tool call.
output Union[str, List[OutputOutputContentList]] Yes The output from the custom tool call. Can be a string or a list of content items (text, image, or file).
type Literal["custom_tool_call_output"] Yes The type of the output. Always "custom_tool_call_output".
id Optional[str] No The unique ID of the custom tool call output in the OpenAI platform.

Usage Examples

from openai.types.responses import ResponseCustomToolCallOutput

# Provide string output for a custom tool call
tool_output = ResponseCustomToolCallOutput(
    call_id="call_abc123",
    output="The result of the custom tool execution.",
    type="custom_tool_call_output",
)

# Include in a follow-up request
response = client.responses.create(
    model="gpt-4o",
    input=[tool_output],
    previous_response_id="resp_xyz",
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment