Auto‑detects and creates AI provider based on credentials, ready for use.
// Source: https://github.com/diet103/claude-code-infrastructure-showcase | License: MIT | Copyright 2025 Claude Code Infrastructure Contributors // Provided via justclaw.it.com; keep this notice with the code. /** * Provider Factory * * Auto-detects which AI provider to use based on available credentials. * Can be overridden with SKILL_AI_PROVIDER environment variable. * * Detection priority: * 1. SKILL_AI_PROVIDER env var (explicit: gemini|openai|anthropic|ollama) * 2. GEMINI_API_KEY present -> Gemini * 3. OPENAI_API_KEY present -> OpenAI * 4. ANTHROPIC_API_KEY present -> Anthropic * 5. OLLAMA_BASE_URL present -> Ollama (ping, 500ms timeout) * 6. null -> regex-only fallback * * Ollama requires explicit opt-in (SKILL_AI_PROVIDER=ollama or OLLAMA_BASE_URL): * probing for it ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key