We provide a Python library, which you can install as follows:
我们提供了一个Python库,您可以按如下方式安装:
$ pip install openai
Once installed, you can use the bindings and your secret key to run the following:
安装后,您可以使用绑定和您的密钥运行以下命令:
import os
import openai
# Load your API key from an environment variable or secret management service
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(model="text-davinci-003", prompt="Say this is a test", temperature=0, max_tokens=7)
The bindings also will install a command-line utility you can use as follows:
绑定还将安装一个命令行实用工具,您可以按如下方式使用:
$ openai api completions.create -m text-davinci-003 -p "Say this is a test" -t 0 -M 7 --stream
We also have a Node.js library, which you can install by running the following command in your Node.js project directory:
我们还有一个Node.js库,您可以通过在Node.js项目目录中运行以下命令来安装它:
$ npm install openai
Once installed, you can use the library and your secret key to run the following:
安装后,您可以使用库和密钥运行以下命令:
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: "Say this is a test",
temperature: 0,
max_tokens: 7,
});
The libraries below are built and maintained by the broader developer community. If you’d like to add a new library here, please follow the instructions in our help center article on adding community libraries.
下面的库是由更广泛的开发人员社区构建和维护的。如果您想在此添加新库,请按照帮助中心文章中有关添加社区库的说明进行操作。
Please note that OpenAI does not verify the correctness or security of these projects.
请注意,OpenAI不会验证这些项目的正确性或安全性。
Betalgo.OpenAI.GPT3 by Betalgo
openai-crystal by sferik
go-gpt3 by sashabaranov
openai-java by Theo Kanning
openai-kotlin by Mouaad Aallam
openai-api by Njerschow
openai-api-node by erlapso
gpt-x by ceifa
gpt3 by poteat
gpts by thencc
@dalenguyen/openai by dalenguyen
tectalic/openai by tectalic
orhanerday/open-ai by orhanerday
tectalic/openai by tectalic
chronology by OthersideAI
rgpt3 by ben-aaron188
openai by nileshtrivedi
ruby-openai by alexrudall
openai-scala-client by cequence-io
OpenAIKit by dylanshine
OpenAi-Api-Unity by hexthedev
OpenAI-Api-Unreal by KellanM
如果大家想继续了解人工智能相关学习路线和知识体系,欢迎大家翻阅我的另外一篇博客《重磅 | 完备的人工智能AI 学习——基础知识学习路线,所有资料免关注免套路直接网盘下载》
这篇博客参考了Github知名开源平台,AI技术平台以及相关领域专家:Datawhale,ApacheCN,AI有道和黄海广博士等约有近100G相关资料,希望能帮助到所有小伙伴们。