{"id":2369,"date":"2025-04-29T14:21:47","date_gmt":"2025-04-29T05:21:47","guid":{"rendered":"https:\/\/www.avelio.co.jp\/math\/wordpress\/?p=2369"},"modified":"2025-04-29T14:28:16","modified_gmt":"2025-04-29T05:28:16","slug":"chatgpt%e3%81%aeimage-generation-api%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/www.avelio.co.jp\/math\/wordpress\/?p=2369","title":{"rendered":"ChatGPT\u306eImage Generation API\u3092\u4f7f\u3063\u3066\u307f\u305f"},"content":{"rendered":"\n<p>ChatGPT 4o\u306eImage Generation\u306fAPI\u304c\u4f7f\u3048\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001GPT Image 1<br>\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\uff01<br><a href=\"https:\/\/platform.openai.com\/docs\/models\/gpt-image-1\">https:\/\/platform.openai.com\/docs\/models\/gpt-image-1<\/a><\/p>\n\n\n\n<p>\uff11\uff0eAPI\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u6e96\u5099<\/p>\n\n\n\n<p><a href=\"https:\/\/platform.openai.com\/\">https:\/\/platform.openai.com\/<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066API\u30ad\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br>\u753b\u9762\u5de6\u5074\u306e\u30e1\u30cb\u30e5\u30fc\u306bAPI Keys\u306e\u30e1\u30cb\u30e5\u30fc\u304c\u51fa\u3066\u3044\u306a\u3044\u65b9\u306f\u3001\u5148\u306bAPI\u306e\u5229\u7528\u767b\u9332\u3068\u8ab2\u91d1\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3088\u3046\u3067\u3059\uff01<br>\u307e\u305f\u3001GPT Image 1\u3092\u4f7f\u3046\u305f\u3081\u306b\u306f\u3001Organization\u306e Verification\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002API\u30a2\u30af\u30bb\u30b9\u304c\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u5834\u5408\u306f\u3001\u30e1\u30cb\u30e5\u30fc\u304b\u3089General\u2192Organization settings\u306e\u4e2d\u306e\u300cVerifications\u300d\u306e\u6240\u306e\u30dc\u30bf\u30f3\u3092\u304a\u3057\u3066\u7533\u8acb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u8eab\u5206\u8a3c\u660e\u66f8\u3068\u9854\u52d5\u753b\u3092\u64ae\u5f71\u3057\u3066\u7533\u8acb\u3057\u305f\u3089\u300115\u5206\u4f4d\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\uff12\uff0eGoogle colab\u3067\u30b3\u30fc\u30c9\u3092\u304b\u304f<\/p>\n\n\n\n<p>\u6b21\u306bGoogle colab\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002ChatGPT\u306b\u300cGPT Image 1 API\u306e\u4f7f\u3044\u65b9\u3092\u6559\u3048\u3066\u300d\u3068\u805e\u304d\u307e\u3057\u305f\u304c\u3061\u3083\u3093\u3068\u6559\u3048\u3066\u304f\u308c\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u30ea\u30f3\u30af\u3082\u6307\u5b9a\u3057\u3066\u300c\u3053\u3061\u3089\u306e\u30ea\u30f3\u30af\u306b\u3042\u308bGPT Image 1\u3067\u753b\u50cf\u3092\u751f\u6210\u3059\u308bPython\u30b3\u30fc\u30c9\u3092\u6559\u3048\u3066\u300d\u3068\u3044\u3063\u305f\u3089\u3061\u3083\u3093\u3068\u6559\u3048\u3066\u304f\u308c\u307e\u3057\u305f\u3002<br><\/p>\n\n\n\n<p>\u6b21\u304c\u5165\u529b\u3057\u305f\u30b3\u30fc\u30c9\u3067\u3059<br>\u203b&#8217;Your API KEY&#8217;\u306e\u3068\u3053\u308d\u306f\u3001\uff11\u3067\u4f5c\u6210\u3057\u305fAPI\u30ad\u30fc\u3092\u5165\u308c\u307e\u3059<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install openai\n\nfrom openai import OpenAI\nfrom PIL import Image\nimport IPython.display as display\nfrom io import BytesIO\nimport base64\n\nAPI_KEY='Your API KEY'\n\nclient = OpenAI(api_key=API_KEY)\nprompt = \"\"\"\n\u53ef\u611b\u3044\u5b50\u732b\u306e\uff14\u30b3\u30de\u6f2b\u753b\u3092\u753b\u50cf\u3067\u751f\u6210\u3057\u3066\n\"\"\"\nresult = client.images.generate(\n    model=\"gpt-image-1\",\n    prompt=prompt\n)\n\nimage_base64 = result.data&#91;0].b64_json\nimage_bytes = base64.b64decode(image_base64)\nimage = Image.open(BytesIO(image_bytes))\ndisplay.display(image)<\/code><\/pre>\n\n\n\n<p>\u4f5c\u6210\u3057\u3066\u304f\u308c\u305f\u753b\u50cf\u304c\u3053\u3061\u3089<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"768\" src=\"https:\/\/www.avelio.co.jp\/math\/wordpress\/wp-content\/uploads\/2025\/04\/cat4panel.png\" alt=\"\" class=\"wp-image-2391\" style=\"width:365px;height:auto\"\/><\/figure>\n<\/div>\n\n\n<p>\u4f5c\u3063\u3066\u306f\u304f\u308c\u305f\u3051\u3069\u3001\u30bb\u30ea\u30d5\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br>\u305d\u3053\u3067\u3001\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u300c\u53ef\u611b\u3044\u5b50\u732b\u306e\u30bb\u30ea\u30d5\u4ed8\u304d\u306e\uff14\u30b3\u30de\u6f2b\u753b\u3092\u753b\u50cf\u3067\u751f\u6210\u3057\u3066\u300d\u306b\u5909\u3048\u3066\u307f\u308b\u3068\u30fb\u30fb\u30fb<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"768\" src=\"https:\/\/www.avelio.co.jp\/math\/wordpress\/wp-content\/uploads\/2025\/04\/cat4panel2.png\" alt=\"\" class=\"wp-image-2381\" style=\"width:376px;height:auto\"\/><\/figure>\n<\/div>\n\n\n<p>\u4eca\u5ea6\u306f\u3001\u30bb\u30ea\u30d5\u4ed8\u304d\u3067\u4f5c\u3063\u3066\u304f\u308c\u307e\u3057\u305f\uff01<br>\u305f\u3060\u3001\u4ee5\u524d\u306bChatGPT 4o\u306eWebUI\u304b\u3089\u30bb\u30ea\u30d5\u3068\u753b\u50cf\u3092\u5225\u3005\u306b\u4f5c\u3063\u3066\u3082\u3089\u3063\u305f\u3068\u304d\u3088\u308a\u30bb\u30ea\u30d5\u304c\u77ed\u304f\u3066\u3042\u3063\u3055\u308a\u3057\u3066\u3044\u308b\u3057\u3042\u307e\u308a\u9762\u767d\u307f\u304c\u7121\u3044\u306e\u3067\u3001\u4eca\u5ea6\u306f\u300c\u98fc\u3044\u4e3b\u3068\u732b\u306e\u53ef\u611b\u304f\u3066\u9762\u767d\u3044\u3084\u308a\u53d6\u308a\u306e\u30bb\u30ea\u30d5\u4ed8\u304d\u306e\uff14\u30b3\u30de\u6f2b\u753b\u3092\u751f\u6210\u3057\u3066\u300d\u306e\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u751f\u6210\u3055\u308c\u305f\u753b\u50cf\u306f\u3053\u3061\u3089<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"768\" src=\"https:\/\/www.avelio.co.jp\/math\/wordpress\/wp-content\/uploads\/2025\/04\/cat4panel3.png\" alt=\"\" class=\"wp-image-2386\" style=\"width:343px;height:auto\"\/><\/figure>\n<\/div>\n\n\n<p>\uff14\u30b3\u30de\u306b\u306a\u3063\u3066\u306a\u3044\u3057\u3001\uff14\u30b3\u30de\u6f2b\u753b\u3068\u3057\u3066\u306f\u8272\u3005\u5931\u6557\u3057\u3066\u307e\u3059\u306d\u3002\u3002<br>\u3084\u306f\u308a\u30bb\u30ea\u30d5\u90e8\u5206\u3092\u5148\u306b\u751f\u6210\u3057\u3066\u3001\u305d\u306e\u5f8c\u305d\u308c\u306b\u753b\u50cf\u3092\u4ed8\u3051\u3066\u3082\u3089\u3046\u307b\u3046\u304c\u6210\u529f\u7387\u304c\u9ad8\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u9762\u767d\u3044\uff14\u30b3\u30de\u6f2b\u753b\u306e\u751f\u6210\u306f\u3061\u3087\u3063\u3068\u5931\u6557\u3067\u3057\u305f\u304c\u3001ChatGPT 4o\u306eWebUI\u3067\u4f5c\u6210\u3057\u305f\u3088\u3046\u306a\u6f2b\u753b\u304cAPI\u3067\u4f5c\u6210\u3067\u304d\u308b\u3053\u3068\u306f\u5206\u304b\u308a\u307e\u3057\u305f\u3002<br>\u6b21\u306f\u3082\u3046\u5c11\u3057\u9ad8\u5ea6\u306a\u3053\u3068\u3092\u3084\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ChatGPT 4o\u306eImage Generation\u306fAPI\u304c\u4f7f\u3048\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001GPT Image 1\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\uff01https:\/\/platform.openai.com\/docs\/mod [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2389,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-2369","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2369"}],"version-history":[{"count":13,"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2369\/revisions"}],"predecessor-version":[{"id":2393,"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2369\/revisions\/2393"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/2389"}],"wp:attachment":[{"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.avelio.co.jp\/math\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}