Overview
Create comprehensive documentation for LiteLLM's virtual key management API endpoints, including request/response JSON schemas and a guide on how to discover API information in the codebase.
Success Criteria
1. Complete API Endpoint Coverage
Document all key management endpoints with the following for each:
| Endpoint |
Method |
Description |
/key/generate |
POST |
Create a new virtual key |
/key/update |
POST |
Update an existing key's parameters |
/key/delete |
POST |
Delete one or more keys |
/key/info |
GET |
Retrieve key information |
/key/unblock |
POST |
Unblock a blocked key |
/key/regenerate |
POST |
Regenerate a key with optional grace period |
/key/service-account/generate |
POST |
Create a service account key |
2. JSON Schema Examples for Each Endpoint
Each endpoint should include:
- Request Body Schema: Full JSON structure with field descriptions and types
- Required vs Optional Fields: Clearly marked
- Example Request: curl command with realistic values
- Example Response: Expected response JSON
Example format for /key/generate:
{
"key": "string (optional) - Custom key value, auto-generated if omitted",
"key_alias": "string (optional) - User-friendly alias",
"team_id": "string (optional) - Associated team ID",
"user_id": "string (optional) - Associated user ID",
"max_budget": "number (optional) - Maximum budget in USD",
"models": ["array of strings (optional) - Allowed model names"],
"duration": "string (optional) - Key validity (e.g., '30d', '24h')",
"metadata": "object (optional) - Custom metadata key-value pairs"
// ... additional fields
}
3. API Discovery Process Documentation
Explain how maintainers can discover and verify API information:
- Locating Endpoints: How to find route definitions in
key_management_endpoints.py
- Finding Request/Response Types: Tracing Pydantic model inheritance chains in
_types.py
- Reading Docstrings: Where to find inline documentation and curl examples
- Quick Reference Table: Endpoint → Method → Request Type → File Location
4. File Locations Reference
Create a reference section mapping:
| Content |
File Location |
| Endpoint handlers |
litellm/proxy/management_endpoints/key_management_endpoints.py |
| Request schemas |
litellm/proxy/_types.py |
| Base models |
GenerateRequestBase (line 917), KeyRequestBase (line 969) |
| Specific models |
GenerateKeyRequest (line 998), UpdateKeyRequest (line 1056), etc. |
Non-Goals
- Documenting internal implementation details
- Creating API client SDKs
- Documenting deprecated/undocumented endpoints
Acceptance Criteria
Related Files
litellm/proxy/management_endpoints/key_management_endpoints.py
litellm/proxy/_types.py (lines 917-1090 for key-related schemas)
Overview
Create comprehensive documentation for LiteLLM's virtual key management API endpoints, including request/response JSON schemas and a guide on how to discover API information in the codebase.
Success Criteria
1. Complete API Endpoint Coverage
Document all key management endpoints with the following for each:
/key/generate/key/update/key/delete/key/info/key/unblock/key/regenerate/key/service-account/generate2. JSON Schema Examples for Each Endpoint
Each endpoint should include:
Example format for
/key/generate:{ "key": "string (optional) - Custom key value, auto-generated if omitted", "key_alias": "string (optional) - User-friendly alias", "team_id": "string (optional) - Associated team ID", "user_id": "string (optional) - Associated user ID", "max_budget": "number (optional) - Maximum budget in USD", "models": ["array of strings (optional) - Allowed model names"], "duration": "string (optional) - Key validity (e.g., '30d', '24h')", "metadata": "object (optional) - Custom metadata key-value pairs" // ... additional fields }3. API Discovery Process Documentation
Explain how maintainers can discover and verify API information:
key_management_endpoints.py_types.py4. File Locations Reference
Create a reference section mapping:
litellm/proxy/management_endpoints/key_management_endpoints.pylitellm/proxy/_types.pyGenerateRequestBase(line 917),KeyRequestBase(line 969)GenerateKeyRequest(line 998),UpdateKeyRequest(line 1056), etc.Non-Goals
Acceptance Criteria
Related Files
litellm/proxy/management_endpoints/key_management_endpoints.pylitellm/proxy/_types.py(lines 917-1090 for key-related schemas)