ChatGPT-APIのモデル(バージョン)を切り替える方法

# 目次
[公開されているモデルを確認する](#公開されているモデルを確認する)
[モデルを切り替える方法](#モデルを切り替える方法)

# 公開されているモデルを確認する
### ①OpenAIの公式ホームページからチェックする方法
https://platform.openai.com/docs/models/overview

### ②APIを使ってモデルを確認する方法

```.py
from os import getenv
import openai
from datetime import datetime

openai.api_key = getenv("OPENAI_API_KEY")

response = openai.Model.list()
    for model in response.data:
        print(
            model.id +
            "           /created:" +
            str(datetime.fromtimestamp(model.created))
        )
```

実行結果↓
```
whisper-1           /created:2023-02-28 06:13:04
babbage           /created:2022-04-08 04:07:29
davinci           /created:2022-04-08 04:31:14
text-davinci-edit-001           /created:2022-04-13 09:19:39
babbage-code-search-code           /created:2022-04-29 04:01:49
text-similarity-babbage-001           /created:2022-04-29 04:01:45
text-embedding-ada-002           /created:2022-12-17 04:01:39
code-davinci-edit-001           /created:2022-04-14 05:08:04
text-davinci-001           /created:2022-04-08 05:40:42
ada           /created:2022-04-08 03:51:31
babbage-code-search-text           /created:2022-04-29 04:01:49
babbage-similarity           /created:2022-04-29 04:01:45
code-search-babbage-text-001           /created:2022-04-29 04:01:47
text-curie-001           /created:2022-04-08 05:40:43
gpt-4-0314           /created:2023-03-12 16:03:21
code-search-babbage-code-001           /created:2022-04-29 04:01:47
text-ada-001           /created:2022-04-08 05:40:42
text-similarity-ada-001           /created:2022-04-29 04:01:45
curie-instruct-beta           /created:2022-04-08 05:40:42
gpt-4           /created:2023-03-12 16:03:22
ada-code-search-code           /created:2022-04-29 04:01:45
ada-similarity           /created:2022-04-29 04:01:47
code-search-ada-text-001           /created:2022-04-29 04:01:47
text-search-ada-query-001           /created:2022-04-29 04:01:45
davinci-search-document           /created:2022-04-29 04:01:49
ada-code-search-text           /created:2022-04-29 04:01:50
text-search-ada-doc-001           /created:2022-04-29 04:01:47
davinci-instruct-beta           /created:2022-04-08 05:40:42
text-similarity-curie-001           /created:2022-04-29 04:01:47
code-search-ada-code-001           /created:2022-04-29 04:01:47
ada-search-query           /created:2022-04-29 04:01:45
text-search-davinci-query-001           /created:2022-04-29 04:01:45
curie-search-query           /created:2022-04-29 04:01:49
davinci-search-query           /created:2022-04-29 04:01:45
babbage-search-document           /created:2022-04-29 04:01:50
ada-search-document           /created:2022-04-29 04:01:47
text-search-curie-query-001           /created:2022-04-29 04:01:49
text-search-babbage-doc-001           /created:2022-04-29 04:01:49
curie-search-document           /created:2022-04-29 04:01:48
text-search-curie-doc-001           /created:2022-04-29 04:01:49
babbage-search-query           /created:2022-04-29 04:01:49
text-babbage-001           /created:2022-04-08 05:40:43
text-search-davinci-doc-001           /created:2022-04-29 04:01:45
text-search-babbage-query-001           /created:2022-04-29 04:01:49
curie-similarity           /created:2022-04-29 04:01:50
gpt-3.5-turbo-0613           /created:2023-06-13 01:30:34
curie           /created:2022-04-08 04:31:14
gpt-3.5-turbo-16k-0613           /created:2023-05-31 04:17:27
text-similarity-davinci-001           /created:2022-04-29 04:01:45
text-davinci-002           /created:2022-04-14 05:08:04
gpt-3.5-turbo-0301           /created:2023-03-01 14:52:43
text-davinci-003           /created:2022-11-28 10:40:35
davinci-similarity           /created:2022-04-29 04:01:49
gpt-4-0613           /created:2023-06-13 01:54:56
gpt-3.5-turbo           /created:2023-03-01 03:56:42
gpt-3.5-turbo-16k           /created:2023-05-11 07:35:02
```

# モデルを切り替える方法
APIをリクエストするときのmodelを書き換えるだけ！
### 変更前
```.py
openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "こんにちわ"}],
)
```

### 変更後
```.py
openai.ChatCompletion.create(
    model="gpt-4-0613", ←ここを書き換えるだけ
    messages=[{"role": "user", "content": "こんにちわ"}],
)
```