Add Cerebras platform + generalize StrictOpenAi dialect (provider 10)

The 13th registry row: id "cerebras", CEREBRAS_API_KEY > auth.json
"cerebras" scope, https://api.cerebras.ai/v1 with KIGI_CEREBRAS_BASE_URL
override, Bearer, ChatCompletions, enrichment-backed metadata
(models_dev_id cerebras).

Cerebras' catalog is all chat LLMs (no embedding/tts pollution) and its
/models is minimal (ids only), so restrict_to_enriched=FALSE: keep every
live model, enrich the known ones (context + effort menus low/medium/high),
unknown ones keep the default context. The e2e pins this enrich-without-
restrict path (new — prior enrichment providers all used restrict=true).

Review caught a likely-DOA defect: Cerebras uses strict
additionalProperties:false validation (confirmed 400-rejecting store,
maxTokens, thinking, nested reasoning_content), and stream_options is not
in its schema — so Passthrough (which keeps the stream_options.include_usage
kigi injects on every streaming request) would very likely 400 all
streaming. Generalized ChatCompat::Mistral -> ChatCompat::StrictOpenAi
(serde alias "mistral" keeps pre-rename persisted sessions loading), which
strips stream_options + private fields for any strict OpenAI-compat
validator; both Mistral and Cerebras now map to it. Future strict-validator
candidates (NVIDIA/Azure/Xiaomi/OpenCode) noted for the same check.

reasoning_effort (incl. "none") passes through; /v1/models requires auth
so key validation works; console cloud.cerebras.ai.
This commit is contained in:
2026-07-21 14:04:34 -04:00
parent 0a147bd8a5
commit f825132983
7 changed files with 205 additions and 23 deletions
@@ -47,7 +47,7 @@ pub(crate) fn adapt_chat_completions_body_for(
kigi_sampling_types::ChatCompat::Passthrough => {
strip_kigi_private_message_fields(body);
}
kigi_sampling_types::ChatCompat::Mistral => {
kigi_sampling_types::ChatCompat::StrictOpenAi => {
strip_kigi_private_message_fields(body);
strip_stream_options(body);
}
@@ -410,7 +410,7 @@ mod tests {
}
#[test]
fn mistral_dialect_strips_stream_options_and_private_fields() {
fn strict_openai_dialect_strips_stream_options_and_private_fields() {
use kigi_sampling_types::ChatCompat;
// Mistral 422s on stream_options (extra_forbidden) and doesn't know
// kigi's private message fields; OpenAI-style reasoning_effort stays.
@@ -424,7 +424,7 @@ mod tests {
"reasoning_content": "internal", "model_id": "kigi/x" }
]
});
adapt_chat_completions_body_for(ChatCompat::Mistral, &mut body);
adapt_chat_completions_body_for(ChatCompat::StrictOpenAi, &mut body);
assert_eq!(
body.get("stream_options"),
None,