0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenAI APIの12月停止予定に備える:gpt-5・o3などの旧モデルIDと設定をPythonで洗い出す

0
Posted at

OpenAIの公式Deprecationsページ(2026-11-30確認)には、12月1日と12月11日に停止予定のAPIモデルがあります。この記事では、リポジトリに残るモデルIDを洗い出すPythonスクリプトと、置き換えるときに一緒に見る設定を整理します。実APIでの移行や出力比較は行っていません。

停止予定の概要

対象と推奨代替

停止予定日と推奨代替

停止予定日 対象 推奨代替
2026-12-01 gpt-image-1-mini, gpt-image-1.5, gpt-image-1.5-2025-12-16, chatgpt-image-latest gpt-image-2.6-sunburst / gpt-image-2.6-flare
2026-12-11 gpt-5, gpt-5-2025-08-07, o3, o3-2025-04-16 gpt-6.1-sol
2026-12-11 gpt-5-mini, gpt-5-mini-2025-08-07 gpt-6.1-terra
2026-12-11 gpt-5-nano, gpt-5-nano-2025-08-07 gpt-6-luna
2026-12-11 gpt-5-pro, gpt-5-pro-2025-10-06, o3-pro, o3-pro-2025-06-10 gpt-6.1-sol(Responses APIで reasoning.mode: pro)

画像モデルの告知日は2026-06-02、そのほかは2026-06-11です。停止時刻とタイムゾーンは一覧では確認できませんでした。

ID以外に見る設定

置き換え時の違い

各モデルページ(2026-11-30確認)の記載です。

  • gpt-5 の reasoning.effort:minimal / low / medium / high
  • gpt-6.1-sol:low / medium(既定)/ high / xhigh / max。minimal と none は一覧にない
  • gpt-6.1-terra・gpt-6-luna:none / low / medium(既定)/ high / xhigh / max
  • gpt-6.1-sol・gpt-6.1-terra:ツール呼び出しはResponses APIが必要
  • gpt-6-luna:Chat Completionsの関数呼び出しは reasoning_effort が none の場合のみ

単価も変わります(テキスト、100万トークンあたりの入力 / 出力、USD)。gpt-5 $1.25/$10 → sol $2/$10、o3 $2/$8 → sol $2/$10、gpt-5-mini $0.25/$2 → terra $1/$5、gpt-5-nano $0.05/$0.4 → luna $0.1/$0.5。消費トークン数でも総額は変わるので、実測してください。

スクリプト(読み取りのみ・標準ライブラリのみ)

scan_openai_retiring.py として保存し、python3 scan_openai_retiring.py <フォルダ> で実行します。該当があれば終了コード1、なければ0、フォルダ指定の誤りは2です。

scan_openai_retiring.py
#!/usr/bin/env python3
"""2026年12月に停止予定のOpenAI APIモデルIDを探す(読み取りのみ)。"""
import re
import sys
from pathlib import Path

# (停止日, 公式の推奨代替) : モデルID
TABLE = {
    ("2026-12-01", "gpt-image-2.6-sunburst / gpt-image-2.6-flare"): [
        "gpt-image-1-mini", "gpt-image-1.5", "gpt-image-1.5-2025-12-16",
        "chatgpt-image-latest"],
    ("2026-12-11", "gpt-6.1-sol"): [
        "gpt-5", "gpt-5-2025-08-07", "o3", "o3-2025-04-16"],
    ("2026-12-11", "gpt-6.1-terra"): ["gpt-5-mini", "gpt-5-mini-2025-08-07"],
    ("2026-12-11", "gpt-6-luna"): ["gpt-5-nano", "gpt-5-nano-2025-08-07"],
    ("2026-12-11", "gpt-6.1-sol (reasoning.mode: pro, Responses API)"): [
        "gpt-5-pro", "gpt-5-pro-2025-10-06", "o3-pro", "o3-pro-2025-06-10"],
}
INFO = {model: key for key, models in TABLE.items() for model in models}

