Python库

我们提供了一个Python库,你可以按如下方式安装:

$pip install openai

安装后,可以使用绑定(the bindings)和API Key运行以下命令:

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)还将安装一个命令行实用程序,你可以按如下方式使用:

$openai api completions。create -m text-davinci-003-p “Say this is a test“-t 0-M 7—stream

Node.js库

我们还有一个Node。js库,你可以通过在Node。js项目目录中运行以下命令来安装它:

$ npm install openai

安装后,您可以使用该库和您的API Key运行以下命令:

const Configuration,OpenAlApi}=

require(‘openai‘)

const configuration = new Configuration({

apiKey:process。env。OPENAI_API_KEY

})

const openai = new OpenAlApi(configuration)

const response await openai。createCompletion({

model:‘text-davinci-003‘

prompt:‘Say this is a test‘,

temperature:0,

max_tokens:7

})

社区库

下面这些库由更广泛的开发人员社区构建和维护。如果你想在此处添加新库,请按照帮助中心中文章中有关添加社区库的说明进行操作。

请注意,OpenA!不会验证这些项目的正确性或安全性。

C#/.NET

Betalgo.OpenAl.GPT3 by Betalgo

Crystal

Openai-Crystal by Sferik

Go

Go-GPT3 by sashabaranov

Java

openai-java by Theo Kanning

Kotlin

openai-kotlin by Mouaad Aallam

Node.js

openai-api by Njerschow

.OpenAl-API-Node by Erlapso

GPT-X by CEIFA

GPT3 by Poteat

GPTS by thencc

@dalenguyen/OpenAl by Dalenguyen

Tectalic/OpenAl by tectalic

PHP

Orhanerday/Open-Al by Orhanerday

Tectalic/OpenAl by tectalic

Python

OthersideAl by OthersideAl

R

RGPT3 by Ben-Aaron188

Ruby

Nileshtrivedi by OpenAl

Alexrudall by Ruby-Openai

Scala

OpenAl-Scala-Client by Cequence-1O

Swift

OpenAlKit by dylanshine

Unity

OpenAi-Api-Unity by hexthedev

Unreal Engine

OpenAl-API-Unreal by KellanM