captchaforge 0.2.40

Captcha detection and solving for Firefox and BiDi-driven browsers. Detection, vendor solver scaffolding, trusted cross-origin click delivery into nested OOPIFs, and stealth personas are implemented and tested; broad live-vendor solve rates are not yet benchmarked.
Documentation
//! VLM provider enum + per-provider endpoint/model defaults and env-var keys.
//! Split out of vlm.rs (Law 5). The DEFAULT_* constants are private to this
//! module (only VlmProvider reads them); the ENV_* keys are pub(crate) for the
//! solver's env-driven construction in the parent module.

pub(crate) const DEFAULT_OLLAMA_BASE: &str = "http://localhost:11434";
pub(crate) const DEFAULT_OLLAMA_MODEL: &str = "qwen3-vl:8b-thinking";
pub(crate) const DEFAULT_ANTHROPIC_BASE: &str = "https://api.anthropic.com";
pub(crate) const DEFAULT_ANTHROPIC_MODEL: &str = "claude-haiku-4-5";
pub(crate) const DEFAULT_OPENAI_BASE: &str = "https://api.openai.com";
pub(crate) const DEFAULT_OPENAI_MODEL: &str = "gpt-4o-mini";
pub(crate) const DEFAULT_LLAMACPP_BASE: &str = "http://localhost:8000";
pub(crate) const DEFAULT_LLAMACPP_MODEL: &str = "qwen3.6-35b-a3b";

pub(crate) const ENV_VLM_ENDPOINT: &str = "CAPTCHAFORGE_VLM_ENDPOINT";
pub(crate) const ENV_VLM_MODEL: &str = "CAPTCHAFORGE_VLM_MODEL";
pub(crate) const ENV_ANTHROPIC_KEY: &str = "ANTHROPIC_API_KEY";
pub(crate) const ENV_OPENAI_KEY: &str = "OPENAI_API_KEY";
pub(crate) const ENV_LLAMACPP_ENDPOINT: &str = "LLAMACPP_VLM_ENDPOINT";

/// Which VLM back-end to call. See module-level docs for the
/// auto-detection priority + per-provider defaults.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum VlmProvider {
    /// Local Ollama instance (the default-everyone-can-reproduce path).
    /// No API key required; talks to `/api/generate`.
    Ollama,
    /// Anthropic Claude vision API (picked when `ANTHROPIC_API_KEY` is set).
    /// Talks to `/v1/messages` with image content blocks.
    Anthropic,
    /// OpenAI GPT-4o vision, picked when `OPENAI_API_KEY` is set
    /// (and Anthropic is not). Talks to `/v1/chat/completions` with
    /// image_url content parts.
    OpenAI,
    /// Local llama.cpp server: OpenAI-compatible `/v1/chat/completions`
    /// on `http://localhost:8000` (or `LLAMACPP_VLM_ENDPOINT`). No API
    /// key required. Use with `llama-server --mmproj <vision-proj>`.
    LlamaCpp,
}

impl VlmProvider {
    pub(crate) fn default_endpoint(self) -> &'static str {
        match self {
            Self::Ollama => DEFAULT_OLLAMA_BASE,
            Self::Anthropic => DEFAULT_ANTHROPIC_BASE,
            Self::OpenAI => DEFAULT_OPENAI_BASE,
            Self::LlamaCpp => DEFAULT_LLAMACPP_BASE,
        }
    }
    pub(crate) fn default_model(self) -> &'static str {
        match self {
            Self::Ollama => DEFAULT_OLLAMA_MODEL,
            Self::Anthropic => DEFAULT_ANTHROPIC_MODEL,
            Self::OpenAI => DEFAULT_OPENAI_MODEL,
            Self::LlamaCpp => DEFAULT_LLAMACPP_MODEL,
        }
    }
}