{"repo": "bytes0211/stratifyai", "files": {"docs/provider-models-catalog.md": {"661f4b32166ae626955997ca2c09873a5fed8fd4": {"t": 1785746426.1226466, "n": 12833, "h": "d7b8435ba5a7abb9", "c": "# StratifyAI Provider & Model Catalog\n\n**Document Version:** 1.0 \n**Validation Date:** January 31, 2026 \n**Status:** All providers configured and tested ✅\n\n---\n\n## Overview\n\nThis document lists all configured and tested LLM providers in StratifyAI along with their available models. All providers listed below have been implemented, tested, and are operational.\n\n**Total Providers:** 8 \n**Total Models Available:** 30\n\n---\n\n## Provider Status Summary\n\n| Provider | Status | Models Available | API Type | Requires API Key |\n|----------|--------|------------------|----------|------------------|\n| OpenAI | ✅ Operational | 15 | Native | Yes |\n| Anthropic | ✅ Operational | 3 | Native | Yes |\n| Google (Gemini) | ✅ Operational | 3 | OpenAI-Compatible | Yes |\n| DeepSeek | ✅ Operational | 2 | OpenAI-Compatible | Yes |\n| Groq | ✅ Operational | 3 | OpenAI-Compatible | Yes |\n| Grok (X.AI) | ✅ Operational | 1 | OpenAI-Compatible | Yes |\n| OpenRouter | ✅ Operational | 2+ | OpenAI-Compatible | Yes |\n| Ollama | ✅ Operational | 3+ | OpenAI-Compatible | No (Local) |\n\n---\n\n## 1. OpenAI Provider\n\n**Provider Name:** `openai` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `OPENAI_API_KEY` \n**Implementation:** Native OpenAI SDK \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (15)\n\n#### Production Models\n1. **gpt-4o**\n - Context: 128,000 tokens\n - Cost: $2.50 input / $10.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n2. **gpt-4o-mini**\n - Context: 128,000 tokens\n - Cost: $0.15 input / $0.60 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n3. **gpt-4-turbo**\n - Context: 128,000 tokens\n - Cost: $10.00 input / $30.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓\n\n4. **gpt-4**\n - Context: 8,192 tokens\n - Cost: $30.00 input / $60.00 output (per 1M tokens)\n - Features: Tools ✓\n\n5. **gpt-3.5-turbo**\n - Context: 16,385 tokens\n - Cost: $0.50 input / $1.50 output (per 1M tokens)\n - Features: Tools ✓\n\n#### Reasoning Models (O-Series)\n6. **o1**\n - Context: 200,000 tokens\n - Cost: $15.00 input / $60.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n7. **o1-mini**\n - Context: 128,000 tokens\n - Cost: $3.00 input / $12.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n8. **o3-mini**\n - Context: 200,000 tokens\n - Cost: $1.10 input / $4.40 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n9. **o1-preview**\n - Context: 128,000 tokens\n - Cost: $15.00 input / $60.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n10. **o1-2024-12-17**\n - Context: 200,000 tokens\n - Cost: $15.00 input / $60.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n11. **o1-mini-2024-09-12**\n - Context: 128,000 tokens\n - Cost: $3.00 input / $12.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n#### Future Models (Placeholders)\n12. **gpt-5**\n - Context: 128,000 tokens\n - Cost: $10.00 input / $30.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n13. **gpt-5-mini**\n - Context: 128,000 tokens\n - Cost: $2.00 input / $6.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n14. **gpt-5-nano**\n - Context: 128,000 tokens\n - Cost: $1.00 input / $3.00 output (per 1M tokens)\n - Features: Tools ✓\n\n15. **gpt-4.1**\n - Context: 128,000 tokens\n - Cost: $2.50 input / $10.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n---\n\n## 2. Anthropic Provider\n\n**Provider Name:** `anthropic` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `ANTHROPIC_API_KEY` \n**Implementation:** Native Anthropic Messages API \n**Temperature Range:** 0.0 - 1.0\n\n### Available Models (3)\n\n1. **claude-3-5-sonnet-20241022**\n - Context: 200,000 tokens\n - Cost: $3.00 input / $15.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n2. **claude-3-5-haiku-20241022**\n - Context: 200,000 tokens\n - Cost: $0.80 input / $4.00 output (per 1M tokens)\n - Features: Tools ✓, Caching ✓\n\n3. **claude-3-opus-20240229**\n - Context: 200,000 tokens\n - Cost: $15.00 input / $75.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n---\n\n## 3. Google Gemini Provider\n\n**Provider Name:** `google` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `GOOGLE_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://generativelanguage.googleapis.com/v1beta/openai/` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (3)\n\n1. **gemini-2.5-pro**\n - Context: 1,000,000 tokens\n - Cost: $1.25 input / $5.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n2. **gemini-2.5-flash**\n - Context: 1,000,000 tokens\n - Cost: $0.075 input / $0.30 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n3. **gemini-2.5-flash-lite**\n - Context: 1,000,000 tokens\n - Cost: Free ($0.00 input / $0.00 output)\n - Features: Limited (no vision, no tools)\n\n---\n\n## 4. DeepSeek Provider\n\n**Provider Name:** `deepseek` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `DEEPSEEK_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://api.deepseek.com` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (2)\n\n1. **deepseek-chat**\n - Context: 64,000 tokens\n - Cost: $0.14 input / $0.28 output (per 1M tokens)\n - Features: Tools ✓\n\n2. **deepseek-reasoner**\n - Context: 64,000 tokens\n - Cost: $0.55 input / $2.19 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n---\n\n## 5. Groq Provider\n\n**Provider Name:** `groq` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `GROQ_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://api.groq.com/openai/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (3)\n\n1. **llama-3.1-70b-versatile**\n - Context: 131,072 tokens\n - Cost: $0.59 input / $0.79 output (per 1M tokens)\n - Features: Tools ✓\n\n2. **llama-3.1-8b-instant**\n - Context: 131,072 tokens\n - Cost: $0.05 input / $0.08 output (per 1M tokens)\n - Features: Tools ✓\n\n3. **mixtral-8x7b-32768**\n - Context: 32,768 tokens\n - Cost: $0.24 input / $0.24 output (per 1M tokens)\n - Features: Tools ✓\n\n---\n\n## 6. Grok (X.AI) Provider\n\n**Provider Name:** `grok` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `GROK_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://api.x.ai/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (1)\n\n1. **grok-beta**\n - Context: 131,072 tokens\n - Cost: $5.00 input / $15.00 output (per 1M tokens)\n - Features: Tools ✓\n\n---\n\n## 7. OpenRouter Provider\n\n**Provider Name:** `openrouter` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `OPENROUTER_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://openrouter.ai/api/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (2+)\n\n1. **anthropic/claude-3-5-sonnet**\n - Context: 200,000 tokens\n - Cost: $3.00 input / $15.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓\n\n2. **openai/gpt-4-turbo**\n - Context: 128,000 tokens\n - Cost: $10.00 input / $30.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓\n\n**Note:** OpenRouter supports many more models. Additional models can be added to the catalog as needed.\n\n---\n\n## 8. Ollama Provider\n\n**Provider Name:** `ollama` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `OLLAMA_API_KEY` (optional - runs locally) \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `http://localhost:11434/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (3+)\n\n1. **llama3.2**\n - Context: 128,000 tokens\n - Cost: Free (local)\n - Features: Local model\n\n2. **mistral**\n - Context: 32,768 tokens\n - Cost: Free (local)\n - Features: Local model\n\n3. **codellama**\n - Context: 16,384 tokens\n - Cost: Free (local)\n - Features: Local model\n\n**Note:** Ollama supports any locally installed model. Additional models can be pulled and used via `ollama pull `.\n\n---\n\n## Model Selection Guide\n\n### By Use Case\n\n**General Purpose (Best Quality):**\n- `gpt-4o` (OpenAI)\n- `claude-3-5-sonnet-20241022` (Anthropic)\n- `gemini-2.5-pro` (Google)\n\n**Cost-Effective:**\n- `gpt-4o-mini` (OpenAI) - $0.15/$0.60\n- `gemini-2.5-flash` (Google) - $0.075/$0.30\n- `deepseek-chat` (DeepSeek) - $0.14/$0.28\n\n**Reasoning/Complex Tasks:**\n- `o1` (OpenAI)\n- `o3-mini` (OpenAI)\n- `deepseek-reasoner` (DeepSeek)\n\n**Vision/Multimodal:**\n- `gpt-4o` (OpenAI)\n- `claude-3-5-sonnet-20241022` (Anthropic)\n- `gemini-2.5-pro` (Google)\n\n**Large Context:**\n- `gemini-2.5-pro` (1M tokens)\n- `gemini-2.5-flash` (1M tokens)\n- `o1` (200K tokens)\n\n**Local/Private:**\n- `llama3.2` (Ollama)\n- `mistral` (Ollama)\n- `codellama` (Ollama)\n\n---\n\n## Cost Comparison\n\n**Cheapest Models (Input Cost per 1M tokens):**\n1. Free: `gemini-2.5-flash-lite`, All Ollama models\n2. $0.05: `llama-3.1-8b-instant` (Groq)\n3. $0.075: `gemini-2.5-flash` (Google)\n4. $0.14: `deepseek-chat` (DeepSeek)\n5. $0.15: `gpt-4o-mini` (OpenAI)\n\n**Most Expensive Models (Input Cost per 1M tokens):**\n1. $30.00: `gpt-4` (OpenAI)\n2. $15.00: `claude-3-opus-20240229` (Anthropic), `o1` series (OpenAI)\n3. $10.00: `gpt-4-turbo` (OpenAI)\n4. $5.00: `grok-beta` (Grok)\n\n---\n\n## Feature Matrix\n\n| Feature | Providers |\n|---------|-----------|\n| **Vision Support** | OpenAI (gpt-4o, gpt-4-turbo), Anthropic (claude-3-5-sonnet, claude-3-opus), Google (gemini-2.5-pro, gemini-2.5-flash), OpenRouter (select models) |\n| **Function/Tool Calling** | All providers except Ollama and reasoning models |\n| **Prompt Caching** | OpenAI (gpt-4o, gpt-4o-mini), Anthropic (all Claude 3.5 models), Google (gemini-2.5-pro, gemini-2.5-flash) |\n| **Reasoning Models** | OpenAI (o1/o3 series), DeepSeek (deepseek-reasoner) |\n| **Streaming** | All providers ✓ |\n| **Free Tier** | Gemini (flash-lite), Ollama (all local models) |\n\n---\n\n## Usage Examples\n\n### OpenAI\n```python\nfrom stratifyai import LLMClient\n\nclient = LLMClient(provider=\"openai\", api_key=\"sk-...\")\nresponse = client.chat_completion(\"gpt-4o\", messages=[...])\n```\n\n### Anthropic\n```python\nclient = LLMClient(provider=\"anthropic\", api_key=\"sk-ant-...\")\nresponse = client.chat_completion(\"claude-3-5-sonnet-20241022\", messages=[...])\n```\n\n### Google Gemini\n```python\nclient = LLMClient(provider=\"google\", api_key=\"...\")\nresponse = client.chat_completion(\"gemini-2.5-flash\", messages=[...])\n```\n\n### Ollama (Local)\n```python\nclient = LLMClient(provider=\"ollama\") # No API key needed\nresponse = client.chat_completion(\"llama3.2\", messages=[...])\n```\n\n---\n\n## Environment Variables\n\nAll API keys should be set as environment variables:\n\n```bash\nexport OPENAI_API_KEY=\"sk-...\"\nexport ANTHROPIC_API_KEY=\"sk-ant-...\"\nexport GOOGLE_API_KEY=\"...\"\nexport DEEPSEEK_API_KEY=\"...\"\nexport GROQ_API_KEY=\"...\"\nexport GROK_API_KEY=\"...\"\nexport OPENROUTER_API_KEY=\"...\"\n# OLLAMA_API_KEY not required for local usage\n```\n\n---\n\n## Notes\n\n- **Validation Status:** All 8 providers have been implemented and tested (Phase 2 complete as of Jan 30, 2026)\n- **Test Coverage:** 77 unit tests passing across all providers\n- **Model Availability:** Some models (e.g., gpt-5 series) are placeholders for future releases\n- **Dynamic Models:** OpenRouter and Ollama support additional models not listed here\n- **Cost Tracking:** All providers include automatic cost calculation per request\n- **Streaming Support:** All providers support streaming responses via `chat_completion_stream()`\n- **Temperature Validation:** All providers validate temperature ranges before API calls (Anthropic: 0.0-1.0, Others: 0.0-2.0)\n\n---\n\n## Document Maintenance\n\n**Last Updated:** January 31, 2026 \n**Next Review:** Phase 3 completion (Advanced Features) \n**Update Frequency:** After each phase or when new models are added\n\nFor technical implementation details, see:\n- `llm_abstraction/config.py` - Model catalog and pricing\n- `llm_abstraction/providers/` - Provider implementations\n- `docs/stratifyai-technical-approach.md` - Complete technical design\n\n---\n\n## Temperature Constraints\n\nDifferent providers have different temperature validation requirements:\n\n- **Anthropic (Claude):** 0.0 to 1.0\n- **OpenAI:** 0.0 to 2.0\n- **Google (Gemini):** 0.0 to 2.0\n- **DeepSeek:** 0.0 to 2.0\n- **Groq:** 0.0 to 2.0\n- **Grok (X.AI):** 0.0 to 2.0\n- **OpenRouter:** 0.0 to 2.0\n- **Ollama:** 0.0 to 2.0\n\nThe library automatically validates temperature parameters before making API calls and raises a `ValidationError` if the temperature is out of the valid range for the provider.\n\n---\n\n**Document Status:** ✅ Current and validated \n**Project Phase:** Phase 2 Complete → Phase 3 In Progress\n"}, "ace3dcf477873b2da61876542a2d791206d3adbf": {"t": 1785764061.6255662, "n": 12833, "h": "d7b8435ba5a7abb9", "c": "# StratifyAI Provider & Model Catalog\n\n**Document Version:** 1.0 \n**Validation Date:** January 31, 2026 \n**Status:** All providers configured and tested ✅\n\n---\n\n## Overview\n\nThis document lists all configured and tested LLM providers in StratifyAI along with their available models. All providers listed below have been implemented, tested, and are operational.\n\n**Total Providers:** 8 \n**Total Models Available:** 30\n\n---\n\n## Provider Status Summary\n\n| Provider | Status | Models Available | API Type | Requires API Key |\n|----------|--------|------------------|----------|------------------|\n| OpenAI | ✅ Operational | 15 | Native | Yes |\n| Anthropic | ✅ Operational | 3 | Native | Yes |\n| Google (Gemini) | ✅ Operational | 3 | OpenAI-Compatible | Yes |\n| DeepSeek | ✅ Operational | 2 | OpenAI-Compatible | Yes |\n| Groq | ✅ Operational | 3 | OpenAI-Compatible | Yes |\n| Grok (X.AI) | ✅ Operational | 1 | OpenAI-Compatible | Yes |\n| OpenRouter | ✅ Operational | 2+ | OpenAI-Compatible | Yes |\n| Ollama | ✅ Operational | 3+ | OpenAI-Compatible | No (Local) |\n\n---\n\n## 1. OpenAI Provider\n\n**Provider Name:** `openai` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `OPENAI_API_KEY` \n**Implementation:** Native OpenAI SDK \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (15)\n\n#### Production Models\n1. **gpt-4o**\n - Context: 128,000 tokens\n - Cost: $2.50 input / $10.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n2. **gpt-4o-mini**\n - Context: 128,000 tokens\n - Cost: $0.15 input / $0.60 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n3. **gpt-4-turbo**\n - Context: 128,000 tokens\n - Cost: $10.00 input / $30.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓\n\n4. **gpt-4**\n - Context: 8,192 tokens\n - Cost: $30.00 input / $60.00 output (per 1M tokens)\n - Features: Tools ✓\n\n5. **gpt-3.5-turbo**\n - Context: 16,385 tokens\n - Cost: $0.50 input / $1.50 output (per 1M tokens)\n - Features: Tools ✓\n\n#### Reasoning Models (O-Series)\n6. **o1**\n - Context: 200,000 tokens\n - Cost: $15.00 input / $60.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n7. **o1-mini**\n - Context: 128,000 tokens\n - Cost: $3.00 input / $12.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n8. **o3-mini**\n - Context: 200,000 tokens\n - Cost: $1.10 input / $4.40 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n9. **o1-preview**\n - Context: 128,000 tokens\n - Cost: $15.00 input / $60.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n10. **o1-2024-12-17**\n - Context: 200,000 tokens\n - Cost: $15.00 input / $60.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n11. **o1-mini-2024-09-12**\n - Context: 128,000 tokens\n - Cost: $3.00 input / $12.00 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n#### Future Models (Placeholders)\n12. **gpt-5**\n - Context: 128,000 tokens\n - Cost: $10.00 input / $30.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n13. **gpt-5-mini**\n - Context: 128,000 tokens\n - Cost: $2.00 input / $6.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n14. **gpt-5-nano**\n - Context: 128,000 tokens\n - Cost: $1.00 input / $3.00 output (per 1M tokens)\n - Features: Tools ✓\n\n15. **gpt-4.1**\n - Context: 128,000 tokens\n - Cost: $2.50 input / $10.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n---\n\n## 2. Anthropic Provider\n\n**Provider Name:** `anthropic` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `ANTHROPIC_API_KEY` \n**Implementation:** Native Anthropic Messages API \n**Temperature Range:** 0.0 - 1.0\n\n### Available Models (3)\n\n1. **claude-3-5-sonnet-20241022**\n - Context: 200,000 tokens\n - Cost: $3.00 input / $15.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n2. **claude-3-5-haiku-20241022**\n - Context: 200,000 tokens\n - Cost: $0.80 input / $4.00 output (per 1M tokens)\n - Features: Tools ✓, Caching ✓\n\n3. **claude-3-opus-20240229**\n - Context: 200,000 tokens\n - Cost: $15.00 input / $75.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n---\n\n## 3. Google Gemini Provider\n\n**Provider Name:** `google` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `GOOGLE_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://generativelanguage.googleapis.com/v1beta/openai/` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (3)\n\n1. **gemini-2.5-pro**\n - Context: 1,000,000 tokens\n - Cost: $1.25 input / $5.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n2. **gemini-2.5-flash**\n - Context: 1,000,000 tokens\n - Cost: $0.075 input / $0.30 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓, Caching ✓\n\n3. **gemini-2.5-flash-lite**\n - Context: 1,000,000 tokens\n - Cost: Free ($0.00 input / $0.00 output)\n - Features: Limited (no vision, no tools)\n\n---\n\n## 4. DeepSeek Provider\n\n**Provider Name:** `deepseek` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `DEEPSEEK_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://api.deepseek.com` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (2)\n\n1. **deepseek-chat**\n - Context: 64,000 tokens\n - Cost: $0.14 input / $0.28 output (per 1M tokens)\n - Features: Tools ✓\n\n2. **deepseek-reasoner**\n - Context: 64,000 tokens\n - Cost: $0.55 input / $2.19 output (per 1M tokens)\n - Features: Reasoning model (fixed temperature)\n\n---\n\n## 5. Groq Provider\n\n**Provider Name:** `groq` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `GROQ_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://api.groq.com/openai/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (3)\n\n1. **llama-3.1-70b-versatile**\n - Context: 131,072 tokens\n - Cost: $0.59 input / $0.79 output (per 1M tokens)\n - Features: Tools ✓\n\n2. **llama-3.1-8b-instant**\n - Context: 131,072 tokens\n - Cost: $0.05 input / $0.08 output (per 1M tokens)\n - Features: Tools ✓\n\n3. **mixtral-8x7b-32768**\n - Context: 32,768 tokens\n - Cost: $0.24 input / $0.24 output (per 1M tokens)\n - Features: Tools ✓\n\n---\n\n## 6. Grok (X.AI) Provider\n\n**Provider Name:** `grok` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `GROK_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://api.x.ai/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (1)\n\n1. **grok-beta**\n - Context: 131,072 tokens\n - Cost: $5.00 input / $15.00 output (per 1M tokens)\n - Features: Tools ✓\n\n---\n\n## 7. OpenRouter Provider\n\n**Provider Name:** `openrouter` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `OPENROUTER_API_KEY` \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `https://openrouter.ai/api/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (2+)\n\n1. **anthropic/claude-3-5-sonnet**\n - Context: 200,000 tokens\n - Cost: $3.00 input / $15.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓\n\n2. **openai/gpt-4-turbo**\n - Context: 128,000 tokens\n - Cost: $10.00 input / $30.00 output (per 1M tokens)\n - Features: Vision ✓, Tools ✓\n\n**Note:** OpenRouter supports many more models. Additional models can be added to the catalog as needed.\n\n---\n\n## 8. Ollama Provider\n\n**Provider Name:** `ollama` \n**Status:** ✅ Operational \n**API Key Environment Variable:** `OLLAMA_API_KEY` (optional - runs locally) \n**Implementation:** OpenAI-Compatible API \n**Base URL:** `http://localhost:11434/v1` \n**Temperature Range:** 0.0 - 2.0\n\n### Available Models (3+)\n\n1. **llama3.2**\n - Context: 128,000 tokens\n - Cost: Free (local)\n - Features: Local model\n\n2. **mistral**\n - Context: 32,768 tokens\n - Cost: Free (local)\n - Features: Local model\n\n3. **codellama**\n - Context: 16,384 tokens\n - Cost: Free (local)\n - Features: Local model\n\n**Note:** Ollama supports any locally installed model. Additional models can be pulled and used via `ollama pull `.\n\n---\n\n## Model Selection Guide\n\n### By Use Case\n\n**General Purpose (Best Quality):**\n- `gpt-4o` (OpenAI)\n- `claude-3-5-sonnet-20241022` (Anthropic)\n- `gemini-2.5-pro` (Google)\n\n**Cost-Effective:**\n- `gpt-4o-mini` (OpenAI) - $0.15/$0.60\n- `gemini-2.5-flash` (Google) - $0.075/$0.30\n- `deepseek-chat` (DeepSeek) - $0.14/$0.28\n\n**Reasoning/Complex Tasks:**\n- `o1` (OpenAI)\n- `o3-mini` (OpenAI)\n- `deepseek-reasoner` (DeepSeek)\n\n**Vision/Multimodal:**\n- `gpt-4o` (OpenAI)\n- `claude-3-5-sonnet-20241022` (Anthropic)\n- `gemini-2.5-pro` (Google)\n\n**Large Context:**\n- `gemini-2.5-pro` (1M tokens)\n- `gemini-2.5-flash` (1M tokens)\n- `o1` (200K tokens)\n\n**Local/Private:**\n- `llama3.2` (Ollama)\n- `mistral` (Ollama)\n- `codellama` (Ollama)\n\n---\n\n## Cost Comparison\n\n**Cheapest Models (Input Cost per 1M tokens):**\n1. Free: `gemini-2.5-flash-lite`, All Ollama models\n2. $0.05: `llama-3.1-8b-instant` (Groq)\n3. $0.075: `gemini-2.5-flash` (Google)\n4. $0.14: `deepseek-chat` (DeepSeek)\n5. $0.15: `gpt-4o-mini` (OpenAI)\n\n**Most Expensive Models (Input Cost per 1M tokens):**\n1. $30.00: `gpt-4` (OpenAI)\n2. $15.00: `claude-3-opus-20240229` (Anthropic), `o1` series (OpenAI)\n3. $10.00: `gpt-4-turbo` (OpenAI)\n4. $5.00: `grok-beta` (Grok)\n\n---\n\n## Feature Matrix\n\n| Feature | Providers |\n|---------|-----------|\n| **Vision Support** | OpenAI (gpt-4o, gpt-4-turbo), Anthropic (claude-3-5-sonnet, claude-3-opus), Google (gemini-2.5-pro, gemini-2.5-flash), OpenRouter (select models) |\n| **Function/Tool Calling** | All providers except Ollama and reasoning models |\n| **Prompt Caching** | OpenAI (gpt-4o, gpt-4o-mini), Anthropic (all Claude 3.5 models), Google (gemini-2.5-pro, gemini-2.5-flash) |\n| **Reasoning Models** | OpenAI (o1/o3 series), DeepSeek (deepseek-reasoner) |\n| **Streaming** | All providers ✓ |\n| **Free Tier** | Gemini (flash-lite), Ollama (all local models) |\n\n---\n\n## Usage Examples\n\n### OpenAI\n```python\nfrom stratifyai import LLMClient\n\nclient = LLMClient(provider=\"openai\", api_key=\"sk-...\")\nresponse = client.chat_completion(\"gpt-4o\", messages=[...])\n```\n\n### Anthropic\n```python\nclient = LLMClient(provider=\"anthropic\", api_key=\"sk-ant-...\")\nresponse = client.chat_completion(\"claude-3-5-sonnet-20241022\", messages=[...])\n```\n\n### Google Gemini\n```python\nclient = LLMClient(provider=\"google\", api_key=\"...\")\nresponse = client.chat_completion(\"gemini-2.5-flash\", messages=[...])\n```\n\n### Ollama (Local)\n```python\nclient = LLMClient(provider=\"ollama\") # No API key needed\nresponse = client.chat_completion(\"llama3.2\", messages=[...])\n```\n\n---\n\n## Environment Variables\n\nAll API keys should be set as environment variables:\n\n```bash\nexport OPENAI_API_KEY=\"sk-...\"\nexport ANTHROPIC_API_KEY=\"sk-ant-...\"\nexport GOOGLE_API_KEY=\"...\"\nexport DEEPSEEK_API_KEY=\"...\"\nexport GROQ_API_KEY=\"...\"\nexport GROK_API_KEY=\"...\"\nexport OPENROUTER_API_KEY=\"...\"\n# OLLAMA_API_KEY not required for local usage\n```\n\n---\n\n## Notes\n\n- **Validation Status:** All 8 providers have been implemented and tested (Phase 2 complete as of Jan 30, 2026)\n- **Test Coverage:** 77 unit tests passing across all providers\n- **Model Availability:** Some models (e.g., gpt-5 series) are placeholders for future releases\n- **Dynamic Models:** OpenRouter and Ollama support additional models not listed here\n- **Cost Tracking:** All providers include automatic cost calculation per request\n- **Streaming Support:** All providers support streaming responses via `chat_completion_stream()`\n- **Temperature Validation:** All providers validate temperature ranges before API calls (Anthropic: 0.0-1.0, Others: 0.0-2.0)\n\n---\n\n## Document Maintenance\n\n**Last Updated:** January 31, 2026 \n**Next Review:** Phase 3 completion (Advanced Features) \n**Update Frequency:** After each phase or when new models are added\n\nFor technical implementation details, see:\n- `llm_abstraction/config.py` - Model catalog and pricing\n- `llm_abstraction/providers/` - Provider implementations\n- `docs/stratifyai-technical-approach.md` - Complete technical design\n\n---\n\n## Temperature Constraints\n\nDifferent providers have different temperature validation requirements:\n\n- **Anthropic (Claude):** 0.0 to 1.0\n- **OpenAI:** 0.0 to 2.0\n- **Google (Gemini):** 0.0 to 2.0\n- **DeepSeek:** 0.0 to 2.0\n- **Groq:** 0.0 to 2.0\n- **Grok (X.AI):** 0.0 to 2.0\n- **OpenRouter:** 0.0 to 2.0\n- **Ollama:** 0.0 to 2.0\n\nThe library automatically validates temperature parameters before making API calls and raises a `ValidationError` if the temperature is out of the valid range for the provider.\n\n---\n\n**Document Status:** ✅ Current and validated \n**Project Phase:** Phase 2 Complete → Phase 3 In Progress\n"}}, "stratifyai/utils/sanitizer.py": {"661f4b32166ae626955997ca2c09873a5fed8fd4": {"t": 1785747464.954066, "n": 2761, "h": "45d7272c2bc6fba3", "c": "\"\"\"Sanitization helpers for safe error handling.\"\"\"\n\nimport re\n\n# Pre-compiled patterns for known API key formats\n_KEY_PATTERNS = [\n # OpenAI keys (standard and project-scoped)\n re.compile(r\"sk-[a-zA-Z0-9\\-_]{16,}\"),\n re.compile(r\"sk-proj-[a-zA-Z0-9\\-_]{16,}\"),\n # Anthropic keys\n re.compile(r\"sk-ant-[a-zA-Z0-9\\-_]{16,}\"),\n # Groq keys\n re.compile(r\"gsk_[a-zA-Z0-9\\-_]{16,}\"),\n # Grok / xAI keys\n re.compile(r\"xai-[a-zA-Z0-9\\-_]{16,}\"),\n # Google API keys (AIzaSy...)\n re.compile(r\"AIza[a-zA-Z0-9\\-_]{30,}\"),\n # AWS access key IDs (always start with AKIA for long-term keys)\n re.compile(r\"AKIA[A-Z0-9]{16}\"),\n # AWS secret access keys (40-char base64-ish strings preceded by common assignment patterns)\n re.compile(r\"(?<=secret_access_key[=: ])[A-Za-z0-9/+=]{40}\"),\n # OpenRouter keys\n re.compile(r\"sk-or-v1-[a-zA-Z0-9\\-_]{16,}\"),\n # DeepSeek keys\n re.compile(r\"sk-[a-f0-9]{32,}\"),\n # Generic bearer-style long hex/base64 tokens (catch-all, 64+ chars)\n re.compile(r\"[A-Za-z0-9\\-_]{64,}\"),\n]\n\n_REDACTED = \"***REDACTED***\"\n\n\ndef sanitize_error(message: str, api_key: str | None = None) -> str:\n \"\"\"Remove sensitive API key fragments from error messages.\n\n Strategy:\n 1. If a known ``api_key`` is provided, replace the full key first.\n 2. Only if the full key was **not** found, attempt a prefix-only match\n (first 12 chars). The last-4-char partial match is intentionally\n skipped because short suffixes cause excessive false positives.\n 3. Apply regex-based scrubbing for all known provider key formats,\n regardless of whether a specific key was supplied.\n\n Args:\n message: The raw error string that may contain key material.\n api_key: The specific API key to scrub, if known.\n\n Returns:\n Sanitised message with key material replaced by ``***REDACTED***``.\n \"\"\"\n sanitized = message\n\n # --- Phase 1: exact key removal ----------------------------------------\n if api_key and len(api_key) >= 8:\n if api_key in sanitized:\n # Full key present — replace it and skip partial matching\n sanitized = sanitized.replace(api_key, _REDACTED)\n else:\n # Full key not found; try a longer prefix (12 chars min) to\n # reduce false positives compared to the previous 8-char prefix.\n prefix_len = min(len(api_key), max(12, len(api_key) // 2))\n prefix = api_key[:prefix_len]\n if prefix in sanitized:\n sanitized = sanitized.replace(prefix, _REDACTED)\n\n # --- Phase 2: regex-based pattern scrubbing ----------------------------\n for pattern in _KEY_PATTERNS:\n sanitized = pattern.sub(_REDACTED, sanitized)\n\n return sanitized\n"}, "a1cef8d166ee0c9716e5fc3bc775c9f4045aecf9": {"t": 1785764063.0426705, "n": 2761, "h": "45d7272c2bc6fba3", "c": "\"\"\"Sanitization helpers for safe error handling.\"\"\"\n\nimport re\n\n# Pre-compiled patterns for known API key formats\n_KEY_PATTERNS = [\n # OpenAI keys (standard and project-scoped)\n re.compile(r\"sk-[a-zA-Z0-9\\-_]{16,}\"),\n re.compile(r\"sk-proj-[a-zA-Z0-9\\-_]{16,}\"),\n # Anthropic keys\n re.compile(r\"sk-ant-[a-zA-Z0-9\\-_]{16,}\"),\n # Groq keys\n re.compile(r\"gsk_[a-zA-Z0-9\\-_]{16,}\"),\n # Grok / xAI keys\n re.compile(r\"xai-[a-zA-Z0-9\\-_]{16,}\"),\n # Google API keys (AIzaSy...)\n re.compile(r\"AIza[a-zA-Z0-9\\-_]{30,}\"),\n # AWS access key IDs (always start with AKIA for long-term keys)\n re.compile(r\"AKIA[A-Z0-9]{16}\"),\n # AWS secret access keys (40-char base64-ish strings preceded by common assignment patterns)\n re.compile(r\"(?<=secret_access_key[=: ])[A-Za-z0-9/+=]{40}\"),\n # OpenRouter keys\n re.compile(r\"sk-or-v1-[a-zA-Z0-9\\-_]{16,}\"),\n # DeepSeek keys\n re.compile(r\"sk-[a-f0-9]{32,}\"),\n # Generic bearer-style long hex/base64 tokens (catch-all, 64+ chars)\n re.compile(r\"[A-Za-z0-9\\-_]{64,}\"),\n]\n\n_REDACTED = \"***REDACTED***\"\n\n\ndef sanitize_error(message: str, api_key: str | None = None) -> str:\n \"\"\"Remove sensitive API key fragments from error messages.\n\n Strategy:\n 1. If a known ``api_key`` is provided, replace the full key first.\n 2. Only if the full key was **not** found, attempt a prefix-only match\n (first 12 chars). The last-4-char partial match is intentionally\n skipped because short suffixes cause excessive false positives.\n 3. Apply regex-based scrubbing for all known provider key formats,\n regardless of whether a specific key was supplied.\n\n Args:\n message: The raw error string that may contain key material.\n api_key: The specific API key to scrub, if known.\n\n Returns:\n Sanitised message with key material replaced by ``***REDACTED***``.\n \"\"\"\n sanitized = message\n\n # --- Phase 1: exact key removal ----------------------------------------\n if api_key and len(api_key) >= 8:\n if api_key in sanitized:\n # Full key present — replace it and skip partial matching\n sanitized = sanitized.replace(api_key, _REDACTED)\n else:\n # Full key not found; try a longer prefix (12 chars min) to\n # reduce false positives compared to the previous 8-char prefix.\n prefix_len = min(len(api_key), max(12, len(api_key) // 2))\n prefix = api_key[:prefix_len]\n if prefix in sanitized:\n sanitized = sanitized.replace(prefix, _REDACTED)\n\n # --- Phase 2: regex-based pattern scrubbing ----------------------------\n for pattern in _KEY_PATTERNS:\n sanitized = pattern.sub(_REDACTED, sanitized)\n\n return sanitized\n"}, "a5beafcb1f0bbea0547c7d71d31d1ecb069db6eb": {"t": 1785764064.1979477, "n": 2792, "h": "701285030074c152", "c": "\"\"\"Sanitization helpers for safe error handling.\"\"\"\n\nimport re\nfrom typing import Optional\n\n# Pre-compiled patterns for known API key formats\n_KEY_PATTERNS = [\n # OpenAI keys (standard and project-scoped)\n re.compile(r\"sk-[a-zA-Z0-9\\-_]{16,}\"),\n re.compile(r\"sk-proj-[a-zA-Z0-9\\-_]{16,}\"),\n # Anthropic keys\n re.compile(r\"sk-ant-[a-zA-Z0-9\\-_]{16,}\"),\n # Groq keys\n re.compile(r\"gsk_[a-zA-Z0-9\\-_]{16,}\"),\n # Grok / xAI keys\n re.compile(r\"xai-[a-zA-Z0-9\\-_]{16,}\"),\n # Google API keys (AIzaSy...)\n re.compile(r\"AIza[a-zA-Z0-9\\-_]{30,}\"),\n # AWS access key IDs (always start with AKIA for long-term keys)\n re.compile(r\"AKIA[A-Z0-9]{16}\"),\n # AWS secret access keys (40-char base64-ish strings preceded by common assignment patterns)\n re.compile(r\"(?<=secret_access_key[=: ])[A-Za-z0-9/+=]{40}\"),\n # OpenRouter keys\n re.compile(r\"sk-or-v1-[a-zA-Z0-9\\-_]{16,}\"),\n # DeepSeek keys\n re.compile(r\"sk-[a-f0-9]{32,}\"),\n # Generic bearer-style long hex/base64 tokens (catch-all, 64+ chars)\n re.compile(r\"[A-Za-z0-9\\-_]{64,}\"),\n]\n\n_REDACTED = \"***REDACTED***\"\n\n\ndef sanitize_error(message: str, api_key: Optional[str] = None) -> str:\n \"\"\"Remove sensitive API key fragments from error messages.\n\n Strategy:\n 1. If a known ``api_key`` is provided, replace the full key first.\n 2. Only if the full key was **not** found, attempt a prefix-only match\n (first 12 chars). The last-4-char partial match is intentionally\n skipped because short suffixes cause excessive false positives.\n 3. Apply regex-based scrubbing for all known provider key formats,\n regardless of whether a specific key was supplied.\n\n Args:\n message: The raw error string that may contain key material.\n api_key: The specific API key to scrub, if known.\n\n Returns:\n Sanitised message with key material replaced by ``***REDACTED***``.\n \"\"\"\n sanitized = message\n\n # --- Phase 1: exact key removal ----------------------------------------\n if api_key and len(api_key) >= 8:\n if api_key in sanitized:\n # Full key present — replace it and skip partial matching\n sanitized = sanitized.replace(api_key, _REDACTED)\n else:\n # Full key not found; try a longer prefix (12 chars min) to\n # reduce false positives compared to the previous 8-char prefix.\n prefix_len = min(len(api_key), max(12, len(api_key) // 2))\n prefix = api_key[:prefix_len]\n if prefix in sanitized:\n sanitized = sanitized.replace(prefix, _REDACTED)\n\n # --- Phase 2: regex-based pattern scrubbing ----------------------------\n for pattern in _KEY_PATTERNS:\n sanitized = pattern.sub(_REDACTED, sanitized)\n\n return sanitized\n"}}}}