Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ codewhale --provider fireworks --model deepseek-v4-pro
codewhale auth set --provider openai --api-key "YOUR_OPENAI_COMPATIBLE_API_KEY"
OPENAI_BASE_URL="https://openai-compatible.example/v4" codewhale --provider openai --model glm-5

# Custom DeepSeek-compatible endpoint
DEEPSEEK_BASE_URL="https://your-provider.example/v1" \
DEEPSEEK_MODEL="deepseek-ai/DeepSeek-V4-Pro" \
codewhale --provider deepseek

# Self-hosted SGLang
SGLANG_BASE_URL="http://localhost:30000/v1" codewhale --provider sglang --model deepseek-v4-flash

Expand Down Expand Up @@ -468,6 +473,12 @@ Full shortcut catalog: [docs/KEYBINDINGS.md](docs/KEYBINDINGS.md).

User config: `~/.codewhale/config.toml` (legacy `~/.deepseek/config.toml` fallback). Project overlay: `<workspace>/.codewhale/config.toml` (legacy `<workspace>/.deepseek/config.toml`) (denied: `api_key`, `base_url`, `provider`, `mcp_config_path`). [config.example.toml](config.example.toml) has every option.

Custom DeepSeek-compatible endpoints usually do not need a new provider. Keep
`provider = "deepseek"` and set `[providers.deepseek].base_url` / `model`, or
use `provider = "openai"` for generic OpenAI-compatible gateways. Keep
`provider`, `api_key`, and `base_url` in user config or environment variables;
project overlays cannot set them.

Key environment variables:

| Variable | Purpose |
Expand Down
12 changes: 12 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,21 @@ max_subagents = 10 # optional (1-20)
# SGLang: SGLANG_BASE_URL, SGLANG_MODEL, optional SGLANG_API_KEY
# vLLM: VLLM_BASE_URL, VLLM_MODEL, optional VLLM_API_KEY
# Ollama: OLLAMA_BASE_URL, OLLAMA_MODEL, optional OLLAMA_API_KEY
#
# Custom DeepSeek-compatible APIs usually do not need a new provider table:
# set `provider = "deepseek"` and override [providers.deepseek].base_url/model.
# For generic OpenAI-compatible gateways, use `provider = "openai"` and the
# [providers.openai] table below. Keep provider/api_key/base_url in user config
# or environment variables; project overlays are not allowed to set them.

# DeepSeek Platform (https://platform.deepseek.com)
[providers.deepseek]
# api_key = "YOUR_DEEPSEEK_API_KEY"
# base_url = "https://api.deepseek.com/beta"
# model = "deepseek-v4-pro"
# Custom DeepSeek-compatible example:
# base_url = "https://your-provider.example/v1"
# model = "deepseek-ai/DeepSeek-V4-Pro"
# http_headers = { "X-Model-Provider-Id" = "your-model-provider" } # optional custom request headers
Comment on lines 203 to 209
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 There are now two separate commented base_url and model lines inside [providers.deepseek] — the original defaults and the new custom-endpoint examples. If a user naively uncomments both groups, TOML parsers that enforce unique keys will error; others will silently use the last value. Adding a clear mutual-exclusion note or restructuring so only one pair appears at a time would prevent the confusion.

Suggested change
# api_key = "YOUR_DEEPSEEK_API_KEY"
# base_url = "https://api.deepseek.com/beta"
# model = "deepseek-v4-pro"
# Custom DeepSeek-compatible example:
# base_url = "https://your-provider.example/v1"
# model = "deepseek-ai/DeepSeek-V4-Pro"
# http_headers = { "X-Model-Provider-Id" = "your-model-provider" } # optional custom request headers
# api_key = "YOUR_DEEPSEEK_API_KEY"
# base_url = "https://api.deepseek.com/beta" # default DeepSeek platform (beta features)
# model = "deepseek-v4-pro"
# --- OR: custom DeepSeek-compatible endpoint (pick one base_url/model pair) ---
# base_url = "https://your-provider.example/v1"
# model = "deepseek-ai/DeepSeek-V4-Pro"
# http_headers = { "X-Model-Provider-Id" = "your-model-provider" } # optional custom request headers

Fix in Codex Fix in Claude Code Fix in Cursor


