Skip to content
Docs

DeepSeek LLM Provider

The DeepSeek provider connects Beluga AI to DeepSeek’s inference platform. DeepSeek exposes an OpenAI-compatible API, so this provider supports all standard features including streaming, tool calling, and structured output. DeepSeek is known for its DeepSeek-V3 and DeepSeek-R1 reasoning models.

Choose DeepSeek for strong reasoning and coding tasks at competitive prices. The DeepSeek-R1 model provides chain-of-thought reasoning similar to OpenAI’s o-series, while DeepSeek-V3 offers general-purpose chat with strong benchmark performance relative to its cost.

Terminal window
go get github.com/lookatitude/beluga-ai/llm/providers/deepseek
FieldRequiredDefaultDescription
ModelNo"deepseek-chat"Model ID
APIKeyYesDeepSeek API key (sk-...)
BaseURLNohttps://api.deepseek.com/v1Override API endpoint
TimeoutNo30sRequest timeout

Environment variables:

VariableMaps to
DEEPSEEK_API_KEYAPIKey
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/lookatitude/beluga-ai/config"
"github.com/lookatitude/beluga-ai/llm"
"github.com/lookatitude/beluga-ai/schema"
_ "github.com/lookatitude/beluga-ai/llm/providers/deepseek"
)
func main() {
model, err := llm.New("deepseek", config.ProviderConfig{
Model: "deepseek-chat",
APIKey: os.Getenv("DEEPSEEK_API_KEY"),
})
if err != nil {
log.Fatal(err)
}
msgs := []schema.Message{
schema.NewSystemMessage("You are a helpful assistant."),
schema.NewHumanMessage("What is the capital of France?"),
}
resp, err := model.Generate(context.Background(), msgs)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Text())
}
for chunk, err := range model.Stream(context.Background(), msgs) {
if err != nil {
log.Fatal(err)
}
fmt.Print(chunk.Delta)
}
fmt.Println()
modelWithTools := model.BindTools(tools)
resp, err := modelWithTools.Generate(ctx, msgs, llm.WithToolChoice(llm.ToolChoiceAuto))
resp, err := model.Generate(ctx, msgs,
llm.WithResponseFormat(llm.ResponseFormat{Type: "json_object"}),
)
resp, err := model.Generate(ctx, msgs,
llm.WithTemperature(0.7),
llm.WithMaxTokens(4096),
llm.WithTopP(0.9),
llm.WithStopSequences("END"),
)
resp, err := model.Generate(ctx, msgs)
if err != nil {
log.Fatal(err)
}
import "github.com/lookatitude/beluga-ai/llm/providers/deepseek"
model, err := deepseek.New(config.ProviderConfig{
Model: "deepseek-chat",
APIKey: os.Getenv("DEEPSEEK_API_KEY"),
})
Model IDDescription
deepseek-chatDeepSeek V3 — general chat, strong coding
deepseek-reasonerDeepSeek R1 — chain-of-thought reasoning model

Refer to DeepSeek’s documentation for the latest model list.