Skip to content

DeepSeek plugin

DeepSeek models are accessible using the OpenAI-compatible plugin architecture. You will configure the OpenAI plugin to use DeepSeek’s API endpoints.

import (
"context"
"github.com/firebase/genkit/go/genkit"
"github.com/firebase/genkit/go/plugins/compat_oai"
)
ctx := context.Background()
// Custom base URL for DeepSeek
g := genkit.Init(ctx,
genkit.WithPlugins(&compat_oai.OpenAICompatible{
Provider: "deepseek",
APIKey: "YOUR_DEEPSEEK_API_KEY",
BaseURL: "https://api.deepseek.com/v1",
}),
)

You must provide an API key from DeepSeek. You can get an API key from your DeepSeek account settings.

Use ai.WithModelName() to reference a DeepSeek model by the provider prefix you supplied.

import (
"context"
"github.com/firebase/genkit/go/ai"
)
ctx := context.Background()
resp, err := genkit.Generate(ctx, g,
ai.WithModelName("deepseek/deepseek-chat"),
ai.WithPrompt("tell me a fun fact about Mars"),
)