We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f42e41 commit c09d9e5Copy full SHA for c09d9e5
litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -551,6 +551,15 @@ async def _common_key_generation_helper( # noqa: PLR0915
551
prisma_client=prisma_client,
552
)
553
554
+ # Validate user-provided key format
555
+ if data.key is not None and not data.key.startswith("sk-"):
556
+ raise HTTPException(
557
+ status_code=400,
558
+ detail={
559
+ "error": f"Invalid key format. LiteLLM Virtual Key must start with 'sk-'. Received: {data.key}"
560
+ }
561
+ )
562
+
563
response = await generate_key_helper_fn(
564
request_type="key", **data_json, table_name="key"
565
0 commit comments