Terminal
Terminal/Skill
Generates a new API key on a LiteLLM proxy, with optional alias, team or user scope, budget, models, and expiry.
By LiteLLM
Works with
npx skills add berriai/litellm-skills --skill add-keyGenerate a new API key on a live LiteLLM proxy.
Ask for these if not already known:
LITELLM_BASE_URL — e.g. https://my-proxy.example.com
LITELLM_API_KEY — proxy admin key
API reference: https://litellm.vercel.app/docs/proxy/virtual_keys
my-app-prod)team_id or user_id? (optional)gpt-4o, claude-3-5-sonnet)5.00)7d, 30d, 90d) — omit for no expiryBASE="$LITELLM_BASE_URL"
KEY="$LITELLM_API_KEY"
curl -s -X POST "$BASE/key/generate" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{
"key_alias": "<alias>",
"team_id": "<team_id_or_omit>",
"user_id": "<user_id_or_omit>",
"models": [<models_or_empty>],
"max_budget": <budget_or_null>,
"duration": "<duration_or_omit>"
}'
Confirm the key was created:
curl -s "$BASE/key/info" \
-H "Authorization: Bearer <new_key>" | python3 -c "
import sys, json
d = json.load(sys.stdin)
info = d.get('info', {})
print(f'Alias: {info.get(\"key_alias\")}')
print(f'Expires: {info.get(\"expires\")}')
print(f'Budget: {info.get(\"max_budget\")}')
print(f'Models: {info.get(\"models\")}')
"
Show the user:
key — the actual key value (only shown once, tell them to save it)key_alias, expires, max_budget, modelsOn error:
LITELLM_API_KEY is a valid admin keyteam_id/user_id existsdetail and the likely fix