fix(consus): forward reasoning_effort + register in support manifest

Addresses two points of feedback on the open PR:

1. Override `custom_llm_provider` and `get_supported_openai_params`
   on `ConsusChatConfig` so `reasoning_effort` is forwarded for
   models with `supports_reasoning: true` instead of being silently
   dropped by the parent's default param filter. Mirrors xAI's
   pattern (Greptile review).

2. Add a `consus` entry to `provider_endpoints_support.json` so
   the documentation-coverage guard in CI's `code-quality` job
   passes.

Tests: new `TestConsusReasoningSupport` class with 3 cases
verifying `reasoning_effort` is advertised for Claude (reasoning),
suppressed for GPT-4.1 (non-reasoning), and that
`custom_llm_provider` returns `"consus"`. All 17 Consus tests pass.
This commit is contained in:
ericmagliarditi 2026-05-08 09:46:10 -04:00
parent 97e1b5c98f
commit 5c04fdbc7d
No known key found for this signature in database
3 changed files with 56 additions and 0 deletions

View file

@ -18,10 +18,25 @@ CONSUS_API_BASE = "https://api.consus.io/v1"
class ConsusChatConfig(OpenAIGPTConfig):
@property
def custom_llm_provider(self) -> Optional[str]:
return "consus"
@staticmethod
def _resolve_api_key(api_key: Optional[str]) -> Optional[str]:
return api_key or litellm.consus_key or get_secret_str("CONSUS_API_KEY")
def get_supported_openai_params(self, model: str) -> list:
base_params = super().get_supported_openai_params(model)
try:
if litellm.supports_reasoning(
model=model, custom_llm_provider=self.custom_llm_provider
):
base_params.append("reasoning_effort")
except Exception:
pass
return base_params
def _get_openai_compatible_provider_info(
self, api_base: Optional[str], api_key: Optional[str]
) -> Tuple[Optional[str], Optional[str]]:

View file

@ -635,6 +635,24 @@
"interactions": true
}
},
"consus": {
"display_name": "Consus (`consus`)",
"url": "https://docs.litellm.ai/docs/providers/consus",
"endpoints": {
"chat_completions": true,
"messages": true,
"responses": true,
"embeddings": false,
"image_generations": false,
"audio_transcriptions": false,
"audio_speech": false,
"moderations": false,
"batches": false,
"rerank": false,
"a2a": true,
"interactions": true
}
},
"crusoe": {
"display_name": "Crusoe (`crusoe`)",
"url": "https://docs.litellm.ai/docs/providers/crusoe",

View file

@ -141,3 +141,26 @@ class TestConsusModelRouting:
model, provider, _, _ = litellm.get_llm_provider("consus/gemini-2-5-pro:il5")
assert provider == "consus"
assert model == "gemini-2-5-pro:il5"
class TestConsusReasoningSupport:
"""Reasoning-capable Consus models must surface `reasoning_effort` as a
supported OpenAI param so it isn't silently filtered out before the
request leaves LiteLLM. Models without `supports_reasoning: true` in
the catalog must NOT advertise the param.
"""
def test_reasoning_effort_supported_for_claude_models(self):
config = ConsusChatConfig()
params = config.get_supported_openai_params("claude-sonnet-4-5:il2")
assert "reasoning_effort" in params
def test_reasoning_effort_not_supported_for_gpt_4_1(self):
# gpt-4.1 is registered in the Consus catalog without
# `supports_reasoning`, so the param must NOT be advertised.
config = ConsusChatConfig()
params = config.get_supported_openai_params("gpt-4.1:il5+itar")
assert "reasoning_effort" not in params
def test_custom_llm_provider_returns_consus(self):
assert ConsusChatConfig().custom_llm_provider == "consus"