Introduction¶
DeepSeek Harness (DSH) supports custom model providers through its plugin system. CC Switch is a tool for managing Claude Code / Codex API configurations. The dsh-ccswitch-sync plugin reads CC Switch’s local database configuration, converts it into DSH custom providers, and handles API key writing, enabling configuration migration and unified management.
Core Features¶
- Configuration synchronization: Reads CC Switch’s SQLite database (
~/.cc-switch/cc-switch.db) and syncs its providers and models into DSH’sllm-pi-airoute. - Automatic mapping: Uses the
cc-prefix by default for route naming (e.g.,cc-sub2api). - Protocol adaptation: Automatically selects the protocol based on provider type (Codex type maps to
openai-responsesoropenai-completions, Claude type maps toanthropic-messages). - Model discovery: Supports pulling the model list through the gateway’s
/modelsendpoint, or reading the local model catalog (~/.codex/cc-switch-model-catalog.json). - Credential management: Writes API keys to DSH’s credential store (
~/.dsh/.credentials.yaml) without polluting the main configuration file. - Tooling support: Provides chat commands and a standalone CLI tool.
Installation and Activation¶
The plugin is installed as a file into the corresponding DSH Desktop profile:
- Modify
~/.dsh/profiles/<profile>/package.jsonand add the dependency:
// ~/.dsh/profiles/<profile>/package.json
"dependencies": { "dsh-ccswitch-sync": "file:../../plugins/dsh-ccswitch-sync" }
- Add
"dsh-ccswitch-sync"todsh.profile.bundles. - Restart DSH Desktop.
Usage¶
After installing the plugin, it provides two trigger methods:
Chat Commands¶
| Command | Description |
|---|---|
/ccswitch-sync |
Manually runs a sync |
/ccswitch-status |
View the current mapping plan (routes, protocols, models) |
Standalone CLI¶
# 预览映射计划(默认)
node cli.mjs --dry-run
# 实际写入配置(自动备份原文件)
node cli.mjs --apply
# 实际写入并删除来源已不存在的路由
node cli.mjs --apply --remove-stale
# 自定义路由前缀
node cli.mjs --apply --prefix mycc
# 排除特定路由
node cli.mjs --apply --exclude cc-deepseek,cc-deepseek-codex
Configuration¶
Configure via ~/.dsh/profiles/<profile>/cordis.patch.yml:
| Field | Default Value | Description |
|---|---|---|
ccswitchDbPath |
~/.cc-switch/cc-switch.db |
CC Switch database path |
routePrefix |
cc |
Prefix for imported routes |
syncOnStart |
false |
Whether to automatically sync on startup (disabled by default) |
watchDb |
false |
Whether to listen for database changes and automatically resync |
removeStale |
false |
Remove cc-* routes whose sources no longer exist |
excludeRoutes |
[] |
List of routes that should never be imported |
discoverModels |
true |
Whether to discover models through the /models endpoint |
maxDiscoveredModels |
50 |
Maximum number of models to import per provider |
discoverModelsTimeoutMs |
6000 |
Timeout for a single model discovery request (milliseconds) |
Notes¶
- Manual trigger: No automatic fetching by default, to avoid accidentally overwriting manual changes during restarts or configuration changes.
- Overwrite risk: Syncing overwrites existing providers and models under the
cc-*prefix. If manual adjustments need to be protected, use theexcludeRoutessetting. - Key storage: API keys are written to
~/.dsh/.credentials.yamlas environment variable references, with file permissions set to 600. - Uninstall: Remove the dependency and bundle entry from
package.json, run the installation command, and restart DSH.
Conclusion¶
This plugin is suitable for scenarios where multiple CC Switch provider configurations need to be migrated to DSH management. With the CLI tool, previewing, adjusting, and batch updating can be performed conveniently.