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
Factory
import { deepseek } from "@radaros/core";
const model = deepseek("deepseek-chat");
Model ID (e.g., "deepseek-chat", "deepseek-reasoner").
Optional { apiKey?, baseURL? }.
Supported Models
| Model | Description | Best For |
|---|
deepseek-chat | General-purpose conversational model | Most tasks, fast responses |
deepseek-reasoner | Advanced reasoning with chain-of-thought | Complex 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);
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
| Variable | Description |
|---|
DEEPSEEK_API_KEY | DeepSeek API key |
Cross-References
- OpenAI — Similar API format, different models
- Ollama — Run DeepSeek models locally via Ollama
- Reasoning — Reasoning configuration guide