Bài 0225 phút đọcTrung cap
8. LiteLLM — Proxy quản lý các model AI
Dùng LiteLLM làm lớp proxy trung tâm, thống nhất API call đến tất cả các model từ mọi provider.
# Cau hinh LiteLLM voi multi-model
model_list:
- model_name: opus
litellm_params:
model: claude-opus-5
api_key: $ANTHROPIC_API_KEY
- model_name: mini
litellm_params:
model: gpt-4o-mini
api_key: $OPENAI_API_KEY
- model_name: local
litellm_params:
model: openai/local-model
api_base: http://localhost:8080/v1
Thực hành
Đến lượt bạn xây dựng
Cài LiteLLM với ít nhất 3 model (Anthropic, OpenAI, và local llama.cpp). Proxy ề Hermes Agent.ăc lại quá tình routing trong dashboard.