Implement latest GPT-5.1 models

This commit is contained in:
Game_Time
2025-11-19 14:59:34 +05:00
parent fd900eb7af
commit a4b9ae9471
2 changed files with 7 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ openai_bp = Blueprint("openai", __name__)
def _instructions_for_model(model: str) -> str: def _instructions_for_model(model: str) -> str:
base = current_app.config.get("BASE_INSTRUCTIONS", BASE_INSTRUCTIONS) base = current_app.config.get("BASE_INSTRUCTIONS", BASE_INSTRUCTIONS)
if model == "gpt-5-codex": if model == "gpt-5-codex" or model == "gpt-5.1-codex":
codex = current_app.config.get("GPT5_CODEX_INSTRUCTIONS") or GPT5_CODEX_INSTRUCTIONS codex = current_app.config.get("GPT5_CODEX_INSTRUCTIONS") or GPT5_CODEX_INSTRUCTIONS
if isinstance(codex, str) and codex.strip(): if isinstance(codex, str) and codex.strip():
return codex return codex
@@ -441,7 +441,10 @@ def list_models() -> Response:
expose_variants = bool(current_app.config.get("EXPOSE_REASONING_MODELS")) expose_variants = bool(current_app.config.get("EXPOSE_REASONING_MODELS"))
model_groups = [ model_groups = [
("gpt-5", ["high", "medium", "low", "minimal"]), ("gpt-5", ["high", "medium", "low", "minimal"]),
("gpt-5.1", ["high", "medium", "low", "minimal"]),
("gpt-5-codex", ["high", "medium", "low"]), ("gpt-5-codex", ["high", "medium", "low"]),
("gpt-5.1-codex", ["high", "medium", "low"]),
("gpt-5.1-codex-mini", []),
("codex-mini", []), ("codex-mini", []),
] ]
model_ids: List[str] = [] model_ids: List[str] = []

View File

@@ -31,12 +31,15 @@ def normalize_model_name(name: str | None, debug_model: str | None = None) -> st
"gpt5": "gpt-5", "gpt5": "gpt-5",
"gpt-5-latest": "gpt-5", "gpt-5-latest": "gpt-5",
"gpt-5": "gpt-5", "gpt-5": "gpt-5",
"gpt-5.1": "gpt-5.1",
"gpt5-codex": "gpt-5-codex", "gpt5-codex": "gpt-5-codex",
"gpt-5-codex": "gpt-5-codex", "gpt-5-codex": "gpt-5-codex",
"gpt-5-codex-latest": "gpt-5-codex", "gpt-5-codex-latest": "gpt-5-codex",
"gpt-5.1-codex": "gpt-5.1-codex",
"codex": "codex-mini-latest", "codex": "codex-mini-latest",
"codex-mini": "codex-mini-latest", "codex-mini": "codex-mini-latest",
"codex-mini-latest": "codex-mini-latest", "codex-mini-latest": "codex-mini-latest",
"gpt-5.1-codex-mini": "gpt-5.1-codex-mini",
} }
return mapping.get(base, base) return mapping.get(base, base)