RI

recally-io/polyllm

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

29 stars 9 forks 质量 57 趋势 11MIT

LLM 网关用于调用支持 MCP 的 OpenAI 格式的 100+ LLM API。

概览

PolyLLM 是一个统一的 Go 接口,适用于多个大型语言模型(LLM)提供者。它允许您通过一个统一的接口与各种 LLM API 交互,方便在不同提供者之间切换或在同一应用中使用多个提供者。 - : 通过统一的 API 与多个 LLM 提供者交互 - : 无需更改代码即可轻松切换提供者 - : 通过 Go API、CLI 工具或 HTTP 服务器访问 LLM - : 内置支持 Model Context 协议 - : 基于 JSON 的提供者配置和 MCP 工具 PolyLLM 目前支持以下大型语言模型提供商: - OpenAI - DeepSeek - Qwen(阿里巴巴云)- Gemini(谷歌)- OpenRouter - Volcengine - Groq - Xai - Siliconflow 可以很容易地添加额外的服务提供者。 PolyLLM 支持通过 JSON 文件进行配置。这允许你定义 LLM 提供者和 MCP 工具。 模型上下文协议(MCP)工具可以在配置文件的mcps部分下定义。

概述(AI 翻译)

PolyLLM 是一个统一的 Go 接口,适用于多个大型语言模型(LLM)提供者。它允许您通过一个统一的接口与各种 LLM API 交互,方便在不同提供者之间切换或在同一应用中使用多个提供者。

目录

  • PolyLLM
    • 目录
    • 特色
    • 支持的提供者
    • 安装
  • 图书馆
  • CLI 工具
  • HTTP 服务器
    • 配置
  • JSON 配置文件
  • MCP 配置
    • 使用情况
  • API 使用
  • 基本示例
  • 使用配置文件
  • 聊天完成示例
  • 使用 MCP
  • CLI 使用
  • 安装
  • 示例
  • HTTP 服务器
  • 安装
  • 启动服务器
  • API 端点
  • 示例请求
    • 许可证

特色

  • 单一接口:通过统一的API与多个LLM提供者交互
  • 提供者无关性:无需更改代码即可轻松切换供应商
  • 多接口:通过Go API、CLI工具或HTTP服务器访问LLMs
  • MCP 支持:内置支持 Model Context 协议
  • 配置文件:基于JSON的提供者配置和MCP工具

支持的提供者

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

PolyLLM

PolyLLM is a unified Go interface for multiple Large Language Model (LLM) providers. It allows you to interact with various LLM APIs through a single, consistent interface, making it easy to switch between different providers or use multiple providers in the same application.

Table of Contents

Features

  • Single Interface: Interact with multiple LLM providers through a unified API
  • Provider Agnostic: Easily switch between providers without changing your code
  • Multiple Interfaces: Access LLMs through a Go API, CLI tool, or HTTP server
  • MCP Support: Builtin support for Model Context Protocol
  • Configuration File: JSON-based configuration for providers and MCP tools

Supported Providers

PolyLLM currently supports the following LLM providers:

  • OpenAI
  • DeepSeek
  • Qwen (Alibaba Cloud)
  • Gemini (Google)
  • OpenRouter
  • Volcengine
  • Groq
  • Xai
  • Siliconflow

Additional providers can be easily added.

Installation

Library

go get github.com/recally-io/polyllm

CLI Tool

go install github.com/recally-io/polyllm/cmd/polyllm-cli@latest

# use docker 
docker pull ghcr.io/recally-io/polyllm-cli:latest

HTTP Server

go install github.com/recally-io/polyllm/cmd/polyllm-server@latest

# use docker 
docker pull ghcr.io/recally-io/polyllm-server:latest

Configuration

JSON Configuration File

PolyLLM supports configuration via a JSON file. This allows you to define LLM providers and MCP tools.

Example configuration file:

{
  "llms": [
    {
      "name": "gemini",
      "type": "gemini",
在 GitHub 查看完整 README

安装

uvx mcp-server-fetch
新手?先看 mcpskill.org 教程 →