BerriAI/litellm · error · ValueError

Invalid test value

Error message

Invalid test value

What it means

CLI guard in _run_test_chat_completion: the --test flag was given a value that is neither a boolean nor a usable string URL (neither True/False nor a string override for api_base), so the test client cannot determine where to send the request; raised as ValueError.

Source

Thrown at litellm/proxy/proxy_cli.py:208

        response: Final = httpx.get(url=f"http://{host}:{port}/health")
        print(json.dumps(response.json(), indent=4))

    @staticmethod
    def _run_test_chat_completion(
        host: str,
        port: int,
        model: str,
        test: bool | str,
    ):
        request_model: Final = model or "gpt-3.5-turbo"
        click.echo(f"\nLiteLLM: Making a test ChatCompletions request to your proxy. Model={request_model}")
        import openai

        api_base = f"http://{host}:{port}"
        if isinstance(test, str):
            api_base = test
        else:
            raise ValueError("Invalid test value")
        client: Final = openai.OpenAI(api_key="My API Key", base_url=api_base)

        response: Final = client.chat.completions.create(
            model=request_model,
            messages=[
                {
                    "role": "user",
                    "content": "this is a test request, write a short poem",
                }
            ],
            max_tokens=256,
        )
        click.echo(f"\nLiteLLM: response from proxy {response}")

        print(f"\n LiteLLM: Making a test ChatCompletions + streaming r equest to proxy. Model={request_model}")

        stream_response: Final = client.chat.completions.create(
            model=request_model,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide a valid value for the CLI test flag; check --help for accepted values.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/proxy_cli.py:208 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/35e7103eae75da2b. Report an issue: GitHub.