Function autoDetectProvider

  • Auto-detects the active provider by scanning well-known environment variables and CLI binaries in priority order.

    Returns the identifier of the first provider whose key/URL env var is non-empty or whose CLI binary is on PATH, or undefined when no recognisable runtime is present.

    Priority: openrouter → openai → anthropic → gemini → claude-code-cli → gemini-cli → ollama → …

    Parameters

    • Optional task: ProviderDefaultTask

    Returns string | undefined