claudeers.

🔓 unclaimed — this page was auto-generated from GitHub. Are you the creator?

Claim this page →
// Data & Analytics

octopus

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

// Data & Analytics[ cli ][ api ][ desktop ][ web ][ mobile ][ claude ]#claude#ai#ai-gateway#anthropic#claude-code#codex#llm-gateway#openai#dataAGPL-3.0$open-sourceupdated 15 days ago
Actively maintained
97/100
last commit about 1 month ago
last release about 2 months ago
releases 73
open issues 56
// install
git clone https://github.com/bestruirui/octopus
Octopus Logo

Octopus

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

English | 简体中文

✨ Features

  • 🔀 Multi-Channel Aggregation - Connect multiple LLM provider channels with unified management
  • 🔑 Multi-Key Support - Support multiple API keys for a single channel
  • Smart Selection - Multiple endpoints per channel, smart selection of the endpoint with the shortest delay
  • ⚖️ Load Balancing - Automatic request distribution for stable and efficient service
  • 🔄 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
  • 📊 Analytics - Comprehensive request statistics, token consumption, and cost tracking
  • 🎨 Elegant UI - Clean and beautiful web management panel
  • 🗄️ 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/dev/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 && cd ..
# Move frontend assets to static directory
mv web/out static/
# 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 && NEXT_PUBLIC_API_BASE_URL="http://127.0.0.1:8080" pnpm run dev
## Open a new terminal, start the backend service
go run main.go start
## Access the frontend at
http://localhost:3000

🔐 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)
OCTOPUS_RELAY_MAX_SSE_EVENT_SIZEMaximum SSE event size (optional)
OCTOPUS_IMAGES_BODY_MEMORY_THRESHOLD_MBImages request body in-memory threshold. If exceeded, it will be spooled to a temporary file (optional, default 16)
OCTOPUS_IMAGES_BODY_MAX_MBImages request body maximum size. Requests above this limit are rejected (optional, default 256)
OCTOPUS_IMAGES_BODY_TMP_DIRImages request body temporary directory (optional, default ./cache)
OCTOPUS_IMAGES_BODY_TMP_CLEANUP_HOURSStartup cleanup threshold for temporary files (optional, default 24)

📸 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 API paths based on channel type. You only need to provide the base URL:

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

💡 Tip: No need to include specific API endpoint paths in the Base URL - the program handles this 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

Load Balancing Modes:

ModeDescription
🔄 Round RobinCycles through channels sequentially for each request
🎲 RandomRandomly selects an available channel for each request
🛡️ FailoverPrioritizes high-priority channels, switches to lower priority only on failure
⚖️ WeightedDistributes requests based on configured channel weights

💡 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 = "octopus-codex" # Use the correct group name

model_provider = "octopus"

[model_providers.octopus]
name = "octopus"
base_url = "http://127.0.0.1:8080/v1"

Edit ~/.codex/auth.json

{
  "OPENAI_API_KEY": "sk-octopus-P48ROljwJmWBYVARjwQM8Nkiezlg7WOrXXOWDYY8TI5p9Mzg"
}

🤝 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

// compatibility

Platformscli, api, desktop, web, mobile
Operating systems
AI compatibilityclaude
LicenseAGPL-3.0
Pricingopen-source
LanguageTypeScript

// faq

What is octopus?

One Hub All LLMs For You | 为个人打造的 LLM API 聚合网关. It is open-source on GitHub.

Is octopus free to use?

octopus is open-source under the AGPL-3.0 license, so it is free to use.

What category does octopus belong to?

octopus is listed under devtools in the Claudeers registry of Claude-compatible tools.

0 views
2,278 stars
unclaimed
updated 15 days ago

// embed badge

octopus on Claudeers
[![Claudeers](https://claudeers.com/api/badge/octopus.svg)](https://claudeers.com/octopus)

// retro hit counter

octopus hit counter
[![Hits](https://claudeers.com/api/counter/octopus.svg)](https://claudeers.com/octopus)

// reviews

// guestbook

0/500

// related in Data & Analytics

🔓

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

// dataapache/Python46,041Apache-2.0[ claude ]
🔓

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 P…

// datarouter-for-me/Go39,089MIT[ claude ]
🔓

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

// datacoreyhaines31/JavaScript36,446MIT[ claude ]
🔓

CLI tool for configuring and monitoring Claude Code

// datadavila7/Python28,435MIT[ claude ]

// built by

Connectorlinks several projects together across the ecosystem · 5 connections
→ see how octopus connects across the ecosystem