{"id":5609,"date":"2023-01-10T22:19:02","date_gmt":"2023-01-10T20:19:02","guid":{"rendered":"https:\/\/unitycoder.com\/blog\/?p=5609"},"modified":"2023-01-11T09:16:59","modified_gmt":"2023-01-11T07:16:59","slug":"using-openai-api-with-webrequest-from-unity","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2023\/01\/10\/using-openai-api-with-webrequest-from-unity\/","title":{"rendered":"Using OpenAI API with WebRequest from Unity"},"content":{"rendered":"\n<p>Simple example for calling openAI completions API, with simple webrequest (and JSON data).<\/p>\n\n\n\n<p><strong>Repository:<\/strong><br><a href=\"https:\/\/github.com\/unitycoder\/UnityOpenAIGPT3\">https:\/\/github.com\/unitycoder\/UnityOpenAIGPT3<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"926\" height=\"459\" data-attachment-id=\"5610\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2023\/01\/10\/using-openai-api-with-webrequest-from-unity\/2023-01-10-20-19-38-openai\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?fit=926%2C459&amp;ssl=1\" data-orig-size=\"926,459\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"2023-01-10-20-19-38-openai\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?fit=926%2C459&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?resize=926%2C459&#038;ssl=1\" alt=\"\" class=\"wp-image-5610\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?w=926&amp;ssl=1 926w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?resize=300%2C149&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?resize=768%2C381&amp;ssl=1 768w\" sizes=\"auto, (max-width: 926px) 100vw, 926px\" \/><\/a><\/figure>\n\n\n\n<p><strong>Making of video:<\/strong><br><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/ripsfVDPym0?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Simple example for calling openAI completions API, with simple webrequest (and JSON data). Repository:https:\/\/github.com\/unitycoder\/UnityOpenAIGPT3 Making of video:<\/p>\n","protected":false},"author":1,"featured_media":5610,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[660,420],"tags":[777,1255,1256,1253,1232,1254],"class_list":["post-5609","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-opensource","category-tutorials","tag-api","tag-completions","tag-davinci","tag-gtp3","tag-openai","tag-webrequest"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2023\/01\/2023-01-10-20-19-38-openai.jpg?fit=926%2C459&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-1st","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=5609"}],"version-history":[{"count":2,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5609\/revisions"}],"predecessor-version":[{"id":5613,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5609\/revisions\/5613"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/5610"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=5609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=5609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=5609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}