BerriAI/litellm · error · ValueError

Jina AI API key is required, please set 'JINA_AI_API_KEY' in

Error message

Jina AI API key is required, please set 'JINA_AI_API_KEY' in your environment

What it means

Credential resolution guard for Jina AI rerank: no API key was resolvable from the call, litellm globals, or the JINA_AI_API_KEY environment variable, so the rerank request cannot be authenticated.

Source

Thrown at litellm/rerank_api/main.py:293

            )

            if api_key is None:
                raise ValueError("TogetherAI API key is required, please set 'TOGETHERAI_API_KEY' in your environment")

            response = together_rerank.rerank(
                model=model,
                query=query,
                documents=documents,
                top_n=top_n,
                rank_fields=rank_fields,
                return_documents=return_documents,
                max_chunks_per_doc=max_chunks_per_doc,
                api_key=api_key,
                _is_async=_is_async,
            )
        elif _custom_llm_provider == litellm.LlmProviders.JINA_AI:
            if dynamic_api_key is None:
                raise ValueError("Jina AI API key is required, please set 'JINA_AI_API_KEY' in your environment")

            api_base = (
                dynamic_api_base or optional_params.api_base or litellm.api_base or get_secret("BEDROCK_API_BASE")
            )

            response = base_llm_http_handler.rerank(
                model=model,
                custom_llm_provider=_custom_llm_provider,
                optional_rerank_params=optional_rerank_params,
                logging_obj=litellm_logging_obj,
                provider_config=rerank_provider_config,
                timeout=optional_params.timeout,
                api_key=dynamic_api_key or optional_params.api_key,
                api_base=api_base,
                _is_async=_is_async,
                headers=headers or litellm.headers or {},
                client=client,
                model_response=model_response,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set JINA_AI_API_KEY in your environment.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/rerank_api/main.py:293 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/d0d2a14c96e2a260. Report an issue: GitHub.