跳至主要內容

v1.81.12-stable.1 - 防護欄政策範本與動作建構器

部署此版本

docker run litellm
docker run \
-e STORE_MODEL_IN_DB=True \
-p 4000:4000 \
ghcr.io/berriai/litellm:main-v1.81.12-stable.1

重點亮點


新增 Semgrep 並修正 OOM

此版本修正了因無界限 asyncio.Queue() 使用所造成的記憶體用盡(OOM)風險。記錄佇列(例如 GCS bucket)與 DB spend-update 佇列先前都沒有上限,在負載下可能無限制成長。它們現在使用可設定的最大大小(LITELLM_ASYNCIO_QUEUE_MAXSIZE,預設 1000);當滿載時,佇列會立即 flush 以騰出空間,而不是持續增加記憶體。另新增了一條 Semgrep 規則(.semgrep/rules/python/unbounded-memory.yml)以標記未來程式碼中類似的無界限記憶體模式。PR #20912


防護欄動作建構器

此版本新增了具條件式執行支援的防護欄政策視覺化動作建構器。您現在可以將防護欄串接成多步驟流程——如果簡單的防護欄失敗,就改為路由到進階防護欄,而不是立即封鎖。每個步驟都可設定 ON PASS 與 ON FAIL 動作(Next Step、Block 或 Allow),而且您可以在儲存前用範例訊息測試完整流程。

防護欄動作建構器

存取群組

存取群組可簡化您組織內資源存取的定義。一個群組即可授與模型、MCP 伺服器與代理程式的存取權——只要將其附加到金鑰或團隊即可。在 Admin UI 中建立群組、定義每個群組包含哪些資源,然後在建立金鑰或團隊時指派該群組。對群組的更新會自動套用到所有已附加的金鑰與團隊。

新的提供者與端點

新的提供者(2 個新增提供者)

提供者支援的 LiteLLM 端點說明
Scaleway/chat/completions用於聊天補全的 Scaleway Generative APIs
Sarvam AI/chat/completions, /audio/transcriptions, /audio/speechSarvam AI 為印度語言提供 STT 與 TTS 支援

新模型 / 更新模型

新增模型支援(19 個重點模型)

提供者模型上下文視窗輸入($/100萬 tokens)輸出($/100萬 tokens)
AWS Bedrockdeepseek.v3.2164K$0.62$1.85
AWS Bedrockminimax.minimax-m2.1196K$0.30$1.20
AWS Bedrockmoonshotai.kimi-k2.5262K$0.60$3.00
AWS Bedrockmoonshotai.kimi-k2-thinking262K$0.73$3.03
AWS Bedrockqwen.qwen3-coder-next262K$0.50$1.20
AWS Bedrocknvidia.nemotron-nano-3-30b262K$0.06$0.24
Azure AIazure_ai/kimi-k2.5262K$0.60$3.00
Vertex AIvertex_ai/zai-org/glm-5-maas200K$1.00$3.20
MiniMaxminimax/MiniMax-M2.51M$0.30$1.20
MiniMaxminimax/MiniMax-M2.5-lightning1M$0.30$2.40
Dashscopedashscope/qwen3-max258K分級定價分級定價
Perplexityperplexity/preset/pro-search-每次請求每次請求
Perplexityperplexity/openai/gpt-4o-每次請求每次請求
Perplexityperplexity/openai/gpt-5.2-每次請求每次請求
Vercel AI Gatewayvercel_ai_gateway/anthropic/claude-opus-4.6200K$5.00$25.00
Vercel AI Gatewayvercel_ai_gateway/anthropic/claude-sonnet-4200K$3.00$15.00
Vercel AI Gatewayvercel_ai_gateway/anthropic/claude-haiku-4.5200K$1.00$5.00
Sarvam AIsarvam/sarvam-m8K免費方案免費方案
Anthropicfast/claude-opus-4-61M$30.00$150.00

注意:AWS Bedrock 模型可在多個區域使用(us-east-1、us-east-2、us-west-2、eu-central-1、eu-north-1、ap-northeast-1、ap-south-1、ap-southeast-3、sa-east-1)。總共新增了 54 個區域模型項目。