# 前後が英数字・ハイフン・「.数字や英字」の場合は別のIDとみなす
MODEL_RE = re.compile(
    r"(?<![\w.-])("
    + "|".join(re.escape(m) for m in sorted(INFO, key=len, reverse=True))
    + r")(?![\w-]|\.\w)"
)
# 移行時に合わせて見直す行(モデルIDがあったファイル内だけ表示)
REVIEW = {
    "minimal指定": re.compile(r"""["']minimal["']|effort\s*[:=]\s*minimal\b"""),
    "Chat Completions": re.compile(r"chat\.completions|/v1/chat/completions"),
    "ツール指定": re.compile(r"""\b(tools|functions)["']?\s*[:=]"""),
}
SKIP_DIRS = {".git", "node_modules", ".venv", "venv", "dist", "build", "__pycache__"}


def scan(root: Path):
    me = Path(__file__).resolve()
    for path in sorted(root.rglob("*")):
        if not path.is_file() or path.resolve() == me:
            continue
        if SKIP_DIRS & set(path.relative_to(root).parts[:-1]):
            continue
        if path.stat().st_size > 1_000_000:
            continue
        try:
            lines = path.read_text(encoding="utf-8").splitlines()
        except (UnicodeDecodeError, OSError):
            continue
        hits = [(n, m.group(1)) for n, line in enumerate(lines, 1)
                for m in MODEL_RE.finditer(line)]
        if not hits:
            continue
        notes = [(n, name) for n, line in enumerate(lines, 1)
                 for name, rx in REVIEW.items() if rx.search(line)]
        yield path.relative_to(root), hits, notes


def main() -> int:
    root = Path(sys.argv[1] if len(sys.argv) > 1 else ".")
    if not root.is_dir():
        print(f"フォルダがありません: {root}", file=sys.stderr)
        return 2
    total = 0
    for rel, hits, notes in scan(root):
        for line_no, model in hits:
            date, repl = INFO[model]
            print(f"{rel.as_posix()}:{line_no}: {model} (停止予定 {date}) -> {repl}")
            total += 1
        for line_no, name in notes:
            print(f"  要確認 {rel.as_posix()}:{line_no}: {name}")
    print(f"該当 {total} 件")
    return 1 if total else 0


if __name__ == "__main__":
    sys.exit(main())

動作確認

自作のデモファイル2つで実行しました(Python 3.13)。

demo/app/chat.py
resp = client.chat.completions.create(
    model="gpt-5",
    reasoning_effort="minimal",
    tools=TOOLS,
    messages=messages,
)
small = "gpt-5-mini-2025-08-07"
newer = "gpt-5.1"
other = "o3-mini"
demo/.env.example
IMAGE_MODEL=gpt-image-1.5
REASONING_MODEL=o3-pro
KEEP_MODEL=gpt-6.1-sol
出力
.env.example:1: gpt-image-1.5 (停止予定 2026-12-01) -> gpt-image-2.6-sunburst / gpt-image-2.6-flare
.env.example:2: o3-pro (停止予定 2026-12-11) -> gpt-6.1-sol (reasoning.mode: pro, Responses API)
app/chat.py:2: gpt-5 (停止予定 2026-12-11) -> gpt-6.1-sol
app/chat.py:7: gpt-5-mini-2025-08-07 (停止予定 2026-12-11) -> gpt-6.1-terra
  要確認 app/chat.py:1: Chat Completions
  要確認 app/chat.py:3: minimal指定
  要確認 app/chat.py:4: ツール指定
該当 4 件

gpt-5.1、o3-mini、gpt-6.1-sol は対象IDとして数えていないことを確認できます。

限界

  • UTF-8の1MB以下のファイルだけを読みます。DB、シークレット管理、SaaSの設定画面にあるIDは見つかりません。
  • 文字列を組み立てて作るモデルIDは検出できません。
  • o3 は短い文字列なので、同名の変数などを拾う可能性があります。結果は目で確認してください。
  • 「要確認」は行単位の簡単な手がかりです。出なくても問題がない保証にはなりません。
  • 値をログに出すのはモデルIDと行番号だけですが、実行先は自分が扱ってよいフォルダにしてください。

出典(2026-11-30確認)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?