Skip to content

feat: add deepseek provider support - #85

Merged
delete-cloud merged 4 commits into
mainfrom
feat/deepseek-provider
May 1, 2026
Merged

delete-cloud merged 4 commits into
mainfrom
feat/deepseek-provider

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add deepseek as an Anthropic-compatible provider using https://api.deepseek.com/anthropic.
  • Add DEEPSEEK_API_KEY fallback plus CLI/REPL/session restore wiring.
  • Document the new provider and verify it through config, provider, CLI, and smoke tests.

Verification

  • uv run pytest tests/core/test_config.py tests/coding_agent/plugins/test_llm_provider.py tests/coding_agent/test_cli_pipeline.py tests/cli/test_repl.py::TestSessionManagerIntegration::test_switch_active_session_syncs_restored_model_into_repl_context tests/cli/test_repl.py::TestSessionManagerIntegration::test_switch_session_rejects_missing_restored_provider_without_mutating_state -v
  • uv run python -m coding_agent --provider deepseek --model deepseek-v4-pro run --help
  • uv run python -c 'from coding_agent.plugins.llm_provider import LLMProviderPlugin; from coding_agent.providers.anthropic import AnthropicProvider; p = LLMProviderPlugin(provider="deepseek", model="deepseek-v4-pro", api_key="sk-test"); r = p.provide_llm(); assert isinstance(r, AnthropicProvider); assert r._base_url == "https://api.deepseek.com/anthropic"; assert r._api_key == "sk-test"; print(r.model_name, r._base_url)'

Notes

  • Full tests/cli/ still has two unrelated pre-existing failures in session restore tests that omit provider metadata.

Summary by CodeRabbit

  • New Features

    • Added DeepSeek as a supported AI provider; selectable via CLI and config.
    • DeepSeek API key can be provided via DEEPSEEK_API_KEY as an environment fallback.
  • Bug Fixes

    • Restored sessions now allow DeepSeek as a valid provider.
  • Documentation

    • Provider docs updated to list DeepSeek and its fallback key.
  • Tests

    • Added tests covering DeepSeek wiring and API key resolution.

delete-cloud and others added 3 commits May 1, 2026 22:09
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@coderabbitai

coderabbitai Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a73a6124-883a-4a1c-a8d7-5cc550ab69bd

📥 Commits

Reviewing files that changed from the base of the PR and between 6cb8c0f and 430b890.

📒 Files selected for processing (3)
  • coding-agent/src/coding_agent/core/config.py
  • coding-agent/tests/coding_agent/test_cli_pipeline.py
  • coding-agent/tests/core/test_config.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • coding-agent/tests/core/test_config.py

📝 Walkthrough

Walkthrough

Added support for a new provider, deepseek: config schema and loading now recognize it and can fallback to DEEPSEEK_API_KEY; the LLM plugin instantiates an Anthropic-based provider using DeepSeek's base URL; CLI/session logic and tests were updated accordingly.

Changes

Cohort / File(s) Summary
Documentation
coding-agent/README.md
Added deepseek to provider list and documented DEEPSEEK_API_KEY as the provider-specific fallback env var.
Core configuration
coding-agent/src/coding_agent/core/config.py
Added "deepseek" to allowed provider values and updated load_config to fallback to DEEPSEEK_API_KEY when provider is deepseek and no API key provided.
App pipeline key resolution
coding-agent/src/coding_agent/app.py
Child pipeline API key resolution now sources DEEPSEEK_API_KEY when provider is deepseek and generic keys are absent; uses resolved key downstream.
CLI / session restore
coding-agent/src/coding_agent/cli/repl.py
Allowed provider_name == "deepseek" during restored session validation so sessions using DeepSeek proceed through validation and syncing.
Provider plugin implementation
coding-agent/src/coding_agent/plugins/llm_provider.py
Added deepseek branch: resolves API key (instance value or DEEPSEEK_API_KEY) and constructs an AnthropicProvider with https://api.deepseek.com/anthropic as base URL.
Tests
coding-agent/tests/coding_agent/plugins/test_llm_provider.py, coding-agent/tests/coding_agent/test_cli_pipeline.py, coding-agent/tests/core/test_config.py
Added/updated tests covering DeepSeek provider instantiation, base URL, API key precedence and fallback, CLI wiring, and config loading behavior.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI Entry Point
    participant Config as Config Loader
    participant App as App Pipeline
    participant LLM as LLMProvider Plugin
    participant Provider as Anthropic Provider

    CLI->>Config: load_config(provider="deepseek", api_key=None)
    Config->>Config: if api_key empty and provider=="deepseek" -> use DEEPSEEK_API_KEY
    Config-->>App: return Config(with resolved api_key)
    App->>App: normalize/validate resolved_key
    App->>LLM: request provider instance (provider="deepseek")
    LLM->>LLM: resolve api_key (explicit or DEEPSEEK_API_KEY)
    LLM->>Provider: instantiate AnthropicProvider(base_url="https://api.deepseek.com/anthropic")
    Provider-->>LLM: provider instance
    LLM-->>App: configured provider returned
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I found a new deepseek trail,
Keys tucked in env when others fail,
Through config, CLI, and plugin play,
Anthropic hops along the way,
A joyful hop — code's new tale 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% 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 'feat: add deepseek provider support' directly and clearly summarizes the main change—adding DeepSeek as a new supported provider across the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/deepseek-provider

Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 the current code and only fix it if needed.

Inline comments:
In `@coding-agent/src/coding_agent/core/config.py`:
- Around line 104-107: The DeepSeek fallback currently only checks for presence
of "api_key" in values which misses empty-string keys; update the condition in
the provider-check block (the code manipulating values and reading
DEEPSEEK_API_KEY) to treat empty or falsy api_key as missing (e.g., use not
values.get("api_key") rather than "api_key" not in values) so that when provider
== "deepseek" and values["api_key"] is empty it will read DEEPSEEK_API_KEY from
the environment and assign it to values["api_key"] if present.

In `@coding-agent/tests/coding_agent/test_cli_pipeline.py`:
- Around line 518-536: The test
test_run_uses_deepseek_api_key_env_without_cli_api_key can be flaky if
AGENT_API_KEY is present; update the test to explicitly remove any ambient
AGENT_API_KEY before setting DEEPSEEK_API_KEY by calling
monkeypatch.delenv("AGENT_API_KEY", raising=False) (or equivalent) prior to
monkeypatch.setenv("DEEPSEEK_API_KEY", "deepseek-env-key") so that the code path
in coding_agent.__main__.main and the patched _run_headless uses
DEEPSEEK_API_KEY as intended.
🪄 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: 4cb12c8f-cc28-4b51-8346-51b726447f58

📥 Commits

Reviewing files that changed from the base of the PR and between 7b0314d and 6cb8c0f.

📒 Files selected for processing (8)
  • coding-agent/README.md
  • coding-agent/src/coding_agent/app.py
  • coding-agent/src/coding_agent/cli/repl.py
  • coding-agent/src/coding_agent/core/config.py
  • coding-agent/src/coding_agent/plugins/llm_provider.py
  • coding-agent/tests/coding_agent/plugins/test_llm_provider.py
  • coding-agent/tests/coding_agent/test_cli_pipeline.py
  • coding-agent/tests/core/test_config.py

Comment thread coding-agent/src/coding_agent/core/config.py Outdated
Comment thread coding-agent/tests/coding_agent/test_cli_pipeline.py
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@delete-cloud
delete-cloud merged commit 0119898 into main May 1, 2026
1 check passed
@delete-cloud
delete-cloud deleted the feat/deepseek-provider branch May 10, 2026 03:56
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.

1 participant