跳至主要内容

✨ 临时预算增加

为 LiteLLM 虚拟密钥设置临时预算增加。如果您被要求临时增加密钥的预算,请使用此功能。

层级结构支持
LiteLLM 虚拟密钥
用户
团队
组织
注意

✨ 临时预算增加是 LiteLLM 企业版功能。

企业定价

获取 7 天免费试用密钥

  1. 创建带有预算的 LiteLLM 虚拟密钥
curl -L -X POST 'https://:4000/key/generate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer LITELLM_MASTER_KEY' \
-d '{
"max_budget": 0.0000001
}'

预期响应

{
"key": "sk-your-new-key"
}
  1. 使用临时预算增加更新密钥
curl -L -X POST 'https://:4000/key/update' \
-H 'Authorization: Bearer LITELLM_MASTER_KEY' \
-H 'Content-Type: application/json' \
-d '{
"key": "sk-your-new-key",
"temp_budget_increase": 100,
"temp_budget_expiry": "2025-01-15"
}'
  1. 测试它!
curl -L -X POST 'https://:4000/chat/completions' \
-H 'Authorization: Bearer sk-your-new-key' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello, world!"}]
}'

预期响应头

x-litellm-key-max-budget: 100.0000001