Add DeepSeek platform + ChatCompletions dialect system (provider 3)

The 6th registry row: id "deepseek", DEEPSEEK_API_KEY > auth.json
"deepseek" scope, base https://api.deepseek.com (chat rides
{base}/chat/completions per official docs) with KIGI_DEEPSEEK_BASE_URL
override, enrichment-backed metadata (1M context, 384k output cap,
high/max effort menu).

Structural fix the cycle exposed: kigi's Kimi-specific body adaptation
ran UNCONDITIONALLY on every ChatCompletions request. New ChatCompat
dialect, declared per platform row and threaded through SamplerConfig,
ClientDefaults, and the session-persisted SamplingConfig (serde-default
Kimi keeps restored pre-field sessions and BYOK endpoints byte-identical;
production persist seams copy it; subagents inherit it):
- Kimi: full legacy pipeline (dispatch ≡ legacy pinned)
- DeepSeek: thinking:{type, reasoning_effort} per api-docs.deepseek.com
  (server maps low/medium→high, xhigh→max itself; none disables; absent
  leaves the server default)
- Passthrough: OpenAI-style reasoning_effort scalar untouched (unblocks
  Groq and the rest of the OpenAI-compatible list)

Review-confirmed release blocker fixed: kigi replays Kimi's
reasoning_content (and its private model_id) on input assistant
messages — Kimi consumes these, but DeepSeek documents input
reasoning_content as prefix-mode-only (historically a 400) and other
providers don't know either field. The DeepSeek and Passthrough arms now
strip both; Kimi's own pipeline is untouched. Pinned on both message
shapes.
This commit is contained in:
2026-07-21 07:21:05 -04:00
parent b86722f508
commit 7efb4b07cc
30 changed files with 423 additions and 11 deletions
@@ -4062,6 +4062,20 @@ pub fn sampling_config_for_model(
&credentials.base_url,
);
let api_backend = info.api_backend.clone();
// Managed platform entries speak their registry dialect; BYOK/custom
// entries keep the historical Kimi body adaptation.
let chat_compat = info
.id
.as_deref()
.and_then(kigi_models::parse_managed_model_key)
.map(|(platform, _)| match platform.chat_compat() {
kigi_models::PlatformChatCompat::Kimi => kigi_sampling_types::ChatCompat::Kimi,
kigi_models::PlatformChatCompat::DeepSeek => kigi_sampling_types::ChatCompat::DeepSeek,
kigi_models::PlatformChatCompat::Passthrough => {
kigi_sampling_types::ChatCompat::Passthrough
}
})
.unwrap_or_default();
SamplerConfig {
api_key: credentials.api_key,
model: model_name,
@@ -4071,6 +4085,7 @@ pub fn sampling_config_for_model(
top_p,
api_backend,
auth_scheme: credentials.auth_scheme,
chat_compat,
extra_headers,
context_window: info.context_window.get(),
reasoning_effort: info.reasoning_effort,