forked from ZhuLinsen/daily_stock_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlitellm_config.example.yaml
More file actions
93 lines (82 loc) · 3.39 KB
/
litellm_config.example.yaml
File metadata and controls
93 lines (82 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# ===================================
# LiteLLM Router 配置模板
# ===================================
# 配套文档:docs/LLM_CONFIG_GUIDE.md 第 3.2 节
#
# 用法:
# 1. 复制此文件为 litellm_config.yaml
# 2. 在 .env 中设置 LITELLM_CONFIG=./litellm_config.yaml
# 3. 按需配置下面的 model_list
#
# 密钥引用格式:
# api_key: "os.environ/ENV_VAR_NAME" → 从环境变量读取,避免明文写入文件
# api_key: "sk-xxxxxxxx" → 直接写入(不推荐)
#
# 更多文档: https://docs.litellm.ai/docs/proxy/configs
# ===================================
model_list:
# --- siliconflow (OpenAI 兼容,一个 Key 使用多种模型) ---
# 这是一个关于如何配置在LiteLLM自定义OpenAI兼容API接口的示例
- model_name: openai/Qwen/Qwen3.5-397B-A17B
litellm_params:
model: openai/Qwen/Qwen3.5-397B-A17B
api_key: "os.environ/LITELLM_API_KEY" # 从环境变量读取 Key,安全防泄漏
api_base: https://api.siliconflow.cn/v1
# 以下配置是表示如何启用Qwen模型的enable_thinking开关
extra_body:
chat_template_kwargs:
enable_thinking: true
# --- AIHubmix (OpenAI 兼容,一个 Key 使用多种模型) ---
- model_name: openai/gpt-4o-mini
litellm_params:
model: openai/gpt-4o-mini
api_key: "os.environ/AIHUBMIX_KEY"
api_base: https://aihubmix.com/v1
- model_name: openai/claude-3-5-sonnet-20241022
litellm_params:
model: openai/claude-3-5-sonnet-20241022
api_key: "os.environ/AIHUBMIX_KEY"
api_base: https://aihubmix.com/v1
# --- DeepSeek 官方 API (原生 provider,自动解析 base_url) ---
- model_name: deepseek/deepseek-chat
litellm_params:
model: deepseek/deepseek-chat
api_key: "os.environ/DEEPSEEK_API_KEY"
- model_name: deepseek/deepseek-reasoner
litellm_params:
model: deepseek/deepseek-reasoner
api_key: "os.environ/DEEPSEEK_API_KEY"
# --- Google Gemini (原生,多 Key 负载均衡) ---
- model_name: gemini/gemini-2.5-flash
litellm_params:
model: gemini/gemini-2.5-flash
api_key: "os.environ/GEMINI_API_KEY_1"
- model_name: gemini/gemini-2.5-flash
litellm_params:
model: gemini/gemini-2.5-flash
api_key: "os.environ/GEMINI_API_KEY_2"
# --- Anthropic Claude (原生) ---
# - model_name: anthropic/claude-3-5-sonnet-20241022
# litellm_params:
# model: anthropic/claude-3-5-sonnet-20241022
# api_key: "os.environ/ANTHROPIC_API_KEY"
# --- OpenRouter (聚合平台) ---
# - model_name: openai/meta-llama/llama-3-70b-instruct
# litellm_params:
# model: openai/meta-llama/llama-3-70b-instruct
# api_key: "os.environ/OPENROUTER_API_KEY"
# api_base: https://openrouter.ai/api/v1
# --- Ollama 本地模型 ---
# - model_name: ollama/qwen3:8b
# litellm_params:
# model: ollama/qwen3:8b
# api_base: http://localhost:11434
# ===================================
# Router 设置(可选)
# ===================================
router_settings:
routing_strategy: simple-shuffle # simple-shuffle / least-busy / latency-based
num_retries: 2 # 单个 deployment 失败后重试次数
# timeout: 30 # 请求超时(秒)
# allowed_fails: 3 # deployment 被冷却前允许的失败次数
# cooldown_time: 60 # deployment 冷却时间(秒)