{"record":{"id":"36adfc4098912da3","repo":"BerriAI/litellm","slug":"invalid-provider-s-join-invalid-providers-36adfc","errorCode":null,"errorMessage":"Invalid provider(s): {', '.join(invalid_providers)}. Must be valid LiteLLM providers or 'global'. See https://docs.litellm.ai/docs/providers for the full list.","messagePattern":"Invalid provider\\(s\\): (.+?)\\. Must be valid LiteLLM providers or 'global'\\. See https://docs\\.litellm\\.ai/docs/providers for the full list\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"litellm/proxy/management_endpoints/cost_tracking_settings.py","lineNumber":357,"sourceCode":"        raise HTTPException(\n            status_code=500,\n            detail={\"error\": CommonProxyErrors.db_not_connected_error.value},\n        )\n\n    if store_model_in_db is not True:\n        raise HTTPException(\n            status_code=500,\n            detail={\"error\": \"Set `'STORE_MODEL_IN_DB='True'` in your env to enable this feature.\"},\n        )\n\n    # Validate that all providers are valid LiteLLM providers (except \"global\")\n    invalid_providers: Final = []\n    for provider in cost_margin_config:\n        if provider != \"global\" and provider not in LlmProvidersSet:\n            invalid_providers.append(provider)\n\n    if invalid_providers:\n        raise HTTPException(\n            status_code=400,\n            detail={\n                \"error\": f\"Invalid provider(s): {', '.join(invalid_providers)}. Must be valid LiteLLM providers or 'global'. See https://docs.litellm.ai/docs/providers for the full list.\"\n            },\n        )\n\n    # Validate margin values\n    for provider, margin_value in cost_margin_config.items():\n        if isinstance(margin_value, (int, float)):\n            # Simple percentage format: {\"openai\": 0.10}\n            if not (0 <= margin_value <= 10):  # Allow up to 1000% margin\n                raise HTTPException(\n                    status_code=400,\n                    detail=f\"Margin percentage for {provider} must be between 0 and 10 (0% to 1000%)\",\n                )\n        elif isinstance(margin_value, dict):\n            # Complex format: {\"percentage\": 0.08, \"fixed_amount\": 0.0005}\n            if \"percentage\" in margin_value:","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/cost_tracking_settings.py#L339-L375","documentation":"Validation error (HTTP 400) from PATCH /config/cost_margin_config: every key must be either the reserved key 'global' or a valid LiteLLM provider (member of LlmProvidersSet). Unrecognized keys are collected and reported in one comma-joined message. Note this endpoint — unlike the discount one — allows the special 'global' key.","triggerScenarios":"Sending model names as keys ({\"gpt-4\": 0.1}), provider typos (\"vertex\" instead of \"vertex_ai\"), or a misplaced 'default' key instead of 'global'.","commonSituations":"Assuming margin keys mirror the discount endpoint exactly; using vendor console names ('Google', 'AWS') rather than LiteLLM provider slugs.","solutions":["Use canonical LiteLLM provider slugs ('openai', 'anthropic', 'vertex_ai', 'bedrock', ...) or 'global' for a catch-all margin.","Check spelling against https://docs.litellm.ai/docs/providers or litellm.provider_list.","For per-model margins, set pricing/margins on the deployment's model_info instead."],"exampleFix":"# before\n{\"vertex\": 0.08}   # 400 Invalid provider(s): vertex\n\n# after\n{\"vertex_ai\": 0.08}   # or {\"global\": 0.08}","handlingStrategy":"validation","validationCode":"import litellm\n\nVALID_KEYS = set(litellm.provider_list) | {\"global\"}\nbad = [k for k in cost_margin_config if k not in VALID_KEYS]\nif bad:\n    raise ValueError(f\"Keys must be LiteLLM providers or 'global', got: {bad}\")","typeGuard":"def is_valid_margin_keys(cfg: dict) -> bool:\n    valid = set(litellm.provider_list) | {\"global\"}\n    return all(k in valid for k in cfg)","tryCatchPattern":null,"preventionTips":["Remember 'global' is valid only for margins, not discounts.","Use exact slugs like 'vertex_ai' and 'bedrock'.","Validate keys in CI against litellm.provider_list."],"tags":["litellm-proxy","validation","cost-tracking","providers"],"backgroundTag":"schema-validation-failed","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}