Skip to main content
POST
/
api
/
keys
Create a gateway API key
curl --request POST \
  --url https://litellm-rust.onrender.com/api/keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "label": "alice"
}
'
import requests

url = "https://litellm-rust.onrender.com/api/keys"

payload = { "label": "alice" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({label: 'alice'})
};

fetch('https://litellm-rust.onrender.com/api/keys', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "<string>",
  "label": "<string>",
  "key": "<string>"
}

Authorizations

Authorization
string
header
required

Your LITELLM_MASTER_KEY. Default for local Docker Compose: sk-local

Body

application/json
label
string
Example:

"alice"

Response

Created. The secret is returned once.

id
string
label
string
key
string

The secret value — shown once, store it now.