功能

  • Anthropic

    • 使用 output_format 參數在 Claude Opus 4.5 與 4.6 上啟用非 tool 結構化輸出 - PR #20548
    • 在 prompt caching 中新增對 anthropic_messages 呼叫類型的支援 - PR #19233
    • 透過遠端 URL 取回管理 Anthropic Beta Headers - PR #20935, PR #21110
    • 移除 x-anthropic-billing 區塊 - PR #20951
    • 對 OAuth token 使用 Authorization Bearer,而不是 x-api-key - PR #21039
    • 篩除不支援的 JSON schema 約束以供結構化輸出 - PR #20813
    • /v1/messages 新增 Claude Opus 4.6 功能 - PR #20733
    • 修正 reasoning_effort=None"none" 在 Opus 4.6 應回傳 None - PR #20800
  • AWS Bedrock

    • 透過 4 個新的 beta 模型擴充模型支援 - PR #21035
    • 將 Claude Opus 4.6 新增至 _supports_tool_search_on_bedrock - PR #21017
    • 修正 Bedrock Claude Opus 4.6 model IDs(移除 :0 尾碼) - PR #20564, PR #20671
    • output_config 新增為支援的參數 - PR #20748
  • Vertex AI

    • 新增 Vertex GLM-5 模型支援 - PR #21053
    • extra_headers anthropic-beta 傳遞至 request body - PR #20666
    • _hidden_params 中保留 usageMetadata - PR #20559
    • IMAGE_PROHIBITED_CONTENT 對應至 content_filter - PR #20524
    • 新增 Vertex AI 的 RAG ingest - PR #21120
  • OCI / Cohere

    • OCI Cohere responseFormat/Pydantic 支援 - PR #20663
    • 透過填入 preambleOverride 修正 OCI Cohere system messages - PR #20958
  • Perplexity

    • 支援帶有預設搜尋的 Perplexity Research API - PR #20860
  • MiniMax

    • 新增 MiniMax-M2.5 與 MiniMax-M2.5-lightning 模型 - PR #21054
  • Kimi / Moonshot

  • Dashscope

    • 新增具有分級定價的 dashscope/qwen3-max 模型 - PR #20919
  • Vercel AI Gateway

    • 新增 Vercel AI Anthropic 模型 - PR #20745
  • Azure AI

    • azure_ai/kimi-k2.5 新增至 Azure 模型 DB - PR #20896
    • 支援非 Claude 的 azure_ai 模型使用 Azure AD token 驗證 - PR #20981
    • 修正 Azure batches 問題 - PR #21092
  • DeepSeek

    • 同步 DeepSeek 模型中繼資料並新增裸名稱 fallback - PR #20938
  • Gemini

    • 處理 Gemini 的 assistant 訊息中的圖片 - PR #20845
    • 新增 Gemini 模型缺少的 tpm/rpm - PR #21175
  • 一般

    • 在 pricing JSON 中新增 30 個缺少的模型 - PR #20797
    • 清理 39 個已棄用的 OpenRouter 模型 - PR #20786
    • 標準化端點 display_name 命名慣例 - PR #20791
    • 修正並穩定模型成本對應格式 - PR #20895
    • litellm.__init__ 匯出 PermissionDeniedError - PR #20960

錯誤修正


LLM API 端點

功能

  • Responses API

    • 新增伺服器端上下文管理(壓縮)支援 - PR #21058
    • 為 OpenAI Responses API 新增 Shell tool 支援 - PR #21063
    • 在串流時省略 streaming id 時,保留工具呼叫引數 delta - PR #20712
    • 在串流期間保留交錯的 thinking/redacted_thinking 區塊 - PR #20702
  • Chat Completions

    • 使用 LiteLLM /search 新增 Web Search 支援(web search 攔截 hook)- PR #20483
    • 透過攜帶 schema properties 保留可為空的物件欄位 - PR #19132
    • 支援 OpenAI 與 Azure chat completions 的 prompt_cache_key - PR #20989
  • Pass-Through Endpoints

    • 透過 LiteLLM passthrough 新增 langchain_aws 支援 - PR #20843
    • create_pass_through_route 中為 endpoint_func 新增 custom_body 參數 - PR #20849
  • Vector Stores

    • 為 vector store 端點新增 target_model_names - PR #21089
  • 一般

    • output_config 新增為支援的參數 - PR #20748
    • 新增受管理的錯誤檔案支援 - PR #20838

錯誤

  • 一般
    • 停止在串流 SSE 錯誤回應中洩漏 Python traceback - PR #20850
    • 修正未以提供者中繼資料編碼的影片清單分頁游標 - PR #20710
    • 在 SDK 路徑的 retry/error 邏輯中處理 metadata=None - PR #20873
    • 修正 Spend logs 與 Pydantic models 及 redaction 的 pickle 錯誤 - PR #20685
    • 移除來自 LLM_CONFIG_NAMES 的重複 PerplexityResponsesConfig - PR #21105

