feat: add Sub2API application for AI API gateway platform

- Add Sub2API 1Panel application configuration
- Support subscription quota distribution, API Key management, billing and load balancing
- Include docker-compose.yml, data.yml, README documentation and logo
- Support amd64 and arm64 architectures
This commit is contained in:
arch3rPro
2026-03-24 19:00:29 +08:00
parent e1104e4dcf
commit 69ad9e1a76
9 changed files with 280 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
server:
host: "0.0.0.0"
port: 8080
mode: "release"
database:
host: "postgres"
port: 5432
user: "sub2api"
password: "${POSTGRES_PASSWORD}"
dbname: "sub2api"
redis:
host: "redis"
port: 6379
password: ""
jwt:
secret: "sub2api_jwt_secret_change_in_production_32chars"
expire_hour: 24

View File

@@ -0,0 +1,33 @@
additionalProperties:
formFields:
- default: 8080
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: Web Port
labelZh: Web 端口
required: true
rule: paramPort
type: number
- default: Asia/Shanghai
edit: true
envKey: TZ
labelEn: Time Zone
labelZh: 时区
required: true
type: text
- default: sub2api_secure_jwt_secret_change_in_production
edit: true
envKey: JWT_SECRET
labelEn: JWT Secret
labelZh: JWT 密钥
required: true
rule: paramCommon
type: password
- default: sub2api_secure_db_password_change_in_production
edit: true
envKey: POSTGRES_PASSWORD
labelEn: PostgreSQL Password
labelZh: PostgreSQL 密码
required: true
rule: paramCommon
type: password

View File

View File

@@ -0,0 +1,26 @@
server:
host: "0.0.0.0"
port: 8080
mode: "release"
database:
host: "postgres"
port: 5432
user: "sub2api"
password: "${POSTGRES_PASSWORD}"
dbname: "sub2api"
redis:
host: "redis"
port: 6379
password: ""
jwt:
secret: "${JWT_SECRET}"
expire_hour: 24
default:
user_concurrency: 5
user_balance: 0
api_key_prefix: "sk-"
rate_multiplier: 1.0

View File

@@ -0,0 +1,57 @@
services:
sub2api:
image: weishaw/sub2api:latest
container_name: ${CONTAINER_NAME}
restart: always
networks:
- 1panel-network
ports:
- "${PANEL_APP_PORT_HTTP}:8080"
volumes:
- ./data:/app/data
- ./config.yaml:/app/config.yaml:ro
environment:
- TZ=${TZ}
- POSTGRES_CONN_STRING=postgres://sub2api:${POSTGRES_PASSWORD}@postgres:5432/sub2api?sslmode=disable
- REDIS_CONN_STRING=redis://redis:6379/0
- JWT_SECRET=${JWT_SECRET}
labels:
createdBy: "Apps"
depends_on:
- postgres
- redis
postgres:
image: postgres:15-alpine
container_name: ${CONTAINER_NAME}-postgres
restart: always
networks:
- 1panel-network
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=sub2api
- POSTGRES_USER=sub2api
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
labels:
createdBy: "Apps"
redis:
image: redis:7-alpine
container_name: ${CONTAINER_NAME}-redis
restart: always
networks:
- 1panel-network
volumes:
- redis_data:/data
command: redis-server --appendonly yes
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true
volumes:
postgres_data:
redis_data: