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:
| Shorthand | Default model |
|---|---|
deepseek.chat.v1 | none — set model |
deepseek.chat | deepseek-chat |
deepseek.v4-flash | deepseek-v4-flash |
deepseek.v4-pro | deepseek-v4-pro |
Basic Usage
Deepseek Chat
const llm = useLlm("deepseek.chat.v1", {
model: "deepseek-chat", // specify a model
});Deepseek Chat By Model
const llm = useLlm("deepseek.chat", {
// other options,
// no model needed, using deepseek-chat model
});const llm = useLlm("deepseek.v4-flash", {
// other options,
// no model needed, using deepseek-v4-flash model
});const llm = useLlm("deepseek.v4-pro", {
// other options,
// no model needed, using deepseek-v4-pro model
});deepseek.chatdeepseek.v4-flashdeepseek.v4-pro
Authentication
To authenticate, you need to provide a Deepseek API Key. You can provide the API key various ways, depending on your use case.
- Pass in as execute options using
deepseekApiKey - Pass in as setup options using
deepseekApiKey - 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.
// 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.
| Option | Type | Default | Description |
|---|---|---|---|
| model | string | — | The model to use. Must be specified when using deepseek.chat.v1. Can be any valid chat model. See Deepseek Docs |
| deepseekApiKey | string | undefined | API key for Deepseek. See authentication |
| topP | number | undefined | Maps to top_p. See Deepseek Docs |
| stopSequences | array | undefined | Maps to stop. See Deepseek Docs |
| frequencyPenalty | number | undefined | Maps to frequency_penalty. See Deepseek Docs |
| logitBias | object | undefined | Maps to logit_bias. See Deepseek Docs |
| useJson | boolean | undefined | When true, sets response_format to json_object |
| effort | string | undefined | Maps 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:
const llm = useLlm("deepseek.v4-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.
