{"id":17,"date":"2023-07-13T12:24:59","date_gmt":"2023-07-13T03:24:59","guid":{"rendered":"https:\/\/www.pinkgold.space\/?p=17"},"modified":"2024-09-23T17:16:13","modified_gmt":"2024-09-23T08:16:13","slug":"chatgpt-api-%e4%be%8b%e6%96%87%e3%82%92%e8%a9%a6%e3%81%99%e6%97%85-natural-language-to-stripe-api","status":"publish","type":"post","link":"https:\/\/www.pinkgold.space\/?p=17","title":{"rendered":"OpenAI API Examples-Natural language to Stripe API"},"content":{"rendered":"\n<p>Open API Platform\u306eexamples\u3092node.js\u3067\u8a66\u3059\u65c5\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306fNatural language to Stripe\u3092\u8a66\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b5\u30f3\u30d7\u30eb\u306e\u30bd\u30fc\u30b9\u306f\u3053\u3061\u3089\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/platform.openai.com\/examples\/default-stripe-api\">https:\/\/platform.openai.com\/examples\/default-stripe-api<\/a><\/p>\n\n\n\n<p>\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u306e\u307e\u307e\u3060\u3068\u52d5\u304b\u306a\u3044\u306e\u3067\u5c11\u3057\u4fee\u6b63\u3092\u52a0\u3048\u307e\u3059\u3002\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;someone@somewhere stub]$ cat exsamples_Natual_language_to_stripe_api.js\nrequire('dotenv').config();\nconst { Configuration, OpenAIApi } = require(\"openai\");\n\nconst configuration = new Configuration({\n  apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\n\nasync function run(){\n    const response = await openai.createCompletion({\n model: \"text-davinci-003\",\n  prompt: \"\\\"\\\"\\\"\\nUtil exposes the following:\\n\\nutil.stripe() -&gt; authenticates &amp; returns the stripe module; usable as stripe.Charge.create etc\\n\\\"\\\"\\\"\\nimport util\\n\\\"\\\"\\\"\\nCreate a Stripe token using the users credit card: 5555-4444-3333-2222, expiration date 12 \/ 28, cvc 521\\n\\\"\\\"\\\"\",\n  temperature: 0,\n  max_tokens: 100,\n  top_p: 1.0,\n  frequency_penalty: 0.0,\n  presence_penalty: 0.0,\n  stop: &#91;\"\\\"\\\"\\\"\"],\n    });\n\nif (response.data &amp;&amp; response.data.choices &amp;&amp; response.data.choices.length &gt; 0) {\n  console.log(response.data.choices&#91;0].text);\n} else {\n  console.log(\"No response received or empty choices.\");\n}\n\n}\nrun();\n<\/code><\/pre>\n\n\n\n<p>\u5b9f\u884c\u7d50\u679c\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;rocky@www stub]$ node exsamples_Natual_language_to_stripe_api.js\n\n\ntoken = stripe.Token.create(\n    card={\n        \"number\": \"5555-4444-3333-2222\",\n        \"exp_month\": 12,\n        \"exp_year\": 28,\n        \"cvc\": 521\n    },\n)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Open API Platform\u306eexamples\u3092node.js\u3067\u8a66\u3059\u65c5\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306fNatural language to Stripe\u3092\u8a66\u3057\u3066\u307f\u307e\u3059\u3002 \u30b5\u30f3\u30d7\u30eb\u306e\u30bd\u30fc\u30b9\u306f\u3053\u3061\u3089\u306b\u3042\u308a\u307e\u3059\u3002 https:\/\/p &#8230; <a title=\"OpenAI API Examples-Natural language to Stripe API\" class=\"read-more\" href=\"https:\/\/www.pinkgold.space\/?p=17\" aria-label=\"Read more about OpenAI API Examples-Natural language to Stripe API\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-openapi"],"_links":{"self":[{"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=\/wp\/v2\/posts\/17"}],"collection":[{"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":4,"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":30,"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions\/30"}],"wp:attachment":[{"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pinkgold.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}