管理端點 / UI

功能

  • 存取群組

    • 新增 Access Groups 功能,用於管理模型、MCP server 與 agent 存取 - PR #21022
    • Access Groups 表格與詳細頁面 UI - PR #21165
    • model_ids 重構為 model_names 以維持向後相容性 - PR #21166
  • 政策

    • 允許將 Policies 連接到 Tags、模擬 Policies、查看 key/team 數量 - PR #20904
    • 支援條件式依序執行的 guardrail pipeline - PR #21177
    • guardrail policies 的 pipeline flow builder UI - PR #21188
  • SSO / 驗證

    • 新增 SSO 登入按鈕 - PR #20908
    • M2M OAuth2 UI 流程 - PR #20794
    • 允許 Organization 和 Team Admins 呼叫 /invitation/new - PR #20987
    • 邀請使用者:電子郵件整合警示 - PR #20790
    • 在 proxy admin JWT early-return 路徑中填入 identity 欄位 - PR #21169
  • 支出記錄

    • 在篩選器中顯示預先定義的錯誤代碼,並提供使用者可定義的 fallback - PR #20773
    • 可分頁且可搜尋的模型選擇 - PR #20892
    • 支援欄位排序 - PR #21143
    • 允許對 /spend/logs/ui 排序 - PR #20991
  • UI 改進

    • Navbar:可選擇隱藏 Usage Popup - PR #20910
    • Model 頁面:改善憑證訊息 - PR #21076
    • Fallbacks:預設可設定為 10 個模型 - PR #21144
    • 以箭頭與卡片結構顯示 fallback - PR #20922
    • Team Info:遷移至 AntD Tabs + Table - PR #20785
    • AntD 重構與 0 cost models 修正 - PR #20687
    • Zscaler AI Guard UI - PR #21077
    • 包含 Config Defined Pass Through Endpoints - PR #20898
    • 在 MCP server 頁面將 "HTTP" 重新命名為 "Streamable HTTP (Recommended)" - PR #21000
    • MCP server discovery UI - PR #21079
  • 虛擬金鑰

    • 允許 Management keys 存取 user/daily/activity 與 team - PR #20124
    • 在 team/key 更新時,對空白中繼資料欄位略過 premium 檢查 - PR #20598

錯誤

  • Logs:修正輸入與輸出複製 - PR #20657
  • Teams:修正可用 Teams - PR #20682
  • Spend Logs:重設篩選器會重設自訂日期範圍 - PR #21149
  • Usage:修正 Request Chart stack 變體 - PR #20894
  • 新增 Auto Router:描述文字輸入框聚焦 - PR #21004
  • Guardrail 編輯:LiteLLM Content Filter 類別 - PR #21002
  • 為 API keys 表格中的 models 新增空值防護 - PR #20655
  • 失敗請求顯示錯誤詳細資訊,而非 'Data Not Available' - PR #20656
  • 修正 Spend Management Tests - PR #21088
  • 修正 JWT email domain 驗證錯誤訊息 - PR #21212

AI 整合

記錄

防護欄

  • 政策範本

    • 全新政策範本:針對特定使用案例預先設定的防護欄組合 - PR #21025
    • 新增 NSFW 政策範本、多語言毒性關鍵字、兒童安全內容過濾器、JSON 內容檢視器 - PR #21205
    • 新增有毒/辱罵性內容過濾防護欄 - PR #20934
  • Pipeline 執行

    • 新增防護欄 pipeline 對條件式順序執行的支援 - PR #21177
    • 串流輸出上的代理程式防護欄 - PR #21206
    • Pipeline flow builder UI - PR #21188
  • Zscaler AI Guard

    • Zscaler AI Guard 錯誤修正,以及在 post-call 期間的支援 - PR #20801
    • Zscaler AI Guard UI - PR #21077
  • ZGuard

    • 為 ZGuard 新增團隊政策對應 - PR #20608
  • 一般

    • 為所有統一防護欄新增記錄 + 連結至自訂程式碼防護欄範本 - PR #20900
    • 將 request headers + litellm_version 傳遞給一般防護欄 - PR #20729
    • 空白 guardrails/policies 陣列不應觸發企業授權檢查 - PR #20567
    • 修正 OpenAI moderation 防護欄 - PR #20718
    • 修正 /v2/guardrails/list 回傳敏感值 - PR #20796
    • 修正防護欄狀態錯誤 - PR #20972
    • initialize_custom_guardrail 中重複使用 get_instance_fn - PR #20917

