{"id":3842,"date":"2026-09-08T10:00:39","date_gmt":"2026-09-08T00:30:39","guid":{"rendered":"https:\/\/softasia.jp\/blog\/?p=3842"},"modified":"2026-08-26T18:49:58","modified_gmt":"2026-08-26T09:19:58","slug":"%e3%80%902026%e5%b9%b4%e6%9c%80%e6%96%b0%e7%89%88%e3%80%91chatgpt-api%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%ef%bc%81python%e3%81%a7%e3%83%81%e3%83%a3%e3%83%83%e3%83%88%e3%83%9c%e3%83%83%e3%83%88","status":"publish","type":"post","link":"https:\/\/softasia.jp\/blog\/offshore\/3842\/","title":{"rendered":"\u30102026\u5e74\u6700\u65b0\u7248\u3011ChatGPT API\u306e\u4f7f\u3044\u65b9\uff01Python\u3067\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u4f5c\u308b\u65b9\u6cd5\u3092\u5fb9\u5e95\u89e3\u8aac"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-3844 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-6.png\" alt=\"\" width=\"1000\" height=\"1000\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-6.png 1000w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-6-300x300.png 300w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-6-150x150.png 150w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-6-768x768.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">ChatGPT\u306f\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u3082\u624b\u8efd\u306b\u4f7f\u3048\u307e\u3059\u304c\u3001<strong><span style=\"color: #ff0000;\">OpenAI<\/span><\/strong>\u306eAPI\u3092\u6d3b\u7528\u3059\u308c\u3070\u3055\u3089\u306b\u53ef\u80fd\u6027\u304c\u5e83\u304c\u308a\u307e\u3059\u3002Python\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u7d44\u307f\u8fbc\u3080\u3053\u3068\u3067\u3001\u81ea\u5206\u306e\u7528\u9014\u306b\u5408\u308f\u305b\u305f\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u4f5c\u308c\u308b\u3088\u3046\u306b\u306a\u308b\u304b\u3089\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u5b9a\u578b\u696d\u52d9\u306e\u81ea\u52d5\u5316<\/span>\u3001<span style=\"text-decoration: underline;\">\u793e\u5185\u30c4\u30fc\u30eb\u3078\u306e\u7d44\u307f\u8fbc\u307f<\/span>\u3001<span style=\"text-decoration: underline;\">\u72ec\u81ea\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u305f\u56de\u7b54\u30b7\u30b9\u30c6\u30e0<\/span>\u306a\u3069\u3001\u30a2\u30a4\u30c7\u30a2\u6b21\u7b2c\u3067\u5fdc\u7528\u7bc4\u56f2\u306f\u7121\u9650\u306b\u5e83\u304c\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u672c\u8a18\u4e8b\u3067\u306f\u3001API\u30ad\u30fc\u306e\u53d6\u5f97\u304b\u3089\u59cb\u307e\u308a\u3001Python\u3067\u306eAPI\u547c\u3073\u51fa\u3057\u65b9\u3001\u5b9f\u969b\u306e\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u4f5c\u6210\u3001\u3055\u3089\u306b\u4e00\u6b69\u9032\u3093\u3060\u6d3b\u7528\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u3092\u9806\u756a\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002ChatGPT\u3092\u305f\u3060\u4f7f\u3046\u304b\u3089\u3001\u81ea\u5206\u3067\u4f5c\u308b\u30fb\u7d44\u307f\u8fbc\u3080\u6bb5\u968e\u3078\u30b9\u30c6\u30c3\u30d7\u30a2\u30c3\u30d7\u3057\u305f\u3044\u65b9\u306f\u3001\u305c\u3072\u6700\u5f8c\u307e\u3067\u8aad\u307f\u9032\u3081\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#OpenAI_API\"><span class=\"toc_number toc_depth_1\">1<\/span> OpenAI API\u306e\u6e96\u5099<\/a><ul><li><a href=\"#OpenAI\"><span class=\"toc_number toc_depth_2\">1.1<\/span> OpenAI\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u4f5c\u6210<\/a><\/li><li><a href=\"#API\"><span class=\"toc_number toc_depth_2\">1.2<\/span> API\u30ad\u30fc\u306e\u767a\u884c<\/a><\/li><li><a href=\"#i\"><span class=\"toc_number toc_depth_2\">1.3<\/span> \u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li><li><a href=\"#API-2\"><span class=\"toc_number toc_depth_2\">1.4<\/span> API\u30ad\u30fc\u3092\u6271\u3046\u4e0a\u3067\u306e\u6ce8\u610f\u70b9<\/a><\/li><\/ul><\/li><li><a href=\"#PythonChatGPT_API\"><span class=\"toc_number toc_depth_1\">2<\/span> Python\u304b\u3089ChatGPT API\u3092\u547c\u3073\u51fa\u3059\u57fa\u672c\u30b3\u30fc\u30c9<\/a><ul><li><a href=\"#env\"><span class=\"toc_number toc_depth_2\">2.1<\/span> .env\u30d5\u30a1\u30a4\u30eb\u306e\u6e96\u5099<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_2\">2.2<\/span> \u57fa\u672c\u30b3\u30fc\u30c9\u306e\u5b9f\u88c5<\/a><\/li><li><a href=\"#i-3\"><span class=\"toc_number toc_depth_2\">2.3<\/span> \u5b9f\u884c\u7d50\u679c\u306e\u78ba\u8a8d<\/a><\/li><\/ul><\/li><li><a href=\"#i-4\"><span class=\"toc_number toc_depth_1\">3<\/span> \u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8\u3092\u4f5c\u3063\u3066\u307f\u3088\u3046<\/a><ul><li><a href=\"#i-5\"><span class=\"toc_number toc_depth_2\">3.1<\/span> \u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u6e96\u5099<\/a><\/li><li><a href=\"#apppy\"><span class=\"toc_number toc_depth_2\">3.2<\/span> \u30b5\u30fc\u30d0\u30fc\u5074\u306e\u30b3\u30fc\u30c9\uff08app.py\uff09<\/a><\/li><li><a href=\"#templatesindexhtml\"><span class=\"toc_number toc_depth_2\">3.3<\/span> \u753b\u9762\u5074\u306e\u30b3\u30fc\u30c9\uff08templates\/index.html\uff09<\/a><\/li><li><a href=\"#i-6\"><span class=\"toc_number toc_depth_2\">3.4<\/span> \u5b9f\u884c\u3057\u3066\u307f\u3088\u3046<\/a><\/li><\/ul><\/li><li><a href=\"#i-7\"><span class=\"toc_number toc_depth_1\">4<\/span> \u3082\u3063\u3068\u4fbf\u5229\u306b\u4f7f\u3046\u305f\u3081\u306e\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af<\/a><ul><li><a href=\"#i-8\"><span class=\"toc_number toc_depth_2\">4.1<\/span> \u30b7\u30b9\u30c6\u30e0\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u4eba\u683c\u30fb\u5f79\u5272\u3092\u8a2d\u5b9a\u3059\u308b<\/a><\/li><li><a href=\"#i-9\"><span class=\"toc_number toc_depth_2\">4.2<\/span> \u4f1a\u8a71\u5c65\u6b74\u3092\u4fdd\u6301\u3057\u3066\u81ea\u7136\u306a\u5bfe\u8a71\u306b\u3059\u308b<\/a><\/li><li><a href=\"#temperature\"><span class=\"toc_number toc_depth_2\">4.3<\/span> temperature\u3067\u56de\u7b54\u306e\u500b\u6027\u3092\u8abf\u6574\u3059\u308b<\/a><\/li><li><a href=\"#i-10\"><span class=\"toc_number toc_depth_2\">4.4<\/span> \u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u8ffd\u52a0\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#i-11\"><span class=\"toc_number toc_depth_1\">5<\/span> \u5229\u7528\u6642\u306b\u77e5\u3063\u3066\u304a\u304d\u305f\u3044\u6ce8\u610f\u70b9<\/a><ul><li><a href=\"#i-12\"><span class=\"toc_number toc_depth_2\">5.1<\/span> \u6599\u91d1\u4f53\u7cfb\u3068\u30b3\u30b9\u30c8\u7ba1\u7406<\/a><\/li><li><a href=\"#i-13\"><span class=\"toc_number toc_depth_2\">5.2<\/span> \u30ec\u30fc\u30c8\u5236\u9650\u306b\u3064\u3044\u3066<\/a><\/li><li><a href=\"#i-14\"><span class=\"toc_number toc_depth_2\">5.3<\/span> \u500b\u4eba\u60c5\u5831\u306e\u53d6\u308a\u6271\u3044<\/a><\/li><\/ul><\/li><li><a href=\"#i-15\"><span class=\"toc_number toc_depth_1\">6<\/span> \u307e\u3068\u3081<\/a><\/li><\/ul><\/div>\n<h2><span id=\"OpenAI_API\"><span style=\"font-weight: 400;\">OpenAI API\u306e\u6e96\u5099<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-3846 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-28.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-28.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-28-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">ChatGPT API\u3092Python\u304b\u3089\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u307e\u305aOpenAI\u306e\u516c\u5f0f\u30b5\u30a4\u30c8\u3067\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3001API\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<\/span>\u3002\u3053\u3053\u3067\u306f\u6e96\u5099\u6bb5\u968e\u3067\u884c\u3046\u3079\u304d\u30b9\u30c6\u30c3\u30d7\u3092\u9806\u756a\u306b\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"OpenAI\"><span style=\"font-weight: 400;\">OpenAI\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u4f5c\u6210<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u306f\u3058\u3081\u306b\u3001OpenAI\u306e\u516c\u5f0f\u30b5\u30a4\u30c8\uff08https:\/\/platform.openai.com\/\uff09\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3001\u65b0\u898f\u767b\u9332\u3092\u884c\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u307e\u305f\u306fGoogle\u30a2\u30ab\u30a6\u30f3\u30c8\u306a\u3069\u3067\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u3067\u304d\u307e\u3059\u304c\u3001\u767b\u9332\u306e\u904e\u7a0b\u3067\u96fb\u8a71\u756a\u53f7\u306b\u3088\u308b\u8a8d\u8a3c\u304c\u6c42\u3081\u3089\u308c\u308b\u70b9\u306b\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002\u8a8d\u8a3c\u7528\u306eSMS\u304c\u5c4a\u304f\u306e\u3067\u3001\u6307\u793a\u306b\u5f93\u3063\u3066\u756a\u53f7\u3092\u5165\u529b\u3059\u308c\u3070\u767b\u9332\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"API\"><span style=\"font-weight: 400;\">API\u30ad\u30fc\u306e\u767a\u884c<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u30a2\u30ab\u30a6\u30f3\u30c8\u767b\u9332\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u53f3\u4e0a\u306e\u30a2\u30a4\u30b3\u30f3\u304b\u3089\u300c<span style=\"text-decoration: underline;\">View API keys<\/span>\u300d\u3092\u9078\u629e\u3057\u3001\u65b0\u3057\u3044\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u30ad\u30fc\u3092\u767a\u884c\u3057\u307e\u3059\u3002\u3053\u306eAPI\u30ad\u30fc\u306f\u767a\u884c\u6642\u306b\u4e00\u5ea6\u3060\u3051\u8868\u793a\u3055\u308c\u3001\u305d\u306e\u5f8c\u306f\u518d\u78ba\u8a8d\u3067\u304d\u306a\u3044\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u8868\u793a\u3055\u308c\u305f\u6642\u70b9\u3067\u5fc5\u305a\u30b3\u30d4\u30fc\u3057\u3001\u5b89\u5168\u306a\u5834\u6240\u306b\u4fdd\u7ba1\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u8aa4\u3063\u3066\u7b2c\u4e09\u8005\u306b\u6d41\u51fa\u3055\u305b\u308b\u3068\u4e0d\u6b63\u5229\u7528\u306b\u3064\u306a\u304c\u308b\u6050\u308c\u304c\u3042\u308b\u305f\u3081\u3001\u30b3\u30fc\u30c9\u306b\u76f4\u63a5\u66f8\u304d\u8fbc\u307e\u305a\u3001\u74b0\u5883\u5909\u6570\u306a\u3069\u3067\u7ba1\u7406\u3059\u308b\u306e\u304c\u57fa\u672c\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i\"><span style=\"font-weight: 400;\">\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">API\u30ad\u30fc\u3092\u53d6\u5f97\u3057\u305f\u3089\u3001Python\u5074\u3067OpenAI\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\uff08\u307e\u305f\u306f\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\uff09\u3067\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">pip install openai<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3042\u308f\u305b\u3066\u3001API\u30ad\u30fc\u3092\u74b0\u5883\u5909\u6570\u3068\u3057\u3066\u8aad\u307f\u8fbc\u3080\u305f\u3081\u306b\u4f7f\u3046\u300c<strong><span style=\"color: #ff0000;\">python-dotenv<\/span><\/strong>\u300d\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304f\u3068\u4fbf\u5229\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">pip install python-dotenv<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"API-2\"><span style=\"font-weight: 400;\">API\u30ad\u30fc\u3092\u6271\u3046\u4e0a\u3067\u306e\u6ce8\u610f\u70b9<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">API\u30ad\u30fc\u306f\u3044\u308f\u3070\u300c<span style=\"text-decoration: underline;\">\u30b5\u30fc\u30d3\u30b9\u306e\u5408\u9375<\/span>\u300d\u3067\u3059\u3002GitHub\u306a\u3069\u306e\u516c\u958b\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u305d\u306e\u307e\u307e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u3057\u307e\u3046\u3068\u3001\u7b2c\u4e09\u8005\u306b\u4e0d\u6b63\u5229\u7528\u3055\u308c\u9ad8\u984d\u8acb\u6c42\u306b\u3064\u306a\u304c\u308b\u30b1\u30fc\u30b9\u3082\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u300c<strong><span style=\"color: #ff0000;\">.gitignore<\/span><\/strong>\u300d\u306b\u300c<strong><span style=\"color: #ff0000;\">.env<\/span><\/strong>\u300d\u3092\u8ffd\u52a0\u3057\u3066\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u304b\u3089\u9664\u5916\u3059\u308b\u3001\u5b9a\u671f\u7684\u306b\u30ad\u30fc\u3092\u518d\u767a\u884c\u3059\u308b\u3068\u3044\u3063\u305f\u5bfe\u7b56\u3092\u7fd2\u6163\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"PythonChatGPT_API\"><span style=\"font-weight: 400;\">Python\u304b\u3089ChatGPT API\u3092\u547c\u3073\u51fa\u3059\u57fa\u672c\u30b3\u30fc\u30c9<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-3848 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-29.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-29.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-29-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"env\"><span style=\"font-weight: 400;\">.env\u30d5\u30a1\u30a4\u30eb\u306e\u6e96\u5099<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u300c.env\u300d\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u4e2d\u306b\u53d6\u5f97\u3057\u305fAPI\u30ad\u30fc\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">OPENAI_API_KEY=&#8221;\u3053\u3053\u306b\u53d6\u5f97\u3057\u305fAPI\u30ad\u30fc\u3092\u8cbc\u308a\u4ed8\u3051\u308b&#8221;<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-2\"><span style=\"font-weight: 400;\">\u57fa\u672c\u30b3\u30fc\u30c9\u306e\u5b9f\u88c5<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u6b21\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u300cmain.py\u300d\u306a\u3069\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u4fdd\u5b58\u3057\u3001\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">import openai<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">import os<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from dotenv import load_dotenv<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">load_dotenv()<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">openai.api_key = os.getenv(&#8220;OPENAI_API_KEY&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">response = openai.ChatCompletion.create(<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0model=&#8221;gpt-3.5-turbo&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0messages=[<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{&#8220;role&#8221;: &#8220;system&#8221;, &#8220;content&#8221;: &#8220;\u3042\u306a\u305f\u306f\u89aa\u5207\u306a\u30a2\u30b7\u30b9\u30bf\u30f3\u30c8\u3067\u3059\u3002&#8221;},<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{&#8220;role&#8221;: &#8220;user&#8221;, &#8220;content&#8221;: &#8220;\u8cea\u554f\u5185\u5bb9&#8221;}<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0]<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">print(response[&#8216;choices&#8217;][0][&#8216;message&#8217;][&#8216;content&#8217;])<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-3\"><span style=\"font-weight: 400;\">\u5b9f\u884c\u7d50\u679c\u306e\u78ba\u8a8d<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u8cea\u554f\u5185\u5bb9\u306e\u90e8\u5206\u3092\u4efb\u610f\u306e\u8cea\u554f\u6587\u306b\u66f8\u304d\u63db\u3048\u3066\u5b9f\u884c\u3059\u308b\u3068\u3001ChatGPT\u304b\u3089\u306e\u56de\u7b54\u304c\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u6210\u304c\u3001Python\u3092\u4f7f\u3063\u3066ChatGPT API\u3092\u547c\u3073\u51fa\u3059\u969b\u306e\u57fa\u672c\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u300c<strong><span style=\"color: #ff0000;\">model<\/span><\/strong>\u300d\u306b\u6307\u5b9a\u3059\u308b\u6587\u5b57\u5217\u3092\u5909\u66f4\u3059\u308c\u3070\u3001\u3088\u308a\u9ad8\u6027\u80fd\u306a\u4e0a\u4f4d\u30e2\u30c7\u30eb\u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"i-4\"><span style=\"font-weight: 400;\">\u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8\u3092\u4f5c\u3063\u3066\u307f\u3088\u3046<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-3850 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-30.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-30.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-30-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u57fa\u672c\u306e\u30b3\u30fc\u30c9\u304c\u52d5\u304f\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u305f\u3089\u3001\u6b21\u306fWeb\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u52d5\u304f\u7c21\u5358\u306a\u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u3053\u3053\u3067\u306fPython\u306e\u8efd\u91cf\u306aWeb\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3042\u308b\u300c<span style=\"color: #ff0000;\"><strong>Flask<\/strong><\/span>\u300d\u3092\u4f7f\u3044\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3057\u305f\u8cea\u554f\u306b\u5bfe\u3057\u3066ChatGPT\u304c\u56de\u7b54\u3059\u308b\u30a2\u30d7\u30ea\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-5\"><span style=\"font-weight: 400;\">\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u6e96\u5099<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Flask\u3092\u4f7f\u3046\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u8ffd\u52a0\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">pip install flask<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"apppy\"><span style=\"font-weight: 400;\">\u30b5\u30fc\u30d0\u30fc\u5074\u306e\u30b3\u30fc\u30c9\uff08app.py\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u5148\u307b\u3069\u3068\u540c\u69d8\u306b\u300c.env\u300d\u30d5\u30a1\u30a4\u30eb\u306bAPI\u30ad\u30fc\u3092\u4fdd\u5b58\u3057\u305f\u3046\u3048\u3067\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u300capp.py\u300d\u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #0000ff;\"><span style=\"font-weight: 400;\">from flask import Flask, request, render_template<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> import openai<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> import os<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> from dotenv import load_dotenv<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">\u00a0 <\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> load_dotenv()<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> openai.api_key = os.getenv(&#8220;OPENAI_API_KEY&#8221;)<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> app = Flask(__name__)<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">\u00a0 <\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> @app.route(&#8220;\/&#8221;, methods=[&#8220;GET&#8221;, &#8220;POST&#8221;])<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> def index():<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 answer = &#8220;&#8221;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 if request.method == &#8220;POST&#8221;:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 user_input = request.form[&#8220;question&#8221;]<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 response = openai.ChatCompletion.create(<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 model=&#8221;gpt-3.5-turbo&#8221;,<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 messages=[<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 {&#8220;role&#8221;: &#8220;system&#8221;, &#8220;content&#8221;: &#8220;\u3042\u306a\u305f\u306f\u89aa\u5207\u306a\u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8\u3067\u3059\u3002&#8221;},<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 {&#8220;role&#8221;: &#8220;user&#8221;, &#8220;content&#8221;: user_input}<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ]<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 )<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 answer = response[&#8220;choices&#8221;][0][&#8220;message&#8221;][&#8220;content&#8221;]<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 return render_template(&#8220;index.html&#8221;, answer=answer)<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">\u00a0 <\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> if __name__ == &#8220;__main__&#8221;:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 app.run(debug=True)<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u8cea\u554f\u3092\u9001\u4fe1\u3059\u308b\u3068\u300c\/\u300d\u306e\u30eb\u30fc\u30c8\u304cPOST\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308a\u3001\u5165\u529b\u3055\u308c\u305f\u8cea\u554f\u6587\u3092ChatGPT API\u306b\u6e21\u3057\u3066\u56de\u7b54\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u53d6\u5f97\u3057\u305f\u56de\u7b54\u306f\u300canswer\u300d\u3068\u3044\u3046\u5909\u6570\u306b\u683c\u7d0d\u3055\u308c\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5074\u306b\u6e21\u3055\u308c\u3066\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u308b\u4ed5\u7d44\u307f\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"templatesindexhtml\"><span style=\"font-weight: 400;\">\u753b\u9762\u5074\u306e\u30b3\u30fc\u30c9\uff08templates\/index.html\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u300ctemplates\u300d\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u4e2d\u306b\u300cindex.html\u300d\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002\u30d5\u30a9\u30fc\u30e0\u3067\u8cea\u554f\u3092\u53d7\u3051\u4ed8\u3051\u3001\u56de\u7b54\u304c\u3042\u308c\u3070\u753b\u9762\u306b\u8868\u793a\u3059\u308b\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u6210\u306b\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #0000ff;\"><span style=\"font-weight: 400;\">&lt;!DOCTYPE html&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> &lt;html lang=&#8221;ja&#8221;&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> &lt;head&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 &lt;meta charset=&#8221;UTF-8&#8243;&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 &lt;title&gt;\u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8&lt;\/title&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> &lt;\/head&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> &lt;body&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 &lt;h1&gt;\u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8&lt;\/h1&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 &lt;form method=&#8221;POST&#8221;&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 &lt;input type=&#8221;text&#8221; name=&#8221;question&#8221; placeholder=&#8221;\u8cea\u554f\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044&#8221;&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 &lt;button type=&#8221;submit&#8221;&gt;\u9001\u4fe1&lt;\/button&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 &lt;\/form&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 {% if answer %}<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 &lt;p&gt;\u56de\u7b54\uff1a{{ answer }}&lt;\/p&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> \u00a0 {% endif %}<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> &lt;\/body&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"> &lt;\/html&gt;<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-6\"><span style=\"font-weight: 400;\">\u5b9f\u884c\u3057\u3066\u307f\u3088\u3046<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u305f\u3089\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">python app.py<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u5b9f\u884c\u5f8c\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u300c<span style=\"text-decoration: underline;\">http:\/\/127.0.0.1:5000\/<\/span>\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u8cea\u554f\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u8cea\u554f\u3092\u5165\u529b\u3057\u3066\u9001\u4fe1\u3059\u308b\u3068\u3001ChatGPT\u304c\u751f\u6210\u3057\u305f\u56de\u7b54\u304c\u30da\u30fc\u30b8\u4e0a\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u306e\u3088\u3046\u306b\u3001\u308f\u305a\u304b\u6570\u5341\u884c\u306e\u30b3\u30fc\u30c9\u3067\u3082\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u4f7f\u3048\u308b\u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8\u3092\u69cb\u7bc9\u3067\u304d\u308b\u306e\u304c\u3001ChatGPT API\u306e\u5927\u304d\u306a\u9b45\u529b\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"i-7\"><span style=\"font-weight: 400;\">\u3082\u3063\u3068\u4fbf\u5229\u306b\u4f7f\u3046\u305f\u3081\u306e\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-3852 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-31.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-31.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-31-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u6700\u5c0f\u69cb\u6210\u306e\u30dc\u30c3\u30c8\u304c\u52d5\u304f\u3088\u3046\u306b\u306a\u3063\u305f\u3089\u3001\u6b21\u306fChatGPT API\u306a\u3089\u3067\u306f\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3084\u5de5\u592b\u3092\u53d6\u308a\u5165\u308c\u3066\u3001\u3088\u308a\u5b9f\u7528\u7684\u306a\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3078\u3068\u767a\u5c55\u3055\u305b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-8\"><span style=\"font-weight: 400;\">\u30b7\u30b9\u30c6\u30e0\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u4eba\u683c\u30fb\u5f79\u5272\u3092\u8a2d\u5b9a\u3059\u308b<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u300c<span style=\"color: #ff0000;\"><strong>system<\/strong><\/span>\u300d\u30ed\u30fc\u30eb\u306b\u6e21\u3059\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5909\u66f4\u3059\u308b\u3060\u3051\u3067\u3001\u30dc\u30c3\u30c8\u306e\u56de\u7b54\u306e\u65b9\u5411\u6027\u3092\u5927\u304d\u304f\u5909\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u4f8b\u3048\u3070\u300c\u3042\u306a\u305f\u306f\u88fd\u54c1\u30de\u30cb\u30e5\u30a2\u30eb\u306b\u8a73\u3057\u3044\u30b5\u30dd\u30fc\u30c8\u62c5\u5f53\u8005\u3067\u3059\u300d\u306e\u3088\u3046\u306b\u5177\u4f53\u7684\u306a\u5f79\u5272\u3092\u4e0e\u3048\u308b\u3068\u3001\u30b5\u30dd\u30fc\u30c8\u7a93\u53e3\u306b\u9069\u3057\u305f\u53e3\u8abf\u3084\u5185\u5bb9\u306e\u56de\u7b54\u304c\u8fd4\u3063\u3066\u304f\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-9\"><span style=\"font-weight: 400;\">\u4f1a\u8a71\u5c65\u6b74\u3092\u4fdd\u6301\u3057\u3066\u81ea\u7136\u306a\u5bfe\u8a71\u306b\u3059\u308b<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u5148\u307b\u3069\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u8cea\u554f\u3092\u9001\u308b\u305f\u3073\u306b\u65b0\u3057\u3044\u4f1a\u8a71\u3068\u3057\u3066\u6271\u308f\u308c\u308b\u305f\u3081\u3001\u524d\u306e\u767a\u8a00\u5185\u5bb9\u3092\u8e0f\u307e\u3048\u305f\u8fd4\u7b54\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u300c<span style=\"color: #ff0000;\"><strong>messages<\/strong><\/span>\u300d\u306e\u30ea\u30b9\u30c8\u306b\u3053\u308c\u307e\u3067\u306e\u3084\u308a\u53d6\u308a\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304f\u3053\u3068\u3067\u3001\u6587\u8108\u3092\u7dad\u6301\u3057\u305f\u81ea\u7136\u306a\u4f1a\u8a71\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u4f8b\u3048\u3070\u3001\u76f4\u524d\u306e\u30e6\u30fc\u30b6\u30fc\u767a\u8a00\u3068\u30a2\u30b7\u30b9\u30bf\u30f3\u30c8\u306e\u8fd4\u7b54\u3092\u914d\u5217\u306b\u4fdd\u6301\u3057\u3001\u6b21\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u3042\u308f\u305b\u3066\u6e21\u3059\u5f62\u306b\u3059\u308b\u3068\u3001\u4f1a\u8a71\u306e\u6d41\u308c\u3092\u8e0f\u307e\u3048\u305f\u56de\u7b54\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"temperature\"><span style=\"font-weight: 400;\">temperature\u3067\u56de\u7b54\u306e\u500b\u6027\u3092\u8abf\u6574\u3059\u308b<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">API\u306b\u306f\u300c<span style=\"color: #ff0000;\"><strong>temperature<\/strong><\/span>\u300d\u3068\u3044\u3046\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u3042\u308a\u30010\u304b\u30892\u306e\u7bc4\u56f2\u3067\u5024\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002\u5024\u3092\u4f4e\u304f\u3059\u308b\u3068\u4e00\u8cab\u6027\u306e\u3042\u308b\u5805\u5b9f\u306a\u56de\u7b54\u306b\u306a\u308a\u3001\u5024\u3092\u9ad8\u304f\u3059\u308b\u3068\u5275\u9020\u7684\u3067\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u8c4a\u304b\u306a\u56de\u7b54\u304c\u8fd4\u308a\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">FAQ\u30dc\u30c3\u30c8\u306e\u3088\u3046\u306b\u6b63\u78ba\u3055\u3092\u91cd\u8996\u3059\u308b\u7528\u9014\u3067\u306f\u4f4e\u3081\u306e\u5024\u3001\u30a2\u30a4\u30c7\u30a2\u51fa\u3057\u306e\u3088\u3046\u306a\u7528\u9014\u3067\u306f\u9ad8\u3081\u306e\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3068\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-10\"><span style=\"font-weight: 400;\">\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u8ffd\u52a0\u3059\u308b<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u5b9f\u969b\u306b\u904b\u7528\u3059\u308b\u969b\u306f\u3001\u901a\u4fe1\u30a8\u30e9\u30fc\u3084API\u306e\u5229\u7528\u5236\u9650\u8d85\u904e\u306a\u3069\u3001\u60f3\u5b9a\u5916\u306e\u30c8\u30e9\u30d6\u30eb\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u300ctry\u300d\u3068\u300cexcept\u300d\u3092\u4f7f\u3063\u3066API\u547c\u3073\u51fa\u3057\u3092\u56f2\u307f\u3001\u30a8\u30e9\u30fc\u767a\u751f\u6642\u306b\u306f\u30e6\u30fc\u30b6\u30fc\u3078\u308f\u304b\u308a\u3084\u3059\u3044\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3068\u3001\u30a2\u30d7\u30ea\u5168\u4f53\u304c\u7a81\u7136\u505c\u6b62\u3057\u3066\u3057\u307e\u3046\u4e8b\u614b\u3092\u9632\u3052\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"i-11\"><span style=\"font-weight: 400;\">\u5229\u7528\u6642\u306b\u77e5\u3063\u3066\u304a\u304d\u305f\u3044\u6ce8\u610f\u70b9<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-3855 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-32.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-32.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT-_ASIA-32-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-12\"><span style=\"font-weight: 400;\">\u6599\u91d1\u4f53\u7cfb\u3068\u30b3\u30b9\u30c8\u7ba1\u7406<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">ChatGPT API\u306f\u4f7f\u7528\u3057\u305f\u30c8\u30fc\u30af\u30f3\u6570\u306b\u5fdc\u3058\u3066\u8ab2\u91d1\u3055\u308c\u308b\u5f93\u91cf\u8ab2\u91d1\u5236\u3067\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u30e2\u30c7\u30eb\u306e\u7a2e\u985e\u306b\u3088\u3063\u3066\u5358\u4fa1\u3082\u7570\u306a\u308b\u305f\u3081\u3001\u30a2\u30af\u30bb\u30b9\u6570\u304c\u591a\u3044\u30b5\u30fc\u30d3\u30b9\u306b\u7d44\u307f\u8fbc\u3080\u5834\u5408\u306f\u3001\u60f3\u5b9a\u3055\u308c\u308b\u5229\u7528\u91cf\u306b\u5fdc\u3058\u305f\u30b3\u30b9\u30c8\u3092\u4e8b\u524d\u306b\u8a66\u7b97\u3057\u3066\u304a\u304f\u3053\u3068\u304c\u5927\u5207\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-13\"><span style=\"font-weight: 400;\">\u30ec\u30fc\u30c8\u5236\u9650\u306b\u3064\u3044\u3066<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">OpenAI API\u306b\u306f\u3001\u4e00\u5b9a\u6642\u9593\u3042\u305f\u308a\u306b\u9001\u4fe1\u3067\u304d\u308b\u30ea\u30af\u30a8\u30b9\u30c8\u6570\u3084\u30c8\u30fc\u30af\u30f3\u6570\u306b\u4e0a\u9650\u304c\u8a2d\u3051\u3089\u308c\u3066\u3044\u307e\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u30a2\u30af\u30bb\u30b9\u304c\u96c6\u4e2d\u3059\u308b\u30a2\u30d7\u30ea\u3067\u306f\u3001\u3053\u306e\u4e0a\u9650\u306b\u9054\u3057\u3066\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u3082\u3042\u308b\u305f\u3081\u3001\u30ea\u30c8\u30e9\u30a4\u51e6\u7406\u3092\u7d44\u307f\u8fbc\u3093\u3060\u308a\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u4e0a\u4f4d\u30d7\u30e9\u30f3\u3078\u306e\u5909\u66f4\u3092\u691c\u8a0e\u3057\u305f\u308a\u3059\u308b\u3068\u5b89\u5b9a\u3057\u305f\u904b\u7528\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-14\"><span style=\"font-weight: 400;\">\u500b\u4eba\u60c5\u5831\u306e\u53d6\u308a\u6271\u3044<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3057\u305f\u5185\u5bb9\u306fAPI\u3092\u901a\u3058\u3066\u5916\u90e8\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u4fe1\u3055\u308c\u307e\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u500b\u4eba\u60c5\u5831\u3084\u6a5f\u5bc6\u60c5\u5831\u3092\u6271\u3046\u30b5\u30fc\u30d3\u30b9\u306b\u7d44\u307f\u8fbc\u3080\u5834\u5408\u306f\u3001\u5229\u7528\u898f\u7d04\u3084\u30d7\u30e9\u30a4\u30d0\u30b7\u30fc\u30dd\u30ea\u30b7\u30fc\u3092\u78ba\u8a8d\u3057\u305f\u3046\u3048\u3067\u3001\u5165\u529b\u5185\u5bb9\u306e\u53d6\u308a\u6271\u3044\u306b\u3064\u3044\u3066\u30e6\u30fc\u30b6\u30fc\u306b\u660e\u793a\u3057\u3066\u304a\u304f\u3068\u5b89\u5fc3\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"i-15\"><span style=\"font-weight: 400;\">\u307e\u3068\u3081<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">\u672c\u8a18\u4e8b\u3067\u306f\u3001OpenAI API\u306e\u6e96\u5099\u304b\u3089Python\u3067\u306eChatGPT API\u547c\u3073\u51fa\u3057\u3001Flask\u3092\u4f7f\u3063\u305f\u8cea\u554f\u5fdc\u7b54\u30dc\u30c3\u30c8\u306e\u5b9f\u88c5\u3001\u3055\u3089\u306b\u4f1a\u8a71\u5c65\u6b74\u306e\u4fdd\u6301\u3084\u30d1\u30e9\u30e1\u30fc\u30bf\u8abf\u6574\u3068\u3044\u3063\u305f\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u3092\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">API\u30ad\u30fc\u306e\u53d6\u5f97\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u3044\u3063\u305f\u6e96\u5099\u3055\u3048\u6e08\u307e\u305b\u3066\u3057\u307e\u3048\u3070\u3001\u547c\u3073\u51fa\u3057\u81ea\u4f53\u306f\u6570\u884c\u306e\u30b3\u30fc\u30c9\u3067\u5b9f\u73fe\u3067\u304d\u3001\u6c7a\u3057\u3066\u96e3\u3057\u3044\u3082\u306e\u3067\u306f\u306a\u3044\u3053\u3068\u304c\u304a\u308f\u304b\u308a\u3044\u305f\u3060\u3051\u305f\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u91cd\u8981\u306a\u306e\u306f\u3001\u6700\u521d\u304b\u3089\u5b8c\u74a7\u306a\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u76ee\u6307\u3059\u306e\u3067\u306f\u306a\u304f\u3001\u307e\u305a\u306f\u6700\u5c0f\u69cb\u6210\u3092\u5b9f\u969b\u306b\u52d5\u304b\u3057\u3001API\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u69cb\u9020\u3084\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5f79\u5272\u306b\u6163\u308c\u3066\u3044\u304f\u3053\u3068\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u57fa\u672c\u3092\u62bc\u3055\u3048\u305f\u3046\u3048\u3067\u5de5\u592b\u3092\u91cd\u306d\u3066\u3044\u3051\u3070\u3001\u554f\u3044\u5408\u308f\u305b\u5bfe\u5fdc\u3084\u793e\u5185\u30c4\u30fc\u30eb\u306a\u3069\u3001\u81ea\u5206\u306e\u30a2\u30a4\u30c7\u30a2\u6b21\u7b2c\u3067\u3055\u307e\u3056\u307e\u306a\u5834\u9762\u306b\u5fdc\u7528\u3067\u304d\u308b\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3078\u3068\u767a\u5c55\u3055\u305b\u3066\u3044\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305c\u3072\u672c\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3001\u81ea\u5206\u3060\u3051\u306eChatGPT\u6d3b\u7528\u30a2\u30d7\u30ea\u4f5c\u308a\u306b\u6311\u6226\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/span><\/p>\n<p><br style=\"font-weight: 400;\" \/><br style=\"font-weight: 400;\" \/><\/p>\n<p>\u682a\u5f0f\u4f1a\u793e<a href=\"https:\/\/softasia.jp\/#contact\">3ink<\/a>\u3067\u306f\u3001ChatGPT\u3092\u306f\u3058\u3081\u3068\u3059\u308b\u6700\u5148\u7aefAI\u30fbLLM\uff08\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\uff09\u3092\u6d3b\u7528\u3057\u305fAI\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u306e\u69cb\u7bc9\u304b\u3089\u3001\u65e2\u5b58\u696d\u52d9\u30b7\u30b9\u30c6\u30e0\u30fbWeb\u30a2\u30d7\u30ea\u3078\u306eAPI\u9023\u643a\u958b\u767a\u3001\u3055\u3089\u306b\u306f\u30aa\u30d5\u30b7\u30e7\u30a2\u958b\u767a\u3092\u6d3b\u304b\u3057\u305f\u30b3\u30b9\u30c8\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u9ad8\u3044\u30b7\u30b9\u30c6\u30e0\u69cb\u7bc9\u307e\u3067\u5e45\u5e83\u304f\u67d4\u8edf\u306b\u5bfe\u5fdc\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30b7\u30b9\u30c6\u30e0\u958b\u767a\u3084IT\u306b\u95a2\u3059\u308b\u304a\u60a9\u307f\u3001\u3054\u76f8\u8ac7\u304c\u3054\u3056\u3044\u307e\u3057\u305f\u3089\u3001\u3044\u3064\u3067\u3082\u304a\u6c17\u8efd\u306b<a href=\"https:\/\/softasia.jp\/#contact\">3ink<\/a>\u307e\u3067\u304a\u554f\u3044\u5408\u308f\u305b\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; ChatGPT\u306f\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u3082\u624b\u8efd\u306b\u4f7f\u3048\u307e\u3059\u304c\u3001OpenAI\u306eAPI\u3092\u6d3b\u7528\u3059\u308c\u3070\u3055\u3089\u306b\u53ef\u80fd\u6027\u304c\u5e83\u304c\u308a\u307e\u3059\u3002Python\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u7d44\u307f\u8fbc\u3080\u3053\u3068\u3067\u3001\u81ea\u5206\u306e\u7528\u9014\u306b\u5408\u308f\u305b\u305f\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u4f5c\u308c\u308b\u3088\u3046 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":3844,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"jetpack_featured_media_url":"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2026\/08\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-6.png","_links":{"self":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts\/3842"}],"collection":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/comments?post=3842"}],"version-history":[{"count":13,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts\/3842\/revisions"}],"predecessor-version":[{"id":3908,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts\/3842\/revisions\/3908"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/media\/3844"}],"wp:attachment":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/media?parent=3842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/categories?post=3842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/tags?post=3842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}