# NVIDIA NIM-hosted DeepSeek V4 (https://build.nvidia.com)
Expand All @@ -213,6 +222,9 @@ max_subagents = 10 # optional (1-20)
# api_key = "YOUR_OPENAI_COMPATIBLE_API_KEY"
# base_url = "https://api.openai.com/v1"
# model = "gpt-4.1"
# Gateway example:
# base_url = "https://gateway.example/v1"
# model = "your-deepseek-compatible-model"

# AtlasCloud OpenAI-compatible endpoint (https://www.atlascloud.ai/docs/models/llm)
[providers.atlascloud]
Expand Down
1 change: 1 addition & 0 deletions crates/tui/src/tui/views/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ fn config_hint_for_key(key: &str) -> &'static str {
"theme" => "system | dark | light | grayscale",
"locale" => "auto | en | ja | zh-Hans | pt-BR",
"background_color" => "#RRGGBB | default",
"base_url" => "save user config; e.g. https://api.deepseek.com/beta or https://gateway/v1",
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 prefix save user config; in the hint is grammatically confusing and inconsistent with the other hints in config_hint_for_key, which only describe the expected value format or examples. Since the scope of base_url is already displayed as SAVED in the TUI table, this prefix is redundant. Removing it makes the hint cleaner and more consistent.

Suggested change
"base_url" => "save user config; e.g. https://api.deepseek.com/beta or https://gateway/v1",
"base_url" => "e.g. https://api.deepseek.com/beta or https://gateway/v1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 The base_url hint mixes an imperative instruction ("save user config") with example URL values, which is inconsistent with every other entry in this function (all of which show only valid value formats or examples). A user typing in the TUI field would see "save user config; e.g. …" as the hint and might be confused about what to actually enter.

Suggested change
"base_url" => "save user config; e.g. https://api.deepseek.com/beta or https://gateway/v1",
"base_url" => "https://api.deepseek.com/beta | https://gateway/v1 (set in user config)",

Fix in Codex Fix in Claude Code Fix in Cursor

"default_mode" => "agent | plan | yolo",
"sidebar_width" => "10..=50",
"sidebar_focus" => "auto | work | tasks | agents | context | hidden",
Expand Down
42 changes: 42 additions & 0 deletions docs/PROVIDERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,48 @@ Non-local `http://` base URLs are rejected unless
`DEEPSEEK_ALLOW_INSECURE_HTTP=1` is set. Loopback HTTP URLs are allowed for
self-hosted runtimes.

## Custom DeepSeek-Compatible Endpoints

Most custom DeepSeek-compatible deployments can use an existing provider ID.
Do not create `[providers.deepseek_custom]`; the provider table names are fixed.
Instead, choose the closest shipped route and override its endpoint/model:

- DeepSeek-compatible hosted API: keep `provider = "deepseek"` and set
`[providers.deepseek].base_url` plus `[providers.deepseek].model`, or launch
with `DEEPSEEK_BASE_URL` and `DEEPSEEK_MODEL`.
- Generic OpenAI-compatible gateway: use `provider = "openai"` with
`[providers.openai].base_url` plus `[providers.openai].model`, or launch with
`OPENAI_BASE_URL` and `OPENAI_MODEL`.
- Local OpenAI-compatible runtimes: use `provider = "vllm"`, `"sglang"`, or
`"ollama"` with the matching provider-specific base URL/model values.

Example user config for a DeepSeek-compatible host:

```toml
provider = "deepseek"

[providers.deepseek]
api_key = "YOUR_API_KEY"
base_url = "https://your-provider.example/v1"
model = "deepseek-ai/DeepSeek-V4-Pro"
```

Example user config for a generic gateway:

```toml
provider = "openai"

[providers.openai]
api_key = "YOUR_GATEWAY_API_KEY"
base_url = "https://gateway.example/v1"
model = "your-deepseek-compatible-model"
```

Keep `provider`, `api_key`, and `base_url` in user config or process
environment. Project-local config overlays intentionally cannot set those keys,
so a repository cannot silently redirect prompts or credentials to another
endpoint.

## Shipped Providers

| Provider ID | TOML table | Auth env | Base URL env and default | Default or static models | Notes |
Expand Down
Loading