update-key

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Update Key

更新密钥

Update an existing API key on a live LiteLLM proxy.
在运行中的LiteLLM代理上更新现有API密钥。

Setup

配置

LITELLM_BASE_URL  — e.g. https://my-proxy.example.com
LITELLM_API_KEY   — proxy admin key
LITELLM_BASE_URL  — 示例:https://my-proxy.example.com
LITELLM_API_KEY   — 代理管理员密钥

Ask the user

询问用户信息

  1. Key (required) — the
    sk-...
    value. If they don't have it, list keys:
    bash
    curl -s "$BASE/key/list?size=25&return_full_object=true" -H "Authorization: Bearer $KEY"
  2. What to change — any combination of:
    • max_budget
      (float)
    • models
      (list)
    • key_alias
      (string)
    • tpm_limit
      /
      rpm_limit
      (int)
    • duration
      (e.g.
      30d
      — extends expiry from now)
    • team_id
      /
      user_id
      (reassign ownership)
  1. 密钥(必填)—— 格式为
    sk-...
    的值。如果用户没有该密钥,可列出所有密钥:
    bash
    curl -s "$BASE/key/list?size=25&return_full_object=true" -H "Authorization: Bearer $KEY"
  2. 要修改的内容—— 可选择以下任意组合:
    • max_budget
      (浮点数)
    • models
      (列表)
    • key_alias
      (字符串)
    • tpm_limit
      /
      rpm_limit
      (整数)
    • duration
      (例如
      30d
      — 从当前时间延长过期时间)
    • team_id
      /
      user_id
      (重新分配所有权)

Run

执行操作

bash
curl -s -X POST "$BASE/key/update" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "<sk-...>",
    "max_budget": <value>,
    "models": [<models>],
    "duration": "<duration>"
  }'
Only include the fields being changed.
bash
curl -s -X POST "$BASE/key/update" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "<sk-...>",
    "max_budget": <value>,
    "models": [<models>],
    "duration": "<duration>"
  }'
仅包含需要修改的字段。

Output

输出结果

Show the updated
key_alias
,
max_budget
,
models
,
expires
.
展示更新后的
key_alias
max_budget
models
expires
字段。