octopus

bestruiruiAGPL-3.0活跃维护

把 Claude、Codex 等多家 LLM 的 API 统一成一个入口的聚合网关,方便个人集中管理和切换不同模型服务。

One Hub All LLMs For You | 为个人打造的 LLM API 聚合网关

v0.13.13发布于 2026-10-23 01:03 UTC2,746star +4 / 7 天449fork同步于 2026-11-11 05:40 UTC

怎么上手

由 README 提炼,执行前请确认
docker run -d --name octopus -v /path/to/data:/app/data -p 8080:8080 bestrui/octopus
硬件要求按 README 说明

README 未说明硬件要求;以单二进制或 Docker 方式运行,未提及 GPU 或显存需求。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

个人用的 LLM API 聚合网关,把多家模型渠道统一成一个接口

把 Claude、Codex 等多家 LLM 的 API 统一成一个入口的聚合网关,方便个人集中管理和切换不同模型服务。

核心能力

  • 聚合多个 LLM 供应商渠道并统一管理
  • 在 OpenAI Chat、OpenAI Responses、Anthropic 格式间转换协议
  • 上游渠道失败时自动切换到可用渠道
  • 拦截上游错误,保证 agent 任务不中断
  • 自动同步模型列表与 models.dev 价格数据

容易踩的坑

