pipedog is an unofficial community port of Pipecat, not affiliated with Daily.
pipedog
LLM

DeepSeek

DeepSeekLLMService streams chat completions from DeepSeek through its OpenAI-compatible API.

Overview

DeepSeek's chat models, with control over their thinking mode.

  • DeepSeekLLMService: an OpenAILLMService subclass with DeepSeek's base URL and default model. It uses DeepSeekLLMAdapter, which adds an empty reasoning_content to assistant messages that have none, which DeepSeek requires in thinking mode once a tool call is involved.

Installation

bun add @pipedog/deepseek

It depends on @pipedog/openai, which is installed with it.

import { DeepSeekLLMService } from "@pipedog/deepseek/llm";
import { DeepSeekLLMAdapter } from "@pipedog/deepseek/deepseek_adapter";

Prerequisites

  • A DeepSeek account and an API key from the DeepSeek platform.
  • Pass the key as apiKey. It is required, and the service never falls back to OPENAI_API_KEY. The examples read it from DEEPSEEK_API_KEY.

DeepSeekLLMService

Configuration

Prop

Type

The other options (organization, project, defaultHeaders, serviceTier, retryOnTimeout, retryTimeoutSecs, function calling) are OpenAILLMService's. See OpenAI.

Base URLhttps://api.deepseek.com/v1
Default modeldeepseek-flash
Models to trydeepseek-flash. See the provider's catalog for the rest.

Settings

Runtime-updatable settings, passed as settings: new DeepSeekLLMService.Settings({...}) (DeepSeekLLMSettings). They are OpenAI's settings, with these defaults:

SettingTypeDefaultDescription
modelstring"deepseek-flash"Model name.
thinkingDeepSeekThinkingConfig | null{ type: "disabled" }Thinking mode, sent as thinking in the request body. null leaves it to DeepSeek's default. A plain { type } object is converted.

Every other setting keeps OpenAI's default. Unset sampling settings are left out of the request, so the provider's own defaults apply. extra carries provider-specific request fields.

Usage

llm.ts
import { LLMUpdateSettingsFrame } from "@pipedog/core/frames/frames";
import { DeepSeekLLMService } from "@pipedog/deepseek/llm";

const llm = new DeepSeekLLMService({
  apiKey: process.env.DEEPSEEK_API_KEY ?? "",
  settings: new DeepSeekLLMService.Settings({
    model: "deepseek-flash",
    systemInstruction: "You are a helpful assistant in a voice conversation.",
    temperature: 0.7,
  }),
});

Thinking is off by default, because DeepSeek's V4 models otherwise reason before every answer, which delays the first spoken token. Turn it on with DeepSeekLLMService.ThinkingConfig:

const thinking = new DeepSeekLLMService({
  apiKey: process.env.DEEPSEEK_API_KEY ?? "",
  settings: new DeepSeekLLMService.Settings({
    thinking: new DeepSeekLLMService.ThinkingConfig({ type: "enabled" }),
  }),
});

Change settings mid-call with an LLMUpdateSettingsFrame. The next completion uses them:

// Queue it on the worker, or push it from a processor upstream of the service.
const update = new LLMUpdateSettingsFrame({
  delta: new DeepSeekLLMService.Settings({ temperature: 0.2, maxTokens: 300 }),
});

Notes

  • Runs a completion for each LLMContextFrame, between an LLMFullResponseStartFrame and an LLMFullResponseEndFrame, and streams the reply as LLMTextFrames, as OpenAILLMService does. Function calls, token usage metrics and runInference work the same way.
  • "developer" messages are sent as "user" messages, since the API doesn't support that role (supportsDeveloperRole is false).
  • Messages go through DeepSeekLLMAdapter, which adds an empty reasoning_content to assistant messages that have none, which DeepSeek requires in thinking mode once a tool call is involved.
  • seed, max_completion_tokens and service_tier are not sent: DeepSeek doesn't support them.
  • DeepSeek can't enforce a response schema (supportsResponseSchema is false), so runInference ignores responseSchema, with a warning.

Runtime notes

RuntimeWorksWhat it needs
Bun✅ yesNothing.
Node.js✅ yesNothing.
Deno✅ yesNothing.
Cloudflare Workers✅ yesNothing.

Generated from pipecat.runtimes and pipecat.compat in packages/deepseek/package.json: ✅ means the compat smoke test passes on that runtime.

  • The client is the official openai JS SDK (through @pipedog/openai), which talks through fetch. It works on Bun, Node, Deno and Cloudflare Workers.
  • The deprecated model constructor option is not ported. Use settings.
  • Tested against a local OpenAI-compatible mock server, not against DeepSeek itself.

pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.

Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).

On this page