HKUDS/DeepTutor · error · LLMConfigError

Model is required for cloud LLM provider

Error message

Model is required for cloud LLM provider

What it means

The cloud provider's non-streaming complete() entry point dispatches to a binding-specific backend (openai/anthropic/cohere), and every backend needs a model identifier to build the request payload. A blank or None model is rejected with LLMConfigError before any network call. The binding defaults to openai when omitted, but the model has no default.

Source

Thrown at deeptutor/services/llm/cloud_provider.py:179

    Supports OpenAI-compatible APIs and Anthropic.

    Args:
        prompt: The user prompt
        system_prompt: System prompt for context
        model: Model name
        api_key: API key
        base_url: Base URL for the API
        api_version: API version for Azure OpenAI
        binding: Provider binding type (openai, anthropic)
        **kwargs: Additional parameters (temperature, max_tokens, etc.)

    Returns:
        str: The LLM response
    """
    binding_lower = (binding or "openai").lower()
    if model is None or not model.strip():
        raise LLMConfigError("Model is required for cloud LLM provider")

    if binding_lower in ["anthropic", "claude"]:
        max_tokens_value = _coerce_int(kwargs.get("max_tokens"), None)
        temperature_value = _coerce_float(kwargs.get("temperature"), 0.7)
        return await _anthropic_complete(
            model=model,
            prompt=prompt,
            system_prompt=system_prompt,
            api_key=api_key,
            base_url=base_url,
            max_tokens=max_tokens_value,
            temperature=temperature_value,
        )

    if binding_lower == "cohere":
        max_tokens_value = _coerce_int(kwargs.get("max_tokens"), None)
        temperature_value = _coerce_float(kwargs.get("temperature"), 0.7)
        return await _cohere_complete(

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Set an active model in Settings > Catalog (or the equivalent settings JSON) so resolution supplies one.
  2. Pass an explicit model string at the call site: await complete(prompt, model='gpt-4o-mini').
  3. If model comes from config, validate it before calling: if not (model or '').strip(): raise with a specific message.
  4. Check that resolve_llm_runtime_config().model is non-empty when building profiles programmatically.

Example fix

// before
resp = await llm.complete(prompt=user_text, model=settings.get("model"))

# after
model = (settings.get("model") or "").strip()
if not model:
    raise ValueError("No model configured in settings")
resp = await llm.complete(prompt=user_text, model=model)
Defensive patterns

Strategy: validation

Validate before calling

model = (model or "").strip()
if not model:
    raise ValueError("A model name is required for cloud completion")
resp = await complete(prompt=p, model=model)

Type guard

def has_model(model: str | None) -> bool:
    return isinstance(model, str) and bool(model.strip())

Try / catch

try:
    resp = await complete(prompt=p, model=model)
except LLMConfigError as e:
    if "Model is required" in str(e):
        # prompt user to pick a model in Settings > Catalog
        ...
    raise

Prevention

When it happens

Trigger: Calling complete(prompt=..., model=None) or model=' ' via the SDK/CLI; the active runtime profile has no model set so config resolution passes an empty string; a caller reads model from a settings key that does not exist and passes None.

Common situations: Fresh install where no model was selected in Settings > Catalog; profile JSON manually edited and model field deleted; code upgraded and the model kwarg was renamed but an old call site still passes model=None.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/675907fafeecc13b. Report an issue: GitHub.