Skip to content
This repository was archived by the owner on Oct 20, 2026. It is now read-only.
Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ CodeGuard talks to any OpenAI-compatible `/chat/completions` endpoint. Built-in
| OpenAI | `openai` | `gpt-4o-mini` | Bearer | `OPENAI_API_KEY`, `OPENAI_BASE_URL` |
| OpenRouter | `openrouter` | `openai/gpt-4o-mini` | Bearer | `OPENROUTER_API_KEY` |
| Ollama (local) | `ollama` | `llama3.1` | Bearer | `OLLAMA_BASE_URL` |
| Groq | `groq` | `llama-3.3-70b-versatile` | Bearer | `GROQ_API_KEY` |
| DeepSeek | `deepseek` | `deepseek-chat` | Bearer | `DEEPSEEK_API_KEY` |
| Together | `together` | `meta-llama/Llama-3.3-70B-Instruct-Turbo` | Bearer | `TOGETHER_API_KEY` |
| Mistral | `mistral` | `mistral-small-latest` | Bearer | `MISTRAL_API_KEY` |
| Xiaomi MiMo | `mimo` | `mimo-v2.5-pro` | api-key | `MIMO_API_KEY` |

Point `base_url` at any other compatible endpoint (llama.cpp, vLLM, LM Studio, a local proxy) and it just works. Code review runs at a low default temperature (0.3) for consistent severity classification regardless of provider.
Expand Down
28 changes: 28 additions & 0 deletions src/codeguard/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,34 @@
"env_key": "OLLAMA_API_KEY",
"env_base": "OLLAMA_BASE_URL",
},
"groq": {
"base_url": "https://api.groq.com/openai/v1",
"auth_style": "bearer",
"model": "llama-3.3-70b-versatile",
"env_key": "GROQ_API_KEY",
"env_base": "GROQ_BASE_URL",
},
"deepseek": {
"base_url": "https://api.deepseek.com/v1",
"auth_style": "bearer",
"model": "deepseek-chat",
"env_key": "DEEPSEEK_API_KEY",
"env_base": "DEEPSEEK_BASE_URL",
},
"together": {
"base_url": "https://api.together.xyz/v1",
"auth_style": "bearer",
"model": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
"env_key": "TOGETHER_API_KEY",
"env_base": "TOGETHER_BASE_URL",
},
"mistral": {
"base_url": "https://api.mistral.ai/v1",
"auth_style": "bearer",
"model": "mistral-small-latest",
"env_key": "MISTRAL_API_KEY",
"env_base": "MISTRAL_BASE_URL",
},
}

DEFAULT_PROVIDER = "mimo"
Expand Down
31 changes: 30 additions & 1 deletion tests/unit/test_llm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@

class TestProviderPresets:
def test_known_providers_present(self):
for provider in ("mimo", "openai", "openrouter", "ollama"):
for provider in (
"mimo",
"openai",
"openrouter",
"ollama",
"groq",
"deepseek",
"together",
"mistral",
):
assert provider in PROVIDER_PRESETS

def test_default_provider_is_mimo(self):
Expand Down Expand Up @@ -43,6 +52,26 @@ def test_unknown_provider_falls_back_to_default(self):
c = LLMConfig(provider="does-not-exist", api_key="x")
assert "xiaomimimo.com" in c.base_url

def test_groq_preset(self):
c = LLMConfig(provider="groq", api_key="t")
assert "api.groq.com" in c.base_url
assert c.auth_style == "bearer"

def test_deepseek_preset(self):
c = LLMConfig(provider="deepseek", api_key="t")
assert "api.deepseek.com" in c.base_url
assert c.auth_style == "bearer"

def test_together_preset(self):
c = LLMConfig(provider="together", api_key="t")
assert "api.together.xyz" in c.base_url
assert c.auth_style == "bearer"

def test_mistral_preset(self):
c = LLMConfig(provider="mistral", api_key="t")
assert "api.mistral.ai" in c.base_url
assert c.auth_style == "bearer"

def test_explicit_values_override_preset(self):
c = LLMConfig(provider="openai", base_url="https://proxy.local/v1", model="custom")
assert c.base_url == "https://proxy.local/v1"
Expand Down
Loading