ubuntu24.04 LiteLLM的安装配置

1、安装docker

2、  docker-compose.yml

services:
  litellm:
    image: docker.litellm.ai/berriai/litellm:main-stable
    volumes:
      - ./config.yaml:/app/config.yaml
    ports:
      - "4000:4000"
    command:
      - "--config=/app/config.yaml"
      - "--port=4000"
    extra_hosts:
      - "host.docker.internal:host-gateway"

3、config.yaml

model_list:
  - model_name: qwen3.5:35b-a3b-bf16
    litellm_params:
      model: ollama/qwen3.5:35b-a3b-bf16
      api_base: http://172.24.193.66:11434 
  - model_name: qwen3-coder-next:q8_0
    litellm_params:
      model: ollama/qwen3-coder-next:q8_0
      api_base: http://172.24.193.67:11434 
  - model_name: nemotron-cascade-2
    litellm_params:
      model: ollama/nemotron-cascade-2
      api_base: http://172.24.193.68:11434

# 设置访问密钥
general_settings:
  master_key: sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

4、测试

curl -X POST http://localhost:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ 
-d '{"model":"ollama/qwen3.5:35b-a3b-bf16","messages":[{"role":"user","content":"你好"}]}'

 

posted @ 2026-03-28 13:17  河在谈  阅读(103)  评论(0)    收藏  举报