Skip to content

feat: add DeepSeek provider support#183

Merged
Telli merged 1 commit into
mainfrom
codex/deepseek-support
Jul 16, 2026
Merged

feat: add DeepSeek provider support#183
Telli merged 1 commit into
mainfrom
codex/deepseek-support

Conversation

@Telli

@Telli Telli commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add DeepSeek as a named OpenAI-compatible provider with the current DeepSeek API endpoint and default model
  • generate first-run config and env examples using DEEPSEEK_API_KEY
  • wire DeepSeek through model doctor, provider smoke probes, runtime client creation, CLI help, and docs

Closes #182

Validation

  • dotnet test src/OpenClaw.Tests --filter "FullyQualifiedNameSetupCommandTests|FullyQualifiedNameLlmClientFactoryTests|FullyQualifiedName~ModelProfileSelectionTests"
  • dotnet build OpenClaw.Net.slnx -c Release
  • dotnet test OpenClaw.Net.slnx -c Release --no-build (first run: one unrelated ToolGovernance sidecar race failed, single test passed on rerun)
  • dotnet test OpenClaw.Net.slnx -c Release --no-build (rerun: 2395 passed)
  • dotnet run --project src/OpenClaw.Cli -c Release -- setup --non-interactive --profile local --workspace /tmp/openclaw-deepseek-workspace --config /tmp/openclaw-deepseek-config/openclaw.settings.json --provider deepseek

Summary by CodeRabbit

  • New Features

    • Added DeepSeek as a supported hosted LLM provider.
    • Added setup support with DEEPSEEK_API_KEY, automatic endpoint configuration, and default deepseek-v4-flash model selection.
    • Added support for the higher-capability deepseek-v4-pro model.
    • Added DeepSeek examples to CLI help and setup documentation.
  • Bug Fixes

    • Improved provider-specific API key and model defaults during setup.
    • Added DeepSeek compatibility for chat, embeddings, model validation, and connectivity checks.

Copilot AI review requested due to automatic review settings July 16, 2026 00:58
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

DeepSeek is added as an OpenAI-compatible provider with setup defaults, model capabilities, gateway routing, smoke-probe support, CLI examples, tests, and onboarding documentation.

Changes

DeepSeek provider support

Layer / File(s) Summary
Provider defaults and setup profiles
src/OpenClaw.Core/Setup/DeepSeekProviderDefaults.cs, src/OpenClaw.Cli/SetupCommand.cs, src/OpenClaw.Core/Setup/GatewaySetupProfileFactory.cs, src/OpenClaw.Core/Validation/ModelDoctorEvaluator.cs
Adds DeepSeek constants and capabilities, provider-specific setup defaults, a deepseek-default model profile, and named capability evaluation.
OpenAI-compatible transport and smoke probing
src/OpenClaw.Gateway/Extensions/LlmClientFactory.cs, src/OpenClaw.Core/Validation/ProviderSmokeProbe.cs
Routes DeepSeek chat, embedding, and smoke-probe requests through the DeepSeek OpenAI-compatible endpoint.
DeepSeek integration tests
src/OpenClaw.Tests/LlmClientFactoryTests.cs, src/OpenClaw.Tests/ModelProfileSelectionTests.cs, src/OpenClaw.Tests/SetupCommandTests.cs
Verifies setup output, capabilities, authorization headers, endpoint routing, and smoke-probe behavior.
CLI examples and onboarding documentation
README.md, docs/GETTING_STARTED.md, docs/QUICKSTART.md, src/OpenClaw.Cli/Program.cs
Documents DeepSeek setup commands, API-key environment variables, hosted models, verification, and launch flows.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SetupCommand
  participant GatewaySetupProfileFactory
  participant LlmClientFactory
  participant DeepSeekAPI
  SetupCommand->>GatewaySetupProfileFactory: configure deepseek profile
  GatewaySetupProfileFactory->>LlmClientFactory: create OpenAI-compatible client
  LlmClientFactory->>DeepSeekAPI: send authorized chat completion
  DeepSeekAPI-->>LlmClientFactory: return model response
Loading

Suggested reviewers: tellikoroma, copilot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and directly summarizes the main change: adding DeepSeek provider support.
Linked Issues check ✅ Passed The PR adds DeepSeek first-run setup and runtime support across setup, CLI, gateway, probes, tests, and docs, matching #182's goal.
Out of Scope Changes check ✅ Passed The changes stay focused on DeepSeek provider enablement and related docs/tests, with no clear unrelated additions.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/deepseek-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@augmentcode

