[DEPRECATED] 팀 기반 라우팅
[DEPRECATED] 팀 기반 라우팅 (Team-based Routing)
참고: 이 기능은 더 이상 사용되지 않아요(deprecated). 대신 태그 기반 라우팅 (Tag Based Routing)을 사용해 주세요.
출처: 문서
본문
라우팅 (Routing)
team-id를 기준으로 서로 다른 모델 그룹에 호출을 라우팅할 수 있어요.
모델 그룹이 있는 설정 (Config with model group)
2개의 모델 그룹 + 연결된 Postgres DB가 있는 config.yaml을 만들어요.
model_list:
- model_name: gpt-4o-mini-eu # 👈 Model Group 1
litellm_params:
model: azure/chatgpt-v-2
api_base: os.environ/AZURE_API_BASE_EU
api_key: os.environ/AZURE_API_KEY_EU
api_version: "2023-07-01-preview"
- model_name: gpt-4o-mini-worldwide # 👈 Model Group 2
litellm_params:
model: azure/chatgpt-v-2
api_base: os.environ/AZURE_API_BASE
api_key: os.environ/AZURE_API_KEY
api_version: "2023-07-01-preview"
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
database_url: "postgresql://..." # 👈 Connect proxy to DB
프록시를 시작해요.
litellm --config /path/to/config.yaml
모델 별칭(alias)이 있는 팀 만들기
# Authorization: *** Master Key
curl --location 'http://0.0.0.0:4000/team/new' \
--header "Authorization: Bearer ***" \
--header 'Content-Type: application/json' \
--data '{
"team_alias": "my-new-team_4",
"model_aliases": {"gpt-5.6-luna": "gpt-4o-mini-eu"}
}'
# Returns team_id: my-team-id
팀 키 만들기
curl --location 'http://localhost:4000/key/generate' \
--header "Authorization: Bearer ***" \
--header 'Content-Type: application/json' \
--data '{
"team_id": "my-team-id", # 👈 YOUR TEAM ID
}'
별칭으로 모델 호출하기
curl --location 'http://0.0.0.0:4000/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ***' \
--data '{
"model": "gpt-5.6-luna", # 👈 MODEL
"messages": [{"role": "system", "content": "You're an expert at writing poems"}, {"role": "user", "content": "Write me a poem"}, {"role": "user", "content": "What's your name?"}],
"user": "usha"
}'