The OxygenAI Client in Golang is a modul designed to interact with the openai model repository for free and perform inference tasks using state-of-the-art natural language processing models. Developed in Golang, it provides a seamless and efficient way to integrate openai models into your Golang applications.
go get github.com/charlesozo/go-oxygenai
Visit Discord server to get the $OXYGEN_API_KEY
package main
import (
"context"
"fmt"
"os"
oxygenai "github.com/charlesozo/go-oxygenai"
)
func main(){
client := oxygenai.NewClient(os.getenv("OXYGEN_API_TOKEN"))
response, err := client.ChatCompletion(context.Background(), &oxygenai.ChatRequest{
Messages: []oxygenai.ChatMessage{
{
Role: "user",
Content: "write an essay on global warming",
},
},
})
if err != nil{
fmt.Println(err)
return
}
fmt.Println(response.Choices[0].Message.Content)
}
Output:
response goes here