فهرست منبع

feat: litellm

biheng 2 ماه پیش
والد
کامیت
345d03b6c2
5فایلهای تغییر یافته به همراه42 افزوده شده و 0 حذف شده
  1. 5 0
      docker/litellm/.env.sample
  2. 4 0
      docker/litellm/Dockerfile
  3. 7 0
      docker/litellm/README.md
  4. 15 0
      docker/litellm/docker-compose.yaml
  5. 11 0
      docker/litellm/litellm_config.yaml

+ 5 - 0
docker/litellm/.env.sample

@@ -0,0 +1,5 @@
+# http代理设置,用于解除部分模型的地域限制。支持socks5代理
+HTTPS_PROXY=socks5://xxx.xxx.xxx.xxx:1080
+
+# 各种api_key,compose和config里需要对应
+GEMINI_API_KEY=xxxxxx

+ 4 - 0
docker/litellm/Dockerfile

@@ -0,0 +1,4 @@
+FROM ghcr.io/berriai/litellm:main-latest
+
+RUN pip install httpx[socks]
+

+ 7 - 0
docker/litellm/README.md

@@ -0,0 +1,7 @@
+# litellm
+
+支持http代理的litellm的docker compose部署。
+
+目前里面已有gemini配置,直接把`.env.sample`拷贝成`.env`,并填入相应的`HTTPS_PROXY`和`GEMINI_API_KEY`。
+
+如果需要添加其他模型,参照[官方文档](https://docs.litellm.ai/docs/providers)修改`litellm_config.yaml`配置文件,在`docker-compose.yaml`里添加相应的api-key配置,然后把key写在`.env`里。

+ 15 - 0
docker/litellm/docker-compose.yaml

@@ -0,0 +1,15 @@
+services:
+  litellm:
+    build: .
+    command: --config /app/config.yaml --detailed_debug
+    ports:
+      - 4000:4000
+    restart: unless-stopped
+    environment:
+      - GEMINI_API_KEY
+      - HTTPS_PROXY
+    volumes:
+      - ./litellm_config.yaml:/app/config.yaml
+    # networks:
+    #   - ssrf_proxy_network
+    #   - default

+ 11 - 0
docker/litellm/litellm_config.yaml

@@ -0,0 +1,11 @@
+model_list:
+  - model_name: gemini-2.0-flash
+    litellm_params:
+      model: gemini/gemini-2.0-flash
+      # api_base: https://openai-gpt-4-test-v-1.openai.azure.com/
+      api_key: os.environ/GEMINI_API_KEY
+  # - model_name: gpt-4
+  #   litellm_params:
+  #     model: azure/gpt-4
+  #     api_key: 
+  #     api_base: https://openai-gpt-4-test-v-2.openai.azure.com/