跳到主要内容

✨ 允许团队添加模型

允许团队为该项目添加自己的模型/密钥 - 这样他们进行的任何 OpenAI 调用都会使用他们自己的 OpenAI 密钥。

这对于希望调用自己的微调模型的团队很有用。

/model/add 端点中指定团队 ID

curl -L -X POST 'http://0.0.0.0:4000/model/new' \
-H 'Authorization: Bearer sk-******2ql3-sm28WU0tTAmA' \ # 👈 Team API Key (has same 'team_id' as below)
-H 'Content-Type: application/json' \
-d '{
"model_name": "my-team-model", # 👈 Call LiteLLM with this model name
"litellm_params": {
"model": "openai/gpt-4o",
"custom_llm_provider": "openai",
"api_key": "******ccb07",
"api_base": "https://my-endpoint-sweden-berri992.openai.azure.com",
"api_version": "2023-12-01-preview"
},
"model_info": {
"team_id": "e59e2671-a064-436a-a0fa-16ae96e5a0a1" # 👈 Specify the team ID it belongs to
}
}'

测试它!

curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer sk-******2ql3-sm28WU0tTAmA' \ # 👈 Team API Key
-d '{
"model": "my-team-model", # 👈 team model name
"messages": [
{
"role": "user",
"content": "What's the weather like in Boston today?"
}
]
}'

调试

'model_name' 未找到

检查模型别名是否存在于团队表中。

curl -L -X GET 'http://localhost:4000/team/info?team_id=e59e2671-a064-436a-a0fa-16ae96e5a0a1' \
-H 'Authorization: Bearer sk-******2ql3-sm28WU0tTAmA' \

预期响应

{
{
"team_id": "e59e2671-a064-436a-a0fa-16ae96e5a0a1",
"team_info": {
...,
"litellm_model_table": {
"model_aliases": {
"my-team-model": # 👈 public model name "model_name_e59e2671-a064-436a-a0fa-16ae96e5a0a1_e81c9286-2195-4bd9-81e1-cf393788a1a0" 👈 internally generated model name (used to ensure uniqueness)
},
"created_by": "default_user_id",
"updated_by": "default_user_id"
}
},
}