octopus

作者 bestruirui已验证

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

2,483
Stars
394
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/bestruirui/octopus

快速入门

使用 octopus 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Octopus Logo

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

DashboardChannel ManagementGroup Management
DashboardChannelGroup
Price ManagementLogsSettings
Price ManagementLogsSettings

📱 Mobile

HomeChannelGroupPriceLogsSettings
Mobile HomeMobile ChannelMobile GroupMobile PriceMobile LogsMobile Settings

📖 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

常见问题

What is octopus?

octopus is an open-source api integration skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by bestruirui. One Hub All LLMs For You | 为个人打造的 LLM API 聚合网关. It has 2,483 GitHub stars.

Is octopus safe to use?

Yes. octopus passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install octopus?

Clone the repository with "git clone https://github.com/bestruirui/octopus" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is octopus written in?

octopus is primarily written in TypeScript. It is open-source under bestruirui on GitHub, so you can review or fork the full source.

Are there alternatives to octopus?

Yes. SkillsLLM lists many other API Integration skills you can browse and compare side by side. Open the API Integration category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh octopus against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

CLIProxyAPI

by router-for-me

Wrap Antigravity, ChatGPT Codex, Claude Code, Grok Build as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini 3.1 Pro, GPT 5.6 Series, Grok 4.5, Claude model through API

48,3767,452Go
API Integration
查看详情

sub2api

by Wei-Shaw

Sub2API 一站式开源中转服务,让 Claude、Openai 、Gemini、Grok订阅统一接入,支持拼车共享,更高效分摊成本,原生工具无缝使用。

38,8308,041Go
API Integration
查看详情

claude-code-hub

by ding113

一个现代化的 Claude Code & Codex API 代理服务,提供智能负载均衡、用户管理和使用统计功能。

3,328387TypeScript
API Integration
查看详情

cc-gateway

by motiful

AI API identity gateway — reverse proxy that normalizes device fingerprints and telemetry for privacy-preserving API proxying

3,013501TypeScript
API Integration
查看详情

MIXAPI

by aiprodcoder

大模型API网关-全新AI大模型接口管理与API聚合分发系统 , 支持将多种大模型转换成统一的OpenAI兼容接口,Claude接口,Gemini接口,可供个人或者企业内部大模型API 统一管理和渠道分发使用(key管理与二次分发),支持国际国内所有主流大模型,gemini,claude,qwen3,kimi-k2,豆包等,提供单可执行文件, docker镜像,一键部署,开箱即用,完全开源,自主可控!本项目基于New-API和One-API,整合了NewAPI,OneAPI所有功能及众多第三方插件为一身,功能超强!

904270Go
API Integration
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情