支出追蹤、預算與速率限制

  • 防止共享後端模型金鑰被污染,避免 per-deployment 自訂定價影響 - PR #20679
  • 避免原地修改 SpendUpdateQueue 聚合中的資料 - PR #20876

MCP 閘道 (12 項更新)

  • MCP M2M OAuth2 支援 - 為 MCP servers 新增 machine-to-machine OAuth2 支援 - PR #20788
  • MCP Server Discovery UI - 從 UI 瀏覽並探索可用的 MCP servers - PR #21079
  • MCP Tracing - 為透過 AI Gateway 執行的 MCP 呼叫新增 OpenTelemetry tracing - PR #21018
  • MCP OAuth2 Debug Headers - 用於 OAuth2 疑難排解的 client-side debug headers - PR #21151
  • 修正 MCP「找不到 Session」錯誤 - 解決 session 持續化問題 - PR #21040
  • 修正 MCP OAuth2 root endpoints 回傳「找不到 MCP server」 - PR #20784
  • 修正 MCP OAuth2 query param 合併,當 authorization_url 已包含參數時 - PR #20968
  • 修正 Atlassian 上的 MCP SCOPES 問題 - PR #21150
  • 修正 MCP StreamableHTTP backend - 使用 anyio.fail_after 取代 asyncio.wait_for - PR #20891
  • NPM_CONFIG_CACHE 注入 STDIO MCP subprocess env - PR #21069
  • 封鎖 MCP server 名稱與別名中的空格和連字號 - PR #21074

效能 / 負載平衡 / 可靠性改進 (8 項改進)

  • 移除 queue 中的孤立項目 - 修正 scheduler queue 的記憶體洩漏 - PR #20866
  • 移除重複的提供者解析,用於 budget limiter 熱路徑 - PR #21043
  • 重試退避時使用目前的 retry exception,而非過時的 exception - PR #20725
  • 新增 Semgrep 並修正 OOM - 靜態分析規則與記憶體不足修正 - PR #20912
  • 新增 Pyroscope 用於持續剖析與可觀測性 - PR #21167
  • 在共享 aiohttp sessions 下遵守 ssl_verify - PR #20349
  • 修正共享健康檢查序列化 - PR #21119
  • 將 model mismatch 記錄 從 WARNING 改為 DEBUG - PR #20994

資料庫變更

結構描述更新

TableChange Type說明PR移轉
LiteLLM_VerificationTokenNew Indexes新增 user_id+team_idteam_id,以及 budget_reset_at+expires 的索引PR #20736Migration
LiteLLM_PolicyAttachmentTable新欄位為 policy-to-tag connections 新增 tags text arrayPR #21061Migration
LiteLLM_AccessGroupTableNew Table用於管理 model、MCP server 與 agent 存取的 access groupsPR #21022Migration
LiteLLM_AccessGroupTableColumn Changeaccess_model_ids 重新命名為 access_model_namesPR #21166Migration
LiteLLM_ManagedVectorStoreTableNew Table搭配 model mappings 的受管理 vector store 追蹤-Migration
LiteLLM_TeamTable, LiteLLM_VerificationToken新欄位新增 access_group_ids text arrayPR #21022Migration
LiteLLM_GuardrailsTable新欄位新增 team_id text column-Migration

文件更新 (14 項更新)

  • 在 v1.81.9 release notes 中新增 LiteLLM Observatory 章節 - PR #20675
  • 在 release notes 中新增 callback 註冊最佳化 - PR #20681
  • Middleware 效能部落格文章 - PR #20677
  • UI Team Soft Budget 文件 - PR #20669
  • UI Contributing and Troubleshooting 指南 - PR #20674
  • 重新組織 Admin UI 子區段 - PR #20676
  • SDK proxy authentication (OAuth2/JWT auto-refresh) - PR #20680
  • Forward client headers to LLM API 文件修正 - PR #20768
  • 新增使用 policies 的文件指南 - PR #20914
  • 為 Claude Opus 4.6 新增 native thinking 參數範例 - PR #20799
  • 修正 Claude Code MCP 教學 - PR #21145
  • 新增 Dashscope(International 與 China/Beijing)的 API base URLs - PR #21083
  • 修正 DEFAULT_NUM_WORKERS_LITELLM_PROXY 預設值(1,而非 4) - PR #21127
  • 修正 README 中的 ElevenLabs 支援狀態 - PR #20643

新貢獻者


完整變更記錄

v1.81.9.rc.1...v1.81.12.rc.1