Skip to main content

DeepSeek

Use DeepSeek’s powerful language models — including the deepseek-reasoner for complex multi-step reasoning and deepseek-chat for general conversations. DeepSeek exposes an OpenAI-compatible API, so RadarOS connects using the standard openai SDK pointed at https://api.deepseek.com.
DeepSeek has no rate limits. During high-traffic periods, responses may be slower rather than rejected. See DeepSeek docs.

Setup

npm install openai

Factory

import { deepseek } from "@radaros/core";

const model = deepseek("deepseek-chat");
modelId
string
required
Model ID (e.g., "deepseek-chat", "deepseek-reasoner").
config
DeepSeekConfig
Optional { apiKey?, baseURL? }.

Supported Models

ModelDescriptionBest For
deepseek-chatGeneral-purpose conversational modelMost tasks, fast responses
deepseek-reasonerAdvanced reasoning with chain-of-thoughtComplex math, logic, multi-step problems

Basic Example

import { Agent, deepseek } from "@radaros/core";

const agent = new Agent({
  name: "deepseek-agent",
  model: deepseek("deepseek-chat"),
  instructions: "You are a helpful assistant.",
});

const result = await agent.run("Explain quantum entanglement in simple terms.");
console.log(result.text);

Reasoning Model

The deepseek-reasoner model returns chain-of-thought reasoning via reasoning_content:
import { Agent, deepseek } from "@radaros/core";

const agent = new Agent({
  name: "math-solver",
  model: deepseek("deepseek-reasoner"),
  instructions: "Solve problems step by step.",
});

const result = await agent.run(
  "A train leaves Station A at 60 mph. Another leaves Station B (300 miles away) at 80 mph toward A. When do they meet?"
);
console.log(result.text);

Tool Calling

import { Agent, deepseek, defineTool } from "@radaros/core";
import { z } from "zod";

const agent = new Agent({
  name: "tool-agent",
  model: deepseek("deepseek-chat"),
  tools: [
    defineTool({
      name: "getWeather",
      description: "Get current weather for a city",
      parameters: z.object({ city: z.string() }),
      execute: async ({ city }) => `${city}: 18°C, Clear skies`,
    }),
  ],
});

const result = await agent.run("What's the weather in Tokyo?");
console.log(result.text);

Full Example

import { Agent, deepseek, CostTracker, defineTool } from "@radaros/core";
import { z } from "zod";

const costTracker = new CostTracker({
  pricing: {
    "deepseek-chat": { promptPer1k: 0.00014, completionPer1k: 0.00028 },
    "deepseek-reasoner": { promptPer1k: 0.00055, completionPer1k: 0.00219 },
  },
});

const agent = new Agent({
  name: "research-assistant",
  model: deepseek("deepseek-chat"),
  instructions: "You are a research assistant. Be thorough and cite sources.",
  tools: [
    defineTool({
      name: "search",
      description: "Search the web",
      parameters: z.object({ query: z.string() }),
      execute: async ({ query }) => `Results for "${query}": ...`,
    }),
  ],
  costTracker,
  maxToolRoundtrips: 5,
});

const result = await agent.run("What are the latest advances in fusion energy?");
console.log(result.text);
console.log(`Cost: $${costTracker.getSummary().totalCost.toFixed(6)}`);

Environment Variables

VariableDescription
DEEPSEEK_API_KEYDeepSeek API key

Cross-References

  • OpenAI — Similar API format, different models
  • Ollama — Run DeepSeek models locally via Ollama
  • Reasoning — Reasoning configuration guide