Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Go (Golang) client for Deepseek API. Deepseek Go supports DeepSeek-V3, DeepSeek-R1 and more

License

NotificationsYou must be signed in to change notification settings

go-deepseek/deepseek

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.

go-deepseek-design

Demo

30 seconds deepseek-demo (code):

left-side browser withchat.deepseek.comv/sgo-deepseek in right-side terminal.

go-deepseek.mov

Install

go get github.com/go-deepseek/deepseek

Usage

go-deepseek-flow

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? 😊

Why yet another Go client?

We were looking forDedicated &Simple Go Client for Deepseek API but we didn't find it so we built this one 😃

What's special about this Go client?

  • 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.)

go_pkg_structure

  • 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

Examples

Please check theexamples directory, which showcases each feature of this client.

examples

Buy me a GitHub Star ⭐

If you like our work then please give github star to this repo. 😊


[8]ページ先頭

©2009-2025 Movatter.jp