Skip to content

feat(tui): add SiliconFlow provider#1864

Open
qychen2001 wants to merge 1 commit into
Hmbown:mainfrom
qychen2001:main
Open

feat(tui): add SiliconFlow provider#1864
qychen2001 wants to merge 1 commit into
Hmbown:mainfrom
qychen2001:main

Conversation

@qychen2001
Copy link
Copy Markdown

Add SiliconFlow (https://siliconflow.com) as a new API provider with OpenAI-compatible /v1/chat/completions endpoint.

  • Base URL: https://api.siliconflow.com/v1
  • Default model: deepseek-ai/DeepSeek-V4-Pro
  • Supports thinking (reasoning) and cache telemetry
  • Pass-through model names (no remapping)
  • Env vars: SILICONFLOW_API_KEY, SILICONFLOW_BASE_URL, SILICONFLOW_MODEL
  • Provider aliases: siliconflow, sf

Summary

Testing

  • cargo test --all-features
  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes

Add SiliconFlow (https://siliconflow.com) as a new API provider with
OpenAI-compatible /v1/chat/completions endpoint.

- Base URL: https://api.siliconflow.com/v1
- Default model: deepseek-ai/DeepSeek-V4-Pro
- Supports thinking (reasoning) and cache telemetry
- Pass-through model names (no remapping)
- Env vars: SILICONFLOW_API_KEY, SILICONFLOW_BASE_URL, SILICONFLOW_MODEL
- Provider aliases: siliconflow, sf

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds SiliconFlow as a new AI provider, updating configuration files, environment variable handling, and TUI components to support its API. Key updates include the addition of SiliconFlow to provider enums, implementation of its default settings, and integration into the reasoning and telemetry logic. The reviewer recommended updating a stale comment about cache telemetry and including the SiliconFlow-specific default model in the model picker's completion list to improve usability.

Comment thread crates/tui/src/config.rs
ApiProvider::Deepseek
| ApiProvider::DeepseekCN
| ApiProvider::NvidiaNim
| ApiProvider::SiliconFlow
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.

medium

The comment on line 304 is now outdated as it doesn't mention SiliconFlow. It should be updated to: // Cache telemetry: returned only by DeepSeek-native, NVIDIA NIM, and SiliconFlow endpoints.

Comment thread crates/tui/src/config.rs
Comment on lines +436 to +439
ApiProvider::Openai
| ApiProvider::Atlascloud
| ApiProvider::Ollama
| ApiProvider::SiliconFlow => OFFICIAL_DEEPSEEK_MODELS.to_vec(),
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.

medium

For the SiliconFlow provider, it would be beneficial to include its default model (deepseek-ai/DeepSeek-V4-Pro) in the completion list, as it differs from the standard DeepSeek model names used by other providers. This improves the user experience when using the model picker.

        ApiProvider::Openai | ApiProvider::Atlascloud | ApiProvider::Ollama => {
            OFFICIAL_DEEPSEEK_MODELS.to_vec()
        }
        ApiProvider::SiliconFlow => {
            let mut models = OFFICIAL_DEEPSEEK_MODELS.to_vec();
            models.push(DEFAULT_SILICONFLOW_MODEL);
            models
        }

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 27, 2026

Independent review:

PR #1864 and sister PR #1868 share the same base commit (faf5e07ad) and both add a SiliconFlow ProviderKind with default base URL https://api.siliconflow.com/v1 and default model deepseek-ai/DeepSeek-V4-Pro. Verified via direct git diff pr-1864 pr-1868 --stat:

  • 1864: 11 files, +158/-12.
  • 1868: 15 files, +530/-178 — adds README.md/README.zh-CN.md provider tables, crates/tui/src/commands/provider.rs registration, fuller docs/CONFIGURATION.md coverage, and crates/secrets/src/lib.rs env-var mapping (SILICONFLOW_API_KEY/SILICONFLOW_BASE_URL/SILICONFLOW_MODEL).
  • 1864 also touches secrets/src/lib.rs (1 line) but lacks the README/docs/commands wiring 1868 has.
  • Merge sim against main: conflicts in crates/config/src/lib.rs and crates/tui/src/client.rs. Against pr-2256 (v0.8.48): conflicts in cli/src/lib.rs, config/src/lib.rs, tui/src/client.rs, client/chat.rs, config.rs, core/engine.rs, main.rs, provider_picker.rs, tui/ui.rs — extensive overlap with the provider-registry refactor and Xiaomi MiMo work in v0.8.48.

1868 is the more complete implementation. Both will need rebase regardless.

v0.8.48 (#2256) compatibility: conflicts — 9-file conflict surface against the v0.8.48 provider refactor. Recommend close 1864 as duplicate-of-#1868 and rebase 1868 atop v0.8.48 once it lands.

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 27, 2026

@qychen2001 — thanks for the SiliconFlow contribution. PR #1868 (Lee-take) is a sibling implementation of the same provider, larger scope (15 files vs 11), and includes README + commands/provider.rs + docs that this branch doesn't. Both branches are based on the same commit faf5e07ad so neither has a freshness advantage over the other.

Direction-wise: rather than merge both, we'll likely consolidate on #1868 as the more complete version. If there's something specific to your implementation that #1868 missed — a default endpoint, an env var alias, a model in the registry — point it out on #1868 and we'll fold it in with co-authorship. Otherwise the SiliconFlow surface ships either way and your filing helped surface the demand for it.

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.

2 participants