Skip to main content

Overview

The LiteLLM proxy provides comprehensive key management endpoints for creating, updating, listing, and deleting API keys with granular access control.

Generate Key

POST /key/generate

Create a new API key.

Request Body

array
Models this key can access.
string
Key expiration duration.Examples: "30d", "1h", "permanent"
object
Custom metadata for the key.
number
Maximum spending limit for this key in USD.
integer
Tokens per minute limit.
integer
Requests per minute limit.
string
Associate key with a team.
string
Associate key with a user.
object
Model aliases for this key.
object
Additional configuration.
object
Key permissions.

Response

string
The generated API key.
string
Name/identifier for the key.
string
Expiration timestamp.
string
Associated user ID.
string
Associated team ID.

Example


List Keys

GET /key/list

List all API keys.

Query Parameters

string
Filter by user ID.
string
Filter by team ID.

Response

Returns array of key objects:
array
Array of key objects.

Example


Get Key Info

GET /key/info

Get detailed information about a specific key.

Query Parameters

string
required
The API key to query.

Response

string
The API key (masked).
array
Models accessible.
number
Total spend.
number
Budget limit.
object
Custom metadata.
integer
TPM limit.
integer
RPM limit.

Example


Update Key

POST /key/update

Update an existing API key.

Request Body

string
required
The key to update.
array
Update accessible models.
number
Update budget limit.
integer
Update TPM limit.
integer
Update RPM limit.
object
Update metadata.

Example


Delete Key

POST /key/delete

Delete an API key.

Request Body

array
required
Array of keys to delete.

Example


Regenerate Key

POST /key/regenerate

Regenerate a new key value while keeping settings.

Request Body

string
required
The key to regenerate.

Response

string
The new API key.

Example


Block/Unblock Key

POST /key/block

Temporarily block a key.

POST /key/unblock

Unblock a previously blocked key.

Complete Example