Yet another API client for api.openai.com.
This library is community-maintained, NOT officially supported by OpenAI.
package main
import (
"fmt"
"github.com/otiai10/openaigo"
)
func main() {
client := openaigo.NewClient(os.Getenv("OPENAI_API_KEY"))
request := openaigo.CompletionRequestBody{
Model: "text-davinci-003",
Prompt: []string{"Say this is a test"},
}
ctx := context.Background()
response, err := client.Completion(ctx, request)
fmt.Println(response, err)
}if you just want to try, hit commands below.
git clone https://github.com/otiai10/openaigo.git
cd openaigo
OPENAI_API_KEY=YourAPIKey go run ./testapp/main.goVisit https://beta.openai.com/account/api-keys and you can create your own API key to get started for free.
- Models
- Completions
- Edits
- Images
- Embeddings
- Files
- Fine-tunes
- Moderation
Engines(deprecated)
Report any issue here or any feedback is welcomed.