{"record":{"id":"ffa48fba41eee1c2","repo":"BerriAI/litellm","slug":"provider-custom-llm-provider-not-found","errorCode":null,"errorMessage":"Provider {custom_llm_provider} not found","messagePattern":"Provider (.+?) not found","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/get_llm_provider_logic.py","lineNumber":539,"sourceCode":"    Returns:\n        Tuple[str, str, Optional[str], Optional[str]]:\n            model: str\n            custom_llm_provider: str\n            dynamic_api_key: Optional[str]\n            api_base: Optional[str]\n    \"\"\"\n\n    custom_llm_provider = model.split(\"/\", 1)[0]\n    model = model.split(\"/\", 1)[1]\n\n    # Check JSON providers FIRST (before hardcoded ones)\n    from litellm.llms.openai_like.dynamic_config import create_config_class\n    from litellm.llms.openai_like.json_loader import JSONProviderRegistry\n\n    if JSONProviderRegistry.exists(custom_llm_provider):\n        provider_config: Final = JSONProviderRegistry.get(custom_llm_provider)\n        if provider_config is None:\n            raise ValueError(f\"Provider {custom_llm_provider} not found\")\n        config_class: Final = create_config_class(provider_config)\n        api_base, dynamic_api_key = config_class()._get_openai_compatible_provider_info(api_base, api_key)\n        return model, custom_llm_provider, dynamic_api_key, api_base\n\n    if custom_llm_provider == \"perplexity\":\n        # perplexity is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.perplexity.ai\n        (\n            api_base,\n            dynamic_api_key,\n        ) = litellm.PerplexityChatConfig()._get_openai_compatible_provider_info(api_base, api_key)\n    elif custom_llm_provider == \"aiohttp_openai\":\n        return model, \"aiohttp_openai\", api_key, api_base\n    elif custom_llm_provider == \"anyscale\":\n        # anyscale is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.endpoints.anyscale.com/v1\n        api_base = api_base or get_secret_str(\"ANYSCALE_API_BASE\") or \"https://api.endpoints.anyscale.com/v1\"\n        dynamic_api_key = api_key or get_secret_str(\"ANYSCALE_API_KEY\")\n    elif custom_llm_provider == \"deepinfra\":\n        (","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/get_llm_provider_logic.py#L521-L557","documentation":"Raised in _get_openai_compatible_provider_info when a provider exists in the JSONProviderRegistry (JSON-defined custom providers) but JSONProviderRegistry.get() returns None — an inconsistent registry state where exists() and get() disagree (e.g. a malformed provider JSON entry).","triggerScenarios":"Defining a custom provider via litellm's JSON provider registry (openai_like JSON config) with an entry that registers its name but fails to load its config, then calling model='that-provider/model'.","commonSituations":"Malformed custom provider JSON (missing required fields so config parsing yields None), partially written config files, or version drift in the JSON schema expected by the loader.","solutions":["Inspect your provider JSON definition and fix missing/invalid fields per the openai_like JSON provider docs.","Run JSONProviderRegistry.get(provider) yourself to see the None result and debug loading.","Validate the JSON against the schema litellm documents for JSON-defined providers.","Upgrade litellm if the loader had a bug handling your config shape."],"exampleFix":"// before\n{ \"myprovider\": { \"models\": {} } }  // missing required fields -> registry.get() returns None\n\n// after\n{ \"myprovider\": { \"api_base\": \"https://api.myprovider.com/v1\", \"models\": { \"m1\": {} } } }","handlingStrategy":"validation","validationCode":"from litellm.llms.openai_like.json_loader import JSONProviderRegistry\n\ndef provider_config_loads(provider: str) -> bool:\n    return JSONProviderRegistry.exists(provider) and JSONProviderRegistry.get(provider) is not None","typeGuard":null,"tryCatchPattern":"try {\n  await litellm.completion({ model: 'myprov/m1', ... });\n} catch (e) {\n  if (/Provider \\S+ not found/.test(e.message)) { /* fix provider JSON definition */ }\n}","preventionTips":["Test JSONProviderRegistry.get() during config load, not at request time.","Keep custom provider JSON complete (api_base, models, auth fields).","Validate provider JSON against the documented schema on deploy."],"tags":["json-providers","registry","custom-provider","config"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}