Skip to content

Types

All types are dataclasses with slots=True.

Response

codex_open_client.Response(id: str, model: str, output: list[OutputItem], status: Literal['completed', 'failed', 'incomplete'] | None = None, usage: Usage | None = None, error: ResponseError | None = None) dataclass

output_text: str property

Join all output_text content blocks from output messages.

reasoning_summary: str | None property

Join all reasoning summary texts.

tool_calls: list[ResponseFunctionToolCall] property

Extract all function tool calls from output.

codex_open_client.Usage(input_tokens: int, output_tokens: int, total_tokens: int) dataclass

codex_open_client.ResponseError(code: str, message: str) dataclass

Output Types

codex_open_client.ResponseOutputMessage(id: str, content: list[OutputContent], role: Literal['assistant'] = 'assistant', status: str | None = None, type: Literal['message'] = 'message') dataclass

codex_open_client.OutputText(text: str, type: Literal['output_text'] = 'output_text') dataclass

codex_open_client.ResponseFunctionToolCall(call_id: str, name: str, arguments: str, id: str | None = None, status: Literal['in_progress', 'completed', 'incomplete'] | None = None, type: Literal['function_call'] = 'function_call') dataclass

codex_open_client.ResponseReasoningItem(id: str, summary: list[ReasoningSummary], encrypted_content: str | None = None, type: Literal['reasoning'] = 'reasoning') dataclass

codex_open_client.ReasoningSummary(text: str, type: Literal['summary_text'] = 'summary_text') dataclass

Input Types

codex_open_client.InputMessage(role: Literal['user', 'assistant', 'system', 'developer'], content: str | list[ContentPart], type: Literal['message'] = 'message') dataclass

codex_open_client.InputText(text: str, type: Literal['input_text'] = 'input_text') dataclass

codex_open_client.InputImage(image_url: str, detail: Literal['auto', 'low', 'high', 'original'] = 'auto', type: Literal['input_image'] = 'input_image') dataclass

codex_open_client.FunctionCallOutput(call_id: str, output: str, type: Literal['function_call_output'] = 'function_call_output') dataclass

Parsed Response

codex_open_client.ParsedResponse(response: Response, output_parsed: T) dataclass

Bases: Generic[T]

A response with the output text parsed into a structured object.

Wraps a Response and adds an output_parsed attribute containing the deserialized model instance.

Usage::

from pydantic import BaseModel

class Person(BaseModel):
    name: str
    age: int

parsed = client.responses.parse(
    model="gpt-5.1-codex-mini",
    instructions="Extract the person info.",
    input="John Smith is 30 years old.",
    text_format=Person,
)
print(parsed.output_parsed.name)   # "John Smith"
print(parsed.response.output_text)  # raw JSON string

Tools & Config

codex_open_client.FunctionTool(name: str, description: str, parameters: dict[str, Any], strict: bool = True, type: Literal['function'] = 'function') dataclass

codex_open_client.Reasoning(effort: Literal['low', 'medium', 'high'] | None = None, summary: Literal['auto', 'concise', 'detailed', 'none'] | None = None) dataclass

codex_open_client.TextConfig(format: FormatConfig | dict[str, Any] | None = None, verbosity: Literal['low', 'medium', 'high'] | None = None) dataclass

Format Types

codex_open_client.ResponseFormatText(type: Literal['text'] = 'text') dataclass

Plain text output (default).

codex_open_client.ResponseFormatJsonObject(type: Literal['json_object'] = 'json_object') dataclass

Free-form JSON output.

codex_open_client.ResponseFormatJsonSchema(name: str, schema: dict[str, Any], type: Literal['json_schema'] = 'json_schema', description: str | None = None, strict: bool | None = None) dataclass

Structured JSON output constrained to a specific schema.

Model

codex_open_client.Model(slug: str, display_name: str, context_window: int | None = None, reasoning_levels: list[str] = list(), input_modalities: list[str] = list(), supports_parallel_tool_calls: bool = False, priority: int = 0) dataclass