Zenn
🤔

OpenAI APIで使えるモデルを確認する方法

日本時間2025年3月20日、OpenAIからo1-proがAPI利用できるようになったと発表がありました。
https://x.com/OpenAIDevs/status/1902485690958450871
そこでふと思ったのが、「OpenAIのAPIモデルってたくさんあるけど、今何が使えるんだっけ?🤔」と。
調べたら、OpenAIのPythonライブラリで確認可能とのこと。
実装例は下記。

APIで使えるモデルを確認
import openai
import pandas as pd
from datetime import datetime

# クライアント初期化
client = openai.OpenAI()

# モデル一覧を取得
models = client.models.list()

# モデル情報を整理
model_data = []
for model in models.data:
    model_data.append({
        "ID": model.id,
        "Created": datetime.fromtimestamp(model.created).strftime("%Y-%m-%d %H:%M:%S"),
        "Object": model.object,
        "Owned by": model.owned_by
    })

# DataFrameを作成
df = pd.DataFrame(model_data)

# 「Created」を降順(新しい順)でソート
df_sorted = df.sort_values(by="Created", ascending=False)

# Markdownで出力
print(df_sorted.to_markdown(index=False))

実行結果は下記となります!

ID Created Object Owned by
o1-pro 2025-03-18 07:49:51 model system
o1-pro-2025-03-19 2025-03-18 07:45:04 model system
gpt-4o-mini-search-preview 2025-03-08 08:46:01 model system
gpt-4o-mini-search-preview-2025-03-11 2025-03-08 08:40:58 model system
gpt-4o-search-preview 2025-03-08 08:05:20 model system
gpt-4o-search-preview-2025-03-11 2025-03-08 07:56:10 model system
gpt-4.5-preview-2025-02-27 2025-02-27 11:28:24 model system
gpt-4.5-preview 2025-02-27 11:24:19 model system
gpt-4o-2024-11-20 2025-02-12 12:39:03 model system
o3-mini-2025-01-31 2025-01-28 05:36:40 model system
o3-mini 2025-01-18 05:39:43 model system
gpt-4o-mini-audio-preview 2024-12-17 07:17:04 model system
gpt-4o-mini-realtime-preview 2024-12-17 07:16:20 model system
o1 2024-12-17 04:03:36 model system
o1-2024-12-17 2024-12-16 14:29:36 model system
gpt-4o-mini-audio-preview-2024-12-17 2024-12-14 03:52:00 model system
gpt-4o-mini-realtime-preview-2024-12-17 2024-12-14 02:56:41 model system
gpt-4o-audio-preview-2024-12-17 2024-12-13 05:10:39 model system
gpt-4o-realtime-preview-2024-12-17 2024-12-12 04:30:30 model system
omni-moderation-2024-09-26 2024-11-28 04:07:46 model system
omni-moderation-latest 2024-11-16 01:47:45 model system
gpt-4o-realtime-preview 2024-09-30 10:33:18 model system
gpt-4o-audio-preview 2024-09-28 03:07:23 model system
gpt-4o-audio-preview-2024-10-01 2024-09-27 07:17:22 model system
gpt-4o-realtime-preview-2024-10-01 2024-09-24 07:49:26 model system
o1-mini 2024-09-07 03:56:48 model system
o1-mini-2024-09-12 2024-09-07 03:56:19 model system
o1-preview 2024-09-07 03:54:57 model system
o1-preview-2024-09-12 2024-09-07 03:54:25 model system
chatgpt-4o-latest 2024-08-13 11:12:11 model system
gpt-4o-2024-08-06 2024-08-05 08:38:39 model system
gpt-4o-mini 2024-07-17 08:32:21 model system
gpt-4o-mini-2024-07-18 2024-07-17 08:31:57 model system
gpt-4o-2024-05-13 2024-05-11 04:08:52 model system
gpt-4o 2024-05-11 03:50:49 model system
gpt-4-turbo-2024-04-09 2024-04-09 03:41:17 model system
gpt-4-turbo 2024-04-06 08:57:21 model system
gpt-3.5-turbo-0125 2024-01-24 07:19:18 model system
gpt-4-turbo-preview 2024-01-24 04:22:57 model system
gpt-4-0125-preview 2024-01-24 04:20:12 model system
text-embedding-3-large 2024-01-23 04:53:00 model system
text-embedding-3-small 2024-01-23 03:43:17 model system
tts-1-hd-1106 2023-11-04 08:18:53 model system
tts-1-1106 2023-11-04 08:14:01 model system
tts-1-hd 2023-11-04 06:13:35 model system
gpt-3.5-turbo-1106 2023-11-03 06:15:48 model system
gpt-4-1106-preview 2023-11-03 05:33:26 model system
dall-e-2 2023-11-01 09:22:57 model system
dall-e-3 2023-11-01 05:46:29 model system
gpt-3.5-turbo-instruct-0914 2023-09-08 06:34:32 model system
gpt-3.5-turbo-instruct 2023-08-25 03:23:47 model system
babbage-002 2023-08-22 01:16:55 model system
davinci-002 2023-08-22 01:11:41 model system
gpt-4 2023-06-28 01:13:31 model openai
gpt-4-0613 2023-06-13 01:54:56 model openai
gpt-3.5-turbo-16k-0613 2023-05-31 04:17:27 model openai
gpt-3.5-turbo-16k 2023-05-11 07:35:02 model openai-internal
tts-1 2023-04-20 06:49:11 model openai-internal
gpt-3.5-turbo 2023-03-01 03:56:42 model openai
whisper-1 2023-02-28 06:13:04 model openai-internal
text-embedding-ada-002 2022-12-17 04:01:39 model openai-internal

ご参考までに!

Accenture Japan (有志)

Discussion

ログインするとコメントできます