BerriAI/litellm · error · ValueError

Missing Novita AI API Key - A call is being made to novita…

Error message

Missing Novita AI API Key - A call is being made to novita but no key is set either in the environment variables or via params

What it means

Error "Missing Novita AI API Key - A call is being made to novita but no key is set either in the environment variables or via params" thrown in BerriAI/litellm.

Solutions

  1. Set NOVITA_API_KEY in the environment, or pass api_key='...' to the completion call.

When it happens

Trigger: Thrown at litellm/llms/novita/chat/transformation.py:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/bb4a88282e556696. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/novita/chat/transformation.py:25

"""

from ....types.llms.openai import AllMessageValues
from ...openai.chat.gpt_transformation import OpenAIGPTConfig


class NovitaConfig(OpenAIGPTConfig):
    def validate_environment(
        self,
        headers: dict,
        model: str,
        messages: list[AllMessageValues],
        optional_params: dict,
        litellm_params: dict,
        api_key: str | None = None,
        api_base: str | None = None,
    ) -> dict:
        if api_key is None:
            raise ValueError(
                "Missing Novita AI API Key - A call is being made to novita but no key is set either in the environment variables or via params"
            )
        headers["Authorization"] = f"Bearer {api_key}"
        headers["Content-Type"] = "application/json"
        headers["X-Novita-Source"] = "litellm"
        return headers

View on GitHub (pinned to 77b7c6c40c)