跳至主要內容

✨ 暫時增加預算

為 LiteLLM Virtual Key 設定暫時增加的預算。如果您被要求暫時提高某個 key 的預算,請使用此功能。

階層支援
LiteLLM Virtual Key✅
使用者❌
團隊❌
組織❌
企業版功能

Temporary Budget Increase需要 LiteLLM 企業版授權。立即開始 30 天免費試用或預約展示。 查看企業版完整功能。

  1. 使用預算建立 LiteLLM Virtual Key
curl -L -X POST 'http://localhost: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. 以暫時增加的預算更新 key
curl -L -X POST 'http://localhost: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 'http://localhost:4000/chat/completions' \
-H 'Authorization: Bearer sk-your-new-key' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-5.6-terra",
"messages": [{"role": "user", "content": "Hello, world!"}]
}'

預期回應標頭:

x-litellm-key-max-budget: 100.0000001