DeepSeek

Use DeepSeek models with Kern agents.

DeepSeek is a platform for providing endpoints for Large Language models. See their library of models here.

We recommend experimenting to find the best-suited model for your use-case. Here are some general recommendations:

  • deepseek-chat model is good for most basic use-cases.
  • deepseek-reasoner model is good for complex reasoning and multi-step tasks.

DeepSeek does not have rate limits. See their docs for information about how to deal with slower responses during high traffic.

Authentication

Set your DEEPSEEK_API_KEY environment variable. Get your key from here.

1export DEEPSEEK_API_KEY=***
1setx DEEPSEEK_API_KEY ***

Example

Use DeepSeek with your Agent:

1from kern.agent import Agent
2from kern.models.deepseek import DeepSeek
3
4agent = Agent(model=DeepSeek(id="deepseek-chat"), markdown=True)
5
6# Print the response in the terminal
7agent.print_response("Share a 2 sentence horror story.")
Note View more examples here.

Parameters

ParameterTypeDefaultDescription
idstr"deepseek-chat"The id of the DeepSeek model to use
namestr"DeepSeek"The name of the model
providerstr"DeepSeek"The provider of the model
api_keyOptional[str]NoneThe API key for DeepSeek (defaults to DEEPSEEK_API_KEY env var)
base_urlstr"https://api.deepseek.com"The base URL for the DeepSeek API

DeepSeek extends the OpenAI-compatible interface and supports most parameters from the OpenAI model.

Note: DeepSeek's support for structured outputs is currently not fully compatible, so supports_native_structured_outputs is set to False.

Available Models

  • deepseek-chat - General-purpose conversational model, good for most use cases
  • deepseek-reasoner - Advanced reasoning model optimized for complex problem-solving and multi-step tasks