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

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

Overview

Concrete tool for specifying valid model identifiers for the Responses API in the openai-python SDK.

Description

ResponsesModel is a TypeAlias defined as a union of str, ChatModel (the full set of chat model identifiers), and a Literal union of additional Responses-specific model identifiers. The additional models include 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 with their dated variants. Because the type includes bare str, any model string is accepted, but the Literal variants provide autocompletion and documentation for known models.

Usage

Import this type when you need to type-annotate the model parameter for Responses API calls. The str union member allows custom or fine-tuned model identifiers while the literal values provide IDE autocompletion.

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_params import ResponsesModel

I/O Contract

Type Definition

Type Description
Union[str, ChatModel, Literal[...]] Accepts any string, any ChatModel literal, or the Responses-specific model identifiers listed below.

Responses-Specific Models

Model Description
o1-pro, o1-pro-2025-03-19 O1 Pro reasoning model.
o3-pro, o3-pro-2025-06-10 O3 Pro reasoning model.
o3-deep-research, o3-deep-research-2025-06-26 O3 deep research model.
o4-mini-deep-research, o4-mini-deep-research-2025-06-26 O4 Mini deep research model.
computer-use-preview, computer-use-preview-2025-03-11 Computer use preview model.
gpt-5-codex GPT-5 Codex model.
gpt-5-pro, gpt-5-pro-2025-10-06 GPT-5 Pro model.
gpt-5.1-codex-max GPT-5.1 Codex Max model.

Usage Examples

from openai import OpenAI
from openai.types.shared_params import ResponsesModel

client = OpenAI()

def create_response(model: ResponsesModel, prompt: str):
    return client.responses.create(
        model=model,
        input=prompt,
    )

# Using a known model literal
response = create_response("o3-pro", "Explain quantum computing.")

# Using a custom/fine-tuned model string
response = create_response("ft:gpt-4o:my-org:custom:id", "Summarize this.")

Related Pages

Page Connections

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