Skip to main content

AI Proxy

企業在導入 LLM 時,可能會用到多種不同的模型,這些包含商用授權與開源授權以及來自不同的服務商。為了統一管理及開發應用這些各類不同模型,建議使用 AI Proxy (AI API Gateway) 這類平台來解決,以達到下列目的:

  • 統一 API 介接入口與格式
  • 成本追蹤
  • 平衡負載

LiteLLM

CLI Proxy API

Installation
mkdir cli-proxy-api-plus
cd cli-proxy-api-plus

curl -o config.yaml https://raw.githubusercontent.com/router-for-me/CLIProxyAPIPlus/main/config.example.yaml

mv config.example.yaml config.yaml

Edit: config.yaml 

    控制台登入時需要輸入 YOU-MANAGEMENT-KEY。 NOTE: 服務啟動後,YOU-MANAGEMENT-KEY 會轉換成雜湊值(Hash),所以需手動記下。
    remote-management:
      allow-remote: true
      secret-key: YOUR-MANAGEMENT-KEY

    Edit: docker-compose.yaml 

    services:
      cli-proxy-api:
        image: ${CLI_PROXY_IMAGE:-eceasy/cli-proxy-api-plus:latest}
        container_name: cli-proxy-api-plus 
        ports:
          - "8317:8317" 
        volumes:
          - ${CLI_PROXY_CONFIG_PATH:-./config.yaml}:/CLIProxyAPI/config.yaml
          - ${CLI_PROXY_AUTH_PATH:-./auths}:/root/.cli-proxy-api
          - ${CLI_PROXY_LOG_PATH:-./logs}:/CLIProxyAPI/logs
        environment:
          - TZ=Asia/Taipei
        restart: unless-stopped
    

    Start the service

    docker compose up -d

    Management UI: http://your.server.ip:8317/management.html  

    Sub2API