Skip to content

falman-ai-coding/sample-chatgpt-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

ChatGPT API サンプルコード

このコードは、ReactとNode.js(TypeScript)を使ってChatGPT APIを呼び出すサンプルコードです。なお、OpenAI APIを利用するには料金がかかりますので注意してください。 また、利用にあたっては自己責任でお願いします。

実行方法

  1. npmをインストールしてください。
  2. リポジトリをローカルマシンにクローンしてください。
  3. "back"フォルダ内で「npm install」を実行してください。これにより、Node.jsで実行するために必要なライブラリがダウンロードされます。
  4. "OPENAI_API_KEY"という環境変数にAPIキーを設定してください。
  5. "back"フォルダ内で「npm start」を実行してください。
  6. ブラウザから http://localhost:8000 にアクセスしてください。

その他の注意点

  • このコードはデモ目的であり、本番環境にデプロイするには修正が必要な場合があります。
  • APIキーの取得方法や価格についてはOpenAI APIのドキュメントを参照してください。

ChatGPT API Sample Code

This is a sample source code that utilizes React and Node.js (TypeScript) to call the ChatGPT API. Please note that there will be a charge for using the OpenAI API.

How to Run

  1. Install npm.
  2. Clone the repository to your local machine.
  3. Run "npm install" in the "back" folder. This will download the necessary libraries required to run as Node.js.
  4. Configure the API key in the "OPENAI_API_KEY" environment variable.
  5. Run "npm start" in the "back" folder.
  6. Access "http://localhost:8000" from your browser.

Additional Notes

  • This code is for demonstration purposes only and may require modifications to be deployed in production environments.
  • Please refer to the OpenAI API documentation for information on how to obtain an API key and pricing.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published