- Notifications
You must be signed in to change notification settings - Fork11
Go (Golang) client for Deepseek API. Deepseek Go supports DeepSeek-V3, DeepSeek-R1 and more
License
go-deepseek/deepseek
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Go-deepseek is a Go client for theDeepSeek API; supporting DeepSeek-V3, DeepSeek-R1, and more, with both streaming and non-streaming options. Thisproduction-ready client is actively maintained, with ongoing bug fixes and feature enhancements.
30 seconds deepseek-demo (code):
left-side browser withchat.deepseek.comv/sgo-deepseek in right-side terminal.
go-deepseek.mov
go get github.com/go-deepseek/deepseek
Here’s an example of sending a "Hello Deepseek!" message usingmodel=deepseek-chat
(DeepSeek-V3 model) andstream=false
package mainimport ("context""fmt""github.com/go-deepseek/deepseek""github.com/go-deepseek/deepseek/request")funcmain() {client,_:=deepseek.NewClient("your_deepseek_api_token")chatReq:=&request.ChatCompletionsRequest{Model:deepseek.DEEPSEEK_CHAT_MODEL,Stream:false,Messages: []*request.Message{{Role:"user",Content:"Hello Deepseek!",// set your input message},},}chatResp,err:=client.CallChatCompletionsChat(context.Background(),chatReq)iferr!=nil {fmt.Println("Error =>",err)return}fmt.Printf("output => %s\n",chatResp.Choices[0].Message.Content)}
Try above example:
First, copy above code in `main.go`Replace `your_deepseek_api_token` with valid api token$ go mod init$ go get github.com/go-deepseek/deepseek$ go run main.gooutput => Hello! How can I assist you today? 😊
We were looking forDedicated
&Simple
Go Client for Deepseek API but we didn't find it so we built this one 😃
Simple – Check below, Go package structure with all exported entities. It is as simple as possible. Also, it's Go's idiomatic way - request is under request pkg, response is under response.
Complete – Check below, It offers full support for all APIs, including their complete request and response payloads. (Note: Beta feature support coming soon.)
Reliable – We have implemented numerous Go tests to ensure that all features work correctly at all times.
Performant – Speed is crucial when working with AI models. We have optimized this client to deliver the fastest possible performance.
Important
We know that sometimesDeepseek API is down but we won't let you down.
We haveFake Client
using which you can continue your development and testing even though Deepseek API is down.
Usefake.NewFakeCallbackClient(fake.Callbacks{})
/ See exampleexamples/81-fake-callback-client/main_test.go
Please check theexamples directory, which showcases each feature of this client.
If you like our work then please give github star to this repo. 😊
About
Go (Golang) client for Deepseek API. Deepseek Go supports DeepSeek-V3, DeepSeek-R1 and more