首次启动后默认账号密码均为 admin,需立即修改;MySQL 和 PostgreSQL 需手动建库,程序只自动建表;退出时用 Ctrl+C 或 SIGTERM,kill -9 会丢失内存中未落库的统计数据;从源码构建时须先构建前端,否则内嵌资源缺失。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.13.13
  1. v0.13.13最新正式版2026-10-23 · 2026-10-23 01:03 UTC

       🚀 Features

    • 🚨 CVE-2026-111943  -  by @bestruirui (8aa58)
        View changes on GitHub
  2. v0.13.122026-10-14 · 2026-10-14 03:33 UTC
    查看更新说明

       🐞 Bug Fixes

    • 🐛 请求头UA透传  -  by @bestruirui (baa5d)
        View changes on GitHub
  3. v0.13.112026-10-13 · 2026-10-13 07:25 UTC
    查看更新说明

       🚀 Features

    • ✨ 流式响应更严格的检查  -  by @bestruirui (fd8b3)
        View changes on GitHub
  4. v0.13.102026-10-07 · 2026-10-07 08:50 UTC
    查看更新说明

       🚀 Features

    • ✨ 子路径用于反向代理场景  -  by @bestruirui (bdc99)
    • ✨ 分组编辑新增置顶置底  -  by @bestruirui (0538c)
    • ✨ 新增更改密码命令  -  by @bestruirui (8cf04)

       🐞 Bug Fixes

    • 🐛 数据库迁移  -  by @bestruirui (1cdb1)
        View changes on GitHub
  5. v0.13.92026-09-30 · 2026-09-30 03:12 UTC
    查看更新说明

       🚀 Features

    • ✨ 增加更多模板预设  -  by @bestruirui (35778)
    • ✨ 日志展示使用的渠道的key  -  by @bestruirui (8e93f)
        View changes on GitHub

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Octopus

    A Simple, Beautiful, and Elegant LLM API Aggregation Service for Individuals

    English | 简体中文

    ✨ Features

    • 🔀 Multi-Channel Aggregation - Connect multiple LLM provider channels with unified management
    • 🔄 Protocol Conversion - Seamless conversion between OpenAI Chat / OpenAI Responses / Anthropic API formats
    • 💰 Price Sync - Automatic model pricing updates
    • 🔃 Model Sync - Automatic synchronization of available model lists with channels
    • 🛡️ Automatic Failover - Automatically switches to an available channel when an upstream channel fails
    • 🔍 Real-Time End-to-End Request Visualization - Watch the complete request path in the frontend from the moment the client sends it
    • 🚧 Upstream Error Shielding - Intercept all upstream errors to keep agent tasks running without interruption
    • 📊 Analytics - Comprehensive request statistics, token consumption, and cost tracking
    • 🎨 Elegant UI - Clean and beautiful web management panel
    • 📦 Lightweight Single-Binary Deployment - Run as a single binary with no external runtime dependencies
    • 🗄️ Multi-Database Support - Support for SQLite, MySQL, PostgreSQL

    🚀 Quick Start

    🐳 Docker

    Run directly:

    docker run -d --name octopus -v /path/to/data:/app/data -p 8080:8080 bestrui/octopus
    

    Or use docker compose:

    wget https://raw.githubusercontent.com/bestruirui/octopus/refs/heads/master/docker-compose.yml
    docker compose up -d
    

    📦 Download from Release

    Download the binary for your platform from Releases, then run:

    ./octopus start
    

    🛠️ Build from Source

    Requirements:

    • Go 1.24.4
    • Node.js 18+
    • pnpm
    # Clone the repository
    git clone https://github.com/bestruirui/octopus.git
    cd octopus
    # Build frontend
    cd web && pnpm install && pnpm run build
    # Start the backend service
    go run main.go start 
    

    💡 Tip: The frontend build artifacts are embedded into the Go binary, so you must build the frontend before starting the backend.

    Development Mode

    cd web && pnpm install && pnpm run dev
    ## Open a new terminal, start the backend service
    go run main.go start
    ## Access the frontend at
    http://localhost:5173
    

    🔐 Default Credentials

    After first launch, visit http://localhost:8080 and log in to the management panel with:

    • Username: admin
    • Password: admin

    ⚠️ Security Notice: Please change the default password immediately after first login.

    📝 Configuration File

    The configuration file is located at data/config.json by default and is automatically generated on first startup.

    Complete Configuration Example:

    {
      "server": {
        "host": "0.0.0.0",
        "port": 8080
      },
      "database": {
        "type": "sqlite",
        "path": "data/data.db"
      },
      "log": {
        "level": "info"
      }
    }
    

    Configuration Options:

    OptionDescriptionDefault
    server.hostListen address0.0.0.0
    server.portServer port8080
    database.typeDatabase typesqlite
    database.pathDatabase connection stringdata/data.db
    log.levelLog levelinfo

    Database Configuration:

    Three database types are supported:

    Typedatabase.typedatabase.path Format
    SQLitesqlitedata/data.db
    MySQLmysqluser:password@tcp(host:port)/dbname
    PostgreSQLpostgrespostgresql://user:password@host:port/dbname?sslmode=disable

    MySQL Configuration Example:

    {
      "database": {
        "type": "mysql",
        "path": "root:password@tcp(127.0.0.1:3306)/octopus"
      }
    }
    

    PostgreSQL Configuration Example:

    {
      "database": {
        "type": "postgres",
        "path": "postgresql://user:password@localhost:5432/octopus?sslmode=disable"
      }
    }
    

    💡 Tip: MySQL and PostgreSQL require manual database creation. The application will automatically create the table structure.

    🌐 Environment Variables

    All configuration options can be overridden via environment variables using the format OCTOPUS_ + configuration path (joined with _):

    Environment VariableConfiguration Option
    OCTOPUS_SERVER_PORTserver.port
    OCTOPUS_SERVER_HOSTserver.host
    OCTOPUS_DATABASE_TYPEdatabase.type
    OCTOPUS_DATABASE_PATHdatabase.path
    OCTOPUS_LOG_LEVELlog.level
    OCTOPUS_GITHUB_PATFor rate limiting when getting the latest version (optional)

    📸 Screenshots

    🖥️ Desktop

    📱 Mobile

    📖 Documentation

    📡 Channel Management

    Channels are the basic configuration units for connecting to LLM providers.

    Base URL Guide:

    The program automatically appends the API version and endpoint path based on the channel type. You only need to provide the service root URL:

    Channel TypeAuto-appended PathBase URLFull Request URL Example
    OpenAI Chat/v1/chat/completionshttps://api.openai.comhttps://api.openai.com/v1/chat/completions
    OpenAI Responses/v1/responseshttps://api.openai.comhttps://api.openai.com/v1/responses
    Anthropic/v1/messageshttps://api.anthropic.comhttps://api.anthropic.com/v1/messages
    Gemini/v1beta/models/:model:generateContenthttps://generativelanguage.googleapis.comhttps://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent

    💡 Tip: The Base URL does not need to include /v1, /v1beta, or a specific API endpoint path - the program handles them automatically.


    📁 Group Management

    Groups aggregate multiple channels into a unified external model name.

    Core Concepts:

    • Group name is the model name exposed by the program
    • When calling the API, set the model parameter to the group name

    💡 Example: Create a group named gpt-4o, add multiple providers' GPT-4o channels to it, then access all channels via a unified model: gpt-4o.


    💰 Price Management

    Manage model pricing information in the system.

    Data Sources:

    • The system periodically syncs model pricing data from models.dev
    • When creating a channel, if the channel contains models not in models.dev, the system automatically creates pricing information for those models on this page, so this page displays models that haven't had their prices fetched from upstream, allowing users to set prices manually
    • Manual creation of models that exist in models.dev is also supported for custom pricing

    Price Priority:

    PrioritySourceDescription
    🥇 HighThis PagePrices set by user in price management page
    🥈 Lowmodels.devAuto-synced default prices

    💡 Tip: To override a model's default price, simply set a custom price for it in the price management page.


    ⚙️ Settings

    Global system configuration.

    Statistics Save Interval (minutes):

    Since the program handles numerous statistics, writing to the database on every request would impact read/write performance. The program uses this strategy:

    • Statistics are first stored in memory
    • Periodically batch-written to the database at the configured interval

    ⚠️ Important: When exiting the program, use proper shutdown methods (like Ctrl+C or sending SIGTERM signal) to ensure in-memory statistics are correctly written to the database. Do NOT use kill -9 or other forced termination methods, as this may result in statistics data loss.


    🔌 Client Integration

    OpenAI SDK

    from openai import OpenAI
    import os
    
    client = OpenAI(   
        base_url="http://127.0.0.1:8080/v1",   
        api_key="sk-octopus-P48ROljwJmWBYVARjwQM8Nkiezlg7WOrXXOWDYY8TI5p9Mzg", 
    )
    completion = client.chat.completions.create(
        model="octopus-openai",  # Use the correct group name
        messages = [
            {"role": "user", "content": "Hello"},
        ],
    )
    print(completion.choices[0].message.content)
    

    Claude Code

    Edit ~/.claude/settings.json

    {
      "env": {
        "ANTHROPIC_BASE_URL": "http://127.0.0.1:8080",
        "ANTHROPIC_AUTH_TOKEN": "sk-octopus-P48ROljwJmWBYVARjwQM8Nkiezlg7WOrXXOWDYY8TI5p9Mzg",
        "API_TIMEOUT_MS": "3000000",
        "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
        "ANTHROPIC_MODEL": "octopus-sonnet-4-5",
        "ANTHROPIC_SMALL_FAST_MODEL": "octopus-haiku-4-5",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "octopus-sonnet-4-5",
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "octopus-sonnet-4-5",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "octopus-haiku-4-5"
      }
    }
    

    Codex

    Edit ~/.codex/config.toml

    model = "gpt-5.6-sol"
    model_reasoning_effort = "xhigh"
    model_provider = "octopus"
    preferred_auth_method = "apikey"
    
    [model_providers.octopus]
    base_url = "http://127.0.0.1:8080/v1"
    name = "octopus"
    supports_websockets = false
    requires_openai_auth = true
    wire_api = "responses"
    experimental_bearer_token = "sk-octopus-"
    

    Edit ~/.codex/auth.json

    {
      "OPENAI_API_KEY": ""
    }
    

    🤝 Acknowledgments

    • 🙏 looplj/axonhub - The LLM API adaptation module in this project is directly derived from this repository
    • 📊 sst/models.dev - AI model database providing model pricing data
    • 🇨🇳 AtomGit - China-based code hosting
    • 💬 Linux.do