DollsKit

OpenAI API

正式名称が分かりやすいところに無く、よく分からない。 多分 OpenAI API。

ドキュメントは “Docs” と “API Reference” の2種類があり、 似たような内容で違うことが書いてある。

https://platform.openai.com/docs/
https://platform.openai.com/docs/api-reference/introduction

Chat GPT はこちら。 ドメインから別サービスとして展開されているが、会社 (Open AI)および 内部で使っているモデルは一緒。 (ただし “現在 ChatGPT で使われているのと同一モデル” はちょっと高い気がする。)

https://chatgpt.com/

登録

忘れた。。 Chat GPT と同じアカウントを使えたかもよく覚えていない。

モデル名

https://platform.openai.com/docs/models
https://platform.openai.com/docs/pricing

エンドポイントの例

認証

入力フォーマット

https://platform.openai.com/docs/api-reference/responses/create

分かりづらくてきれそう。 Playground で function 実行して、うまくいった実績のある実行サンプルから解読する。

// "input":
[
  {
    "role": "user",
    "content": [
      {
        "type": "input_text",
        "text": "東京"
      }
    ]
  },
  {
    "type": "function_call",
    "call_id": "call_UbxMBIKVNhA8iVxWj7Qc9x7G",
    "name": "get_weather",
    "arguments": "{\"location\":\"Tokyo, Japan\",\"unit\":\"c\"}"
  },
  {
    "type": "function_call_output",
    "call_id": "call_UbxMBIKVNhA8iVxWj7Qc9x7G",
    "output": "晴れ"
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "output_text",
        "text": "今日の東京の天気は晴れです。何か他に知りたいことがありますか?"
      }
    ]
  }
]
{
  "model": "gpt-4o",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "現在の日本プロ野球の順位を調べてください。"
        }
      ]
    },
    {
      "type": "web_search_call",
      "id": "ws_67f22b7a6e8081929d6f15d6fef11b3703809705402c38a1",
      "status": "completed"
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "2025年4月6日現在、日本プロ野球(NPB)の2025年シーズンはまだ開幕していません。通常、NPBのシーズンは3月下旬から4月上旬に開幕しますが、今年の開幕日は未定です。そのため、現時点での順位情報はありません。\n\n参考までに、2024年シーズンの最終順位は以下の通りです。\n\n**セントラル・リーグ(セ・リーグ)**\n\n| 順位 | チーム名 | 試合数 | 勝利 | 敗戦 | 引分 | 勝率 | 勝差 |\n|---|---|---|---|---|---|---|---|\n| 1 | 巨人 | 143 | 77 | 59 | 7 | .566 | - |\n| 2 | 阪神 | 142 | 73 | 63 | 6 | .537 | 4.0 |\n| 3 | DeNA | 139 | 69 | 67 | 3 | .507 | 4.0 |\n| 4 | 広島 | 141 | 66 | 70 | 5 | .485 | 3.0 |\n| 5 | ヤクルト | 141 | 62 | 75 | 4 | .453 | 4.5 |\n| 6 | 中日 | 140 | 59 | 73 | 8 | .447 | 0.5 |\n\n**パシフィック・リーグ(パ・リーグ)**\n\n| 順位 | チーム名 | 試合数 | 勝利 | 敗戦 | 引分 | 勝率 | 勝差 |\n|---|---|---|---|---|---|---|---|\n| 1 | ソフトバンク | 141 | 89 | 49 | 3 | .645 | - |\n| 2 | 日本ハム | 140 | 73 | 59 | 8 | .553 | 13.0 |\n| 3 | ロッテ | 141 | 71 | 64 | 6 | .526 | 3.5 |\n| 4 | 楽天 | 138 | 66 | 69 | 3 | .489 | 5.0 |\n| 5 | オリックス | 142 | 62 | 77 | 3 | .446 | 6.0 |\n| 6 | 西武 | 142 | 49 | 91 | 2 | .350 | 13.5 |\n\n([baseball-jp.com](https://www.baseball-jp.com/rank/top.html?utm_source=openai))\n\n2025年シーズンの開幕日や最新の情報については、NPBの公式サイトや各球団の公式サイトをご確認ください。 "
        }
      ]
    }
  ],
  "text": {
    "format": {
      "type": "text"
    }
  },
  "reasoning": {},
  "tools": [
    {
      "type": "web_search_preview",
      "user_location": {
        "type": "approximate",
        "country": "JP"
      },
      "search_context_size": "low"
    }
  ],
  "temperature": 1,
  "max_output_tokens": 2048,
  "top_p": 1,
  "store": true
}