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 Shared Responses Model

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

Overview

Concrete tool for defining the union type of model identifiers accepted by the Responses API provided by the openai-python SDK.

Description

ResponsesModel is a TypeAlias representing a union of all model identifiers accepted by the OpenAI Responses API. It combines:

  • str - Any arbitrary model string for forward compatibility.
  • ChatModel - The full set of chat model literal identifiers.
  • A Literal union of additional model identifiers specific to the Responses API, including o1-pro, o3-pro, o3-deep-research, o4-mini-deep-research, computer-use-preview, gpt-5-codex, gpt-5-pro, and gpt-5.1-codex-max variants.

This type alias is structurally identical to AllModels but is semantically scoped to the Responses API surface.

Usage

Import ResponsesModel when you need to type-annotate model parameters specifically for the Responses API.

Code Reference

Source Location

Signature

ResponsesModel: TypeAlias = Union[
    str,
    ChatModel,
    Literal[
        "o1-pro",
        "o1-pro-2025-03-19",
        "o3-pro",
        "o3-pro-2025-06-10",
        "o3-deep-research",
        "o3-deep-research-2025-06-26",
        "o4-mini-deep-research",
        "o4-mini-deep-research-2025-06-26",
        "computer-use-preview",
        "computer-use-preview-2025-03-11",
        "gpt-5-codex",
        "gpt-5-pro",
        "gpt-5-pro-2025-10-06",
        "gpt-5.1-codex-max",
    ],
]

Import

from openai.types.shared import ResponsesModel

I/O Contract

Type Members

Variant Description
str Any arbitrary model identifier string for forward compatibility.
ChatModel All chat model literals (gpt-4o, gpt-4, gpt-3.5-turbo, o1, o3, etc.).
Literal["o1-pro", ...] Additional model identifiers for the Responses API: o1-pro, o3-pro, o3-deep-research, o4-mini-deep-research, computer-use-preview, gpt-5-codex, gpt-5-pro, gpt-5.1-codex-max, and their dated variants.

Usage Examples

from openai import OpenAI
from openai.types.shared import ResponsesModel

def create_response(model: ResponsesModel, prompt: str):
    """Create a response using any valid Responses API model."""
    client = OpenAI()
    response = client.responses.create(
        model=model,
        input=prompt,
    )
    return response

# All of these are valid ResponsesModel values
result = create_response("gpt-4o", "Hello!")
result = create_response("o3-pro", "Solve this problem...")
result = create_response("computer-use-preview", "Navigate to...")

Related Pages

Page Connections

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