Go DeepSeek
This library provides unofficial Go clients for DeepSeek. We support:
- deepseek-chat
Installation
go get github.com/p9966/go-deepseek
Currently, go-deepseek requires Go version 1.23.5 or greater.
Usage
example usage:
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/p9966/go-deepseek"
)
func main() {
client := deepseek.NewClient(os.Getenv("deepseek token"))
request := deepseek.ChatCompletionRequest{
Model: deepseek.DeepSeekChat,
Messages: []deepseek.ChatCompletionMessage{
{
Role: deepseek.ChatMessageRoleUser,
Content: "Hello!",
},
},
}
ctx := context.Background()
resp, err := client.CreateChatCompletion(ctx, &request)
if err != nil {
log.Fatalf("ChatCompletion failed: %v", err)
}
fmt.Println(resp.Choices[0].Message.Content)
}
Getting an DeepSeek API Key:
- Visit the DeepSeek website at https://www.deepseek.com/.
- If you don’t have an account, click on “Sign Up” to create one. If you do, click “Log In”.
- Once logged in, navigate to your API key management page.
- Click on “Create new secret key”.
- Enter a name for your new key, then click “Create secret key”.
- Your new API key will be displayed. Use this key to interact with the DeepSeek API.
Note: Your API key is sensitive information. Do not share it with anyone.