Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AlmazDelDiablo/gpt3-5-turbo-go
Golang client for official API of ChatGPT (GPT-3.5-turbo)
https://github.com/AlmazDelDiablo/gpt3-5-turbo-go
Last synced: about 2 months ago
JSON representation
Golang client for official API of ChatGPT (GPT-3.5-turbo)
- Host: GitHub
- URL: https://github.com/AlmazDelDiablo/gpt3-5-turbo-go
- Owner: AlmazDelDiablo
- License: mit
- Created: 2023-03-01T19:09:24.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-01T10:20:10.000Z (over 1 year ago)
- Last Synced: 2024-07-31T23:39:46.091Z (4 months ago)
- Language: Go
- Size: 16.6 KB
- Stars: 44
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
- awesome-gpt - GoLang HTTP Client for ChatGPT - Golang client for official API of ChatGPT (GPT-3.5-turbo) (Applications / APIs & Clients)
- awesome-chatgpt-summary - ChatGPT (GPT-3.5-turbo) API Client in Golang
- Awesome-ChatGPT - ChatGPT (GPT-3.5-turbo) API Client in Golang
- awesome-chatgpt - Go
- awesome-chatgpt - ChatGPT (GPT-3.5-turbo) API Client in Golang
- fucking-awesome-chatgpt - ChatGPT (GPT-3.5-turbo) API Client in Golang
- awesome-chatgpt - Go
- awesome-chatgpt-zh - Golang 中的 ChatGPT (GPT-3.5-turbo) API 客户端
README
## GoLang HTTP Client for ChatGPT (GPT-3.5-turbo)
A client for an official API of chat completions (known as ChatGPT) based on `gpt-3.5-turbo` model.
Here's a guide by Open AI: https://platform.openai.com/docs/guides/chat.Created & generated by Sergei Zaikin & OpenAI ChatGPT.
### Install
`go get github.com/AlmazDelDiablo/gpt3-5-turbo-go`### Usage
```go
package mainimport (
gpt35 "github.com/AlmazDelDiablo/gpt3-5-turbo-go"
)func main() {
c, _ := gpt35.NewClient("sk-xxxxxxxxxxxxxxxxxxxx")
req := &gpt35.Request{
Model: gpt35.ModelGpt35Turbo,
Messages: []*gpt35.Message{
{
Role: gpt35.RoleUser,
Content: "Hello",
},
},
}resp, err := c.GetChat(req)
if err != nil {
panic(err)
}println(resp.Choices[0].Message.Content)
println(resp.Usage.PromptTokens)
println(resp.Usage.CompletionTokens)
println(resp.Usage.TotalTokens)
}```