augmentcode Bot commented Jul 16, 2026

Copy link
Copy Markdown

PR Risk Analyzer Agent🛡️

👀 Human Input Needed
A pair-review briefing is ready for you.

→ Pair Review Briefing

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class DeepSeek support as a named OpenAI-compatible provider across setup, validation (model doctor + smoke probes), runtime client creation, tests, and user-facing docs so first-run configuration works with DEEPSEEK_API_KEY and sensible defaults.

Changes:

  • Introduce deepseek provider defaults (endpoint, default model, capabilities) and generate a named DeepSeek model profile during setup.
  • Route DeepSeek through runtime chat/embedding client creation and provider smoke probing, and surface capabilities in model doctor evaluation.
  • Update CLI help + docs and add focused regression tests for setup, model doctor, transport, and smoke probe behavior.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/OpenClaw.Tests/SetupCommandTests.cs Adds non-interactive setup test ensuring DeepSeek config + env example are generated correctly.
src/OpenClaw.Tests/ModelProfileSelectionTests.cs Validates model doctor derives DeepSeek capabilities from the named provider defaults.
src/OpenClaw.Tests/LlmClientFactoryTests.cs Adds DeepSeek transport + smoke probe tests and extends the test server routing.
src/OpenClaw.Gateway/Extensions/LlmClientFactory.cs Wires deepseek into OpenAI-compatible chat + embedding client creation with a default endpoint.
src/OpenClaw.Core/Validation/ProviderSmokeProbe.cs Adds DeepSeek to OpenAI-style probe path construction.
src/OpenClaw.Core/Validation/ModelDoctorEvaluator.cs Uses DeepSeek named-provider capabilities when guessing provider capability defaults.
src/OpenClaw.Core/Setup/GatewaySetupProfileFactory.cs Generates a DeepSeek-backed model profile (deepseek-default) during setup.
src/OpenClaw.Core/Setup/DeepSeekProviderDefaults.cs New provider defaults + capability profile for DeepSeek.
src/OpenClaw.Cli/SetupCommand.cs Defaults DeepSeek model + API key env reference (env:DEEPSEEK_API_KEY) during setup prompts/args.
src/OpenClaw.Cli/Program.cs Updates CLI usage examples to include DeepSeek.
README.md Documents DeepSeek as a native provider option and adds setup guidance + example command.
docs/QUICKSTART.md Adds DeepSeek-specific quickstart flow and env var usage.
docs/GETTING_STARTED.md Adds DeepSeek setup guidance with DEEPSEEK_API_KEY and named provider usage.
Comments suppressed due to low confidence (1)

src/OpenClaw.Tests/LlmClientFactoryTests.cs:259

  • The test server now accepts both /v1/chat/completions and /chat/completions, but it doesn’t record which route was actually hit. That makes the new DeepSeek smoke-probe test unable to verify that DeepSeek uses the intended canonical /chat/completions path (and could mask regressions). Capture the request path so callers can assert it.
        IResult HandleChatCompletions(HttpContext ctx)
        {
            headers.Clear();
            foreach (var header in ctx.Request.Headers)
                headers[header.Key] = header.Value.ToString();

Comment on lines +244 to +246
Assert.Equal(SetupCheckStates.Pass, result.Status);
Assert.Equal("Bearer deepseek-token", server.Headers["Authorization"]);
}

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep Code Review Agent🐛

Review completed with 2 suggestions.

Fix in Cosmos

new ModelProfileConfig
{
Id = "deepseek-default",
Provider = DeepSeekProviderDefaults.ProviderId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using deepseek here still fails config validation whenever plugin-backed providers are disabled, because ConfigValidator.BuiltInLlmProviders was not updated and public setup turns Plugins.Enabled off before validation. That means openclaw setup --profile public --provider deepseek rejects both Llm.Provider and this generated model profile as unsupported.

Severity: medium


🤖 Was this useful? React with 👍 or 👎

};
}

