Add convenience methods for detecting model parameter support (temperature, reasoning)
维护者通常 1 天内回复
评估
调研方向
该 issue 没有指明实现文件、测试或入口点。首先定位 Python 库中与模型相关的公共 API 和现有模型元数据,然后确定应如何表示能力检查和有效的 reasoning-effort 值;当已记录所列模型系列的行为,并覆盖受支持和不受支持的参数时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
- This is a feature request for the Python library
Describe the feature or improvement you're requesting
Feature request
When building applications that support multiple OpenAI models (e.g., gpt-4.1-mini, gpt-5, gpt-5.1, gpt-5.4), developers need to know which parameters each model supports. Currently this requires maintaining hardcoded model lists or prefix checks, which break as new models are released.
The problem
Different model families have different parameter constraints:
temperature: Supported by gpt-4.x but rejected by gpt-5.x reasoning models when reasoning_effort != nonereasoning: Only supported by gpt-5 family models, not gpt-4.xreasoning.effortvalues: Vary by model — gpt-5 supportsminimal/low/medium/high, gpt-5.1+ addsnone, gpt-5.4+ addsxhigh
Today, developers must write code like:
def is_reasoning_model(model: str) -> bool:
return model.startswith("gpt-5")
def get_reasoning_effort_options(model: str) -> list[str]:
if not is_reasoning_model(model):
return []
if model.startswith("gpt-5."):
minor = int(model[6:].split("-")[0])
options = ["none", "low", "medium", "high"]
if minor >= 4:
options.append("xhigh")
return options
return ["minimal", "low", "medium", "high"]
This is fragile — it breaks whenever a new model family is released, and the version-based logic for effort levels is reverse-engineered from documentation rather than provided by the SDK.
Proposed solution
Add model capability metadata to the SDK in some way, for example:
# Check if a parameter is supported
openai.models.supports(model="gpt-5.4", parameter="temperature") # False
openai.models.supports(model="gpt-5.4", parameter="reasoning") # True
# Get valid values for an enum parameter
openai.models.valid_values(model="gpt-5.4", parameter="reasoning.effort")
# ["none", "low", "medium", "high", "xhigh"]
openai.models.valid_values(model="gpt-5", parameter="reasoning.effort")
# ["minimal", "low", "medium", "high"]
Or alternatively, expose it as model metadata:
from openai.models import get_model_capabilities
caps = get_model_capabilities("gpt-5.4")
caps.supports_temperature # False
caps.supports_reasoning # True
caps.reasoning_effort_options # ["none", "low", "medium", "high", "xhigh"]
Use case
This came up while migrating azure-search-openai-demo from Chat Completions to the Responses API. The app supports multiple model deployments and needs to dynamically adjust which parameters it sends and presents in the UI for users. I imagine there are many similar apps that provide users with model options and parameters.
Additional context
No response
- 主要语言
- Python
- 星标
- 31.8k
- 派生
- 7.3k
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 137
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openai/openai-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
openai/openai-python#4022 · 19 条评论 ·
维护者通常 1 天内回复
-
fix(auth): SubjectTokenProviderError drops response and duplicates error message in workload identity providers可能已有人在做 @mohmedmm 于 11 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
openai/openai-python#4017 · 3 条评论 ·
维护者通常 1 天内回复
-
Querystring drops explicit empty-string scalar values可能已有人在做 @sylvesterkaczmarek 于 34 天前认领。 未关闭sdk-breaking-change v4
难度 2/5 1-3 小时 新手友好度 86/100
openai/openai-python#3837 ·
维护者通常 1 天内回复
-
Define + export `ServiceTiers` string literal可能已有人在做 @SparshGarg999 于 60 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
openai/openai-python#3556 · 3 条评论 ·
维护者通常 1 天内回复
-
Empty OPENAI_BASE_URL prevents fallback to default API endpoint可能已有人在做 @Sehastrajit-S 于 26 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
openai/openai-python#2927 · 6 条评论 ·
维护者通常 1 天内回复
查看 openai/openai-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
task
难度 2/5 1-3 小时 新手友好度 78/100
danparshall/claude_researcher#87 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
datajoint/datajoint-python#1586 ·
维护者通常 1 天内回复
-
1D intercept of length 1 is accepted as `fix_params` in population GLM with more than 1 unit可能已有人在做 @dhvani7014 今天认领。 未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 72/100
flatironinstitute/nemos#642 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
uniswap-python/uniswap-python#487 ·