Store Chat Messages & State Without Managing Infrastructure.Check Out DialogueDB
Skip to content

Deepseek ​

When using Deepseek models, llm-exe will make POST requests to https://api.deepseek.com/v1/chat/completions. All models are supported if you pass deepseek.chat.v1 as the first argument, and then specify a model in the options.

llm-exe ships typed shorthands for the most common Deepseek models so you do not have to remember the exact model strings:

ShorthandDefault model
deepseek.chat.v1none — set model
deepseek.flashdeepseek-flash
deepseek.v4-prodeepseek-v4-pro

Deprecated shorthands ​

These shorthands still resolve, but emit a deprecation warning when used. Migrate to an active shorthand above.

ShorthandDefault modelStatus
deepseek.chatdeepseek-chatDropped from DeepSeek's docs but still served. Migrate to deepseek.flash, which runs in thinking mode by default and needs a larger maxTokens
deepseek.v4-flashdeepseek-v4-flashDeepSeek retired the model behind this id. The id is still accepted, and requests are served by DeepSeek-V4.1-Flash. Migrate to deepseek.flash

Basic Usage ​

Deepseek Chat ​

ts
const llm = useLlm("deepseek.chat.v1", {
  model: "deepseek-flash", // specify a model
});

Deepseek Chat By Model ​

ts
const llm = useLlm("deepseek.flash", {
  // other options,
  // no model needed, using deepseek-flash model
});
ts
const llm = useLlm("deepseek.v4-pro", {
  // other options,
  // no model needed, using deepseek-v4-pro model
});
INFO
You can use the following models using this shorthand:
  • deepseek.flash
  • deepseek.v4-pro
  • deepseek.chatdeprecated
    Model "deepseek.chat" is deprecated: DeepSeek has dropped deepseek-chat from its docs. Migrate to "deepseek.flash", but note it runs in thinking mode by default, so it spends reasoning tokens and needs a larger maxTokens than deepseek.chat did.
  • deepseek.v4-flashdeprecated
    Model "deepseek.v4-flash" is deprecated: DeepSeek has retired the model behind deepseek-v4-flash and now recommends deepseek-flash. The legacy id is still accepted and served by DeepSeek-V4.1-Flash, but migrate to "deepseek.flash".
Deprecated shorthands still resolve and will continue to work for now, but the underlying provider may stop accepting them at any time. Migrate to a current shorthand when you can.

Authentication ​

To authenticate, you need to provide a Deepseek API Key. You can provide the API key various ways, depending on your use case.

  1. Pass in as execute options using deepseekApiKey
  2. Pass in as setup options using deepseekApiKey
  3. Use a default key by setting an environment variable of DEEPSEEK_API_KEY

Generally you pass the LLM instance off to an LLM Executor and call that. However, it is possible to interact with the LLM object directly, if you wanted.

ts
// call the LLM directly with a prompt
await llm.call(prompt);

Deepseek-Specific Options ​

In addition to the generic options, the following options are Deepseek-specific and can be passed in when creating a llm function.

OptionTypeDefaultDescription
modelstring—The model to use. Must be specified when using deepseek.chat.v1. Can be any valid chat model. See Deepseek Docs
deepseekApiKeystringundefinedAPI key for Deepseek. See authentication
topPnumberundefinedMaps to top_p. See Deepseek Docs
stopSequencesarrayundefinedMaps to stop. See Deepseek Docs
frequencyPenaltynumberundefinedMaps to frequency_penalty. See Deepseek Docs
logitBiasobjectundefinedMaps to logit_bias. See Deepseek Docs
useJsonbooleanundefinedWhen true, sets response_format to json_object
effortstringundefinedMaps to reasoning_effort. Valid values: "low", "high", "max". Sent for deepseek-flash, deepseek-v4-pro, and legacy deepseek-v4-* ids; ignored for deepseek-chat.

See Deepseek API Reference for details on these parameters.

Thinking and provider-specific body fields ​

Disable thinking with extraBody:

ts
const llm = useLlm("deepseek.flash", {
  extraBody: { thinking: { type: "disabled" } },
});

To control thinking effort instead, set effort: "low", "high", or "max". See DeepSeek thinking mode.

extraBody accepts raw request fields and is shallow-merged after normal options and executor schema/tool mappings. Its fields take precedence; nested objects are replaced in full. See generic options.

Schema-typed JSON ​

A JSON parser with a schema requests response_format: { type: "json_object" } on DeepSeek's chat completions endpoint, which does not support json_schema. The parser retains TypeScript inference and validates the response locally by default. Include instructions for the expected JSON shape in your prompt; JSON mode does not enforce that shape on the server.