if (provider == DeepSeekProviderDefaults.ProviderId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This teaches model doctor that an implicit deepseek profile is tool-capable, but the runtime ConfiguredModelProfileRegistry.GuessCapabilities still has no deepseek case. A config that sets OpenClaw:Llm:Provider=deepseek without explicit Models.Profiles will pass doctor with DeepSeek capabilities but runtime registers the default profile as lacking tools and structured outputs.

Severity: medium


🤖 Was this useful? React with 👍 or 👎

"--workspace", workspace,
"--provider", "deepseek"
],
new StringReader(string.Empty),
var root = CreateTempRoot();
try
{
var configPath = Path.Combine(root, "config", "openclaw.deepseek.json");
try
{
var configPath = Path.Combine(root, "config", "openclaw.deepseek.json");
var workspace = Path.Combine(root, "workspace");
Assert.True(profile.GetProperty("capabilities").GetProperty("supportsTools").GetBoolean());
Assert.True(profile.GetProperty("capabilities").GetProperty("supportsReasoningEffort").GetBoolean());

var envExample = await File.ReadAllTextAsync(Path.Combine(root, "config", "openclaw.deepseek.env.example"));

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/QUICKSTART.md`:
- Line 221: Update the compound modifier in the DeepSeek setup description to
use “DeepSeek-hosted setup,” preserving the rest of the sentence unchanged.

In `@README.md`:
- Line 85: Update the provider/model setup instruction in the README so entering
a provider key applies only to the hosted DeepSeek provider; describe Ollama and
Embedded separately as local choices without implying they require a key.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e1b2464a-b1d1-4ded-881b-307e9941dbe5

📥 Commits

Reviewing files that changed from the base of the PR and between 542b9a5 and 9e89f03.

📒 Files selected for processing (13)
  • README.md
  • docs/GETTING_STARTED.md
  • docs/QUICKSTART.md
  • src/OpenClaw.Cli/Program.cs
  • src/OpenClaw.Cli/SetupCommand.cs
  • src/OpenClaw.Core/Setup/DeepSeekProviderDefaults.cs
  • src/OpenClaw.Core/Setup/GatewaySetupProfileFactory.cs
  • src/OpenClaw.Core/Validation/ModelDoctorEvaluator.cs
  • src/OpenClaw.Core/Validation/ProviderSmokeProbe.cs
  • src/OpenClaw.Gateway/Extensions/LlmClientFactory.cs
  • src/OpenClaw.Tests/LlmClientFactoryTests.cs
  • src/OpenClaw.Tests/ModelProfileSelectionTests.cs
  • src/OpenClaw.Tests/SetupCommandTests.cs

Comment thread docs/QUICKSTART.md

Plain `openclaw run "hello"` requests work as prompt-only chat with non-tool Ollama profiles when no explicit tool preset is requested. Tool-heavy routes and explicit presets still need a tool-capable model profile or configured fallback. The doctor now warns when an Ollama profile still points at `/v1` or when a local agentic profile is missing a deterministic fallback.

For a DeepSeek hosted setup, use the named provider. It configures the OpenAI-compatible DeepSeek endpoint automatically and defaults to `deepseek-v4-flash`:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Hyphenate the compound modifier.

Use “DeepSeek-hosted setup” for clearer grammar.

🧰 Tools
🪛 LanguageTool

[grammar] ~221-~221: Use a hyphen to join words.
Context: ... deterministic fallback. For a DeepSeek hosted setup, use the named provider. It...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/QUICKSTART.md` at line 221, Update the compound modifier in the DeepSeek
setup description to use “DeepSeek-hosted setup,” preserving the rest of the
sentence unchanged.

Source: Linters/SAST tools

Comment thread README.md
2. Launch Companion from the `companion` folder.
3. Open the **Setup** tab.
4. Choose a provider/model and enter the provider key, choose Ollama for a local model server, or choose Embedded for an OpenClaw-managed local model such as Gemma 4.
4. Choose a provider/model and enter the provider key, choose DeepSeek for the hosted OpenAI-compatible DeepSeek API, choose Ollama for a local model server, or choose Embedded for an OpenClaw-managed local model such as Gemma 4.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Clarify the provider-specific key requirement.

This sentence can imply that Ollama and Embedded also require entering a provider key. Separate the hosted DeepSeek instruction from the local-provider choices.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 85, Update the provider/model setup instruction in the
README so entering a provider key applies only to the hosted DeepSeek provider;
describe Ollama and Embedded separately as local choices without implying they
require a key.

@Telli
Telli merged commit 3c9dd49 into main Jul 16, 2026
19 checks passed
@Telli
Telli deleted the codex/deepseek-support branch July 16, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[First Run]: How to use Deepseek

2 participants