Skip to content

feat(types): add ImageDetail as a public type alias#2901

Open
thakoreh wants to merge 1 commit intoopenai:mainfrom
thakoreh:feat/add-image-detail-type-alias
Open

feat(types): add ImageDetail as a public type alias#2901
thakoreh wants to merge 1 commit intoopenai:mainfrom
thakoreh:feat/add-image-detail-type-alias

Conversation

@thakoreh
Copy link

Summary

Adds ImageDetail as a named public type alias following the same pattern as ReasoningEffort.

This allows users to import and use the type directly:

from openai.types import ImageDetail

cast(ImageDetail, image_quality.value if image_quality else 'high')

Previously users had to repeat the inline literal:

cast(Literal["low", "high", "auto"], image_quality.value)

Changes

  • Created src/openai/types/shared/image_detail.py with ImageDetail: TypeAlias = Optional[Literal["low", "high", "auto"]]
  • Exported from src/openai/types/shared/__init__.py
  • Exported from src/openai/types/__init__.py for direct import

Fixes #2889

Add ImageDetail type alias following the same pattern as ReasoningEffort.
This allows users to import and use the type directly:

    from openai.types import ImageDetail
    cast(ImageDetail, image_quality.value if image_quality else 'high')

Previously users had to repeat the inline literal:
    cast(Literal["low", "high", "auto"], image_quality.value)

Fixes openai#2889
@thakoreh thakoreh requested a review from a team as a code owner February 27, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ImageDetail as a named public type alias (like ReasoningEffort)

1 participant