Add Cerebras as LLM provider using OpenAI-compatible API

- Register Cerebras base URL and API key env var in openai_client.py
- Route cerebras provider through OpenAIClient in factory.py
- Add available Cerebras models to validators.py
- Add Cerebras to CLI provider menu and model selection in cli/utils.py
- Add cerebras override in cli/main.py config
- Set main.py to use Cerebras llama3.1-8b (llama3.1-8b has working tool calling)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Felix Dunand Carre 2026-03-24 23:54:54 -04:00
parent 589b351f2a
commit 3aad988472
6 changed files with 23 additions and 4 deletions

View File

@ -927,6 +927,10 @@ def run_analysis():
config["deep_think_llm"] = selections["deep_thinker"]
config["backend_url"] = selections["backend_url"]
config["llm_provider"] = selections["llm_provider"].lower()
# Override with Cerebras
config["llm_provider"] = "cerebras"
config["deep_think_llm"] = "llama-4-scout-17b-16e-instruct"
config["quick_think_llm"] = "llama-4-scout-17b-16e-instruct"
# Provider-specific thinking configuration
config["google_thinking_level"] = selections.get("google_thinking_level")
config["openai_reasoning_effort"] = selections.get("openai_reasoning_effort")

View File

@ -171,6 +171,10 @@ def select_shallow_thinking_agent(provider) -> str:
("GPT-OSS:latest (20B, local)", "gpt-oss:latest"),
("GLM-4.7-Flash:latest (30B, local)", "glm-4.7-flash:latest"),
],
"cerebras": [
("Llama 3.1 8B - Fastest, lightweight", "llama3.1-8b"),
("Qwen 3 235B - Most capable", "qwen-3-235b-a22b-instruct-2507"),
],
}
choice = questionary.select(
@ -238,6 +242,10 @@ def select_deep_thinking_agent(provider) -> str:
("GPT-OSS:latest (20B, local)", "gpt-oss:latest"),
("Qwen3:latest (8B, local)", "qwen3:latest"),
],
"cerebras": [
("Qwen 3 235B - Most capable", "qwen-3-235b-a22b-instruct-2507"),
("Llama 3.1 8B - Fastest, lightweight", "llama3.1-8b"),
],
}
choice = questionary.select(
@ -272,6 +280,7 @@ def select_llm_provider() -> tuple[str, str]:
("xAI", "https://api.x.ai/v1"),
("Openrouter", "https://openrouter.ai/api/v1"),
("Ollama", "http://localhost:11434/v1"),
("Cerebras", "https://api.cerebras.ai/v1"),
]
choice = questionary.select(

View File

@ -8,9 +8,10 @@ load_dotenv()
# Create a custom config
config = DEFAULT_CONFIG.copy()
config["deep_think_llm"] = "gpt-5-mini" # Use a different model
config["quick_think_llm"] = "gpt-5-mini" # Use a different model
config["max_debate_rounds"] = 1 # Increase debate rounds
config["llm_provider"] = "cerebras"
config["deep_think_llm"] = "llama3.1-8b"
config["quick_think_llm"] = "llama3.1-8b"
config["max_debate_rounds"] = 1
# Configure data vendors (default uses yfinance, no extra API keys needed)
config["data_vendors"] = {

View File

@ -34,7 +34,7 @@ def create_llm_client(
"""
provider_lower = provider.lower()
if provider_lower in ("openai", "ollama", "openrouter"):
if provider_lower in ("openai", "ollama", "openrouter", "cerebras"):
return OpenAIClient(model, base_url, provider=provider_lower, **kwargs)
if provider_lower == "xai":

View File

@ -29,6 +29,7 @@ _PROVIDER_CONFIG = {
"xai": ("https://api.x.ai/v1", "XAI_API_KEY"),
"openrouter": ("https://openrouter.ai/api/v1", "OPENROUTER_API_KEY"),
"ollama": ("http://localhost:11434/v1", None),
"cerebras": ("https://api.cerebras.ai/v1", "CEREBRAS_API_KEY"),
}

View File

@ -48,6 +48,10 @@ VALID_MODELS = {
"grok-4-fast-reasoning",
"grok-4-fast-non-reasoning",
],
"cerebras": [
"qwen-3-235b-a22b-instruct-2507",
"llama3.1-8b",
],
}