wenyi401/ikik-api
Über uns
基于 Sub2API 二开的 AI API 网关与订阅管理平台,包含共享私有账号池、拼车池、免费模型清单、让Claude、Openai、Gemini、Grok、Kiro 订阅统一接入,原生工具无缝使用。
KI und maschinelles LernenWhat you can do
- OpenAI-compatible gateway endpoints for chat, responses, models, embeddings, image, and streaming workloads.
- Grok OAuth, Kiro OAuth, free-model provider onboarding, and configurable private-account access flows.
- Multi-provider routing for OpenAI-compatible channels and account-based upstreams.
- Account pool management with public, private, owned, and carpool-style scheduling concepts.
Gemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Originalikik-api
ikik-api is a self-hosted AI API gateway and subscription management platform based on Sub2API. It provides account pooling, API key management, multi-provider request forwarding, usage accounting, subscription billing, moderation controls, and admin operations for AI API services.
Website: https://ikik.net
QQ group: 146499741
This repository is intended for private deployment, customization, and secondary development. It does not include production secrets, private server configuration, hosted-service credentials, or commercial operation data.
Important Notice
Please read the following carefully before deploying or operating this project:
- Terms of service risk: routing requests through subscription or account-based upstreams may violate the terms of service of some upstream providers. Review the relevant provider agreements before use.
- Compliance: use this project only in compliance with the laws and regulations of your country or region.
- Account risk: account bans, quota resets, service interruptions, upstream policy changes, and billing errors are operational risks that must be handled by the deployer.
- Disclaimer: this project is provided for technical learning, self-hosting, and secondary development. You are responsible for your own deployment, data, users, payments, and upstream accounts.
Features
- OpenAI-compatible gateway endpoints for chat, responses, models, embeddings, image, and streaming workloads.
- Grok OAuth, Kiro OAuth, free-model provider onboarding, and configurable private-account access flows.
- Multi-provider routing for OpenAI-compatible channels and account-based upstreams.
- Account pool management with public, private, owned, and carpool-style scheduling concepts.
- API key management with multi-group routing, IP access controls, quota controls, usage records, and billing metadata.
- User subscriptions, recharge flows, redeem codes, invitation rewards, and shop/card-key workflows.
- Admin dashboard for users, accounts, channels, payments, moderation, risk events, data management, and system settings.
- Content moderation and risk-control integration points for request/response auditing.
- Built-in release workflow for tagged builds, Docker images, archives, and GitHub Releases.
- Frontend console built with Vue 3, TypeScript, Pinia, Vue Router, Tailwind CSS, and Vite.
- Backend service built with Go, Gin, Ent, PostgreSQL, Redis, and modular service boundaries.
Version 1.0.4 Updates
- Merged upstream sub2api v0.2.4 (519 commits / 876 files) and unified the frontend and backend versions at 1.0.4.
- Added OpenCode platform support: account modes, model grouping and usage-window integration, using the official CLI TLS fingerprint by default.
- Repaired upstream capabilities that the merge had dropped: custom EasyPay methods were hidden from the cashier, Tencent/Aliyun captcha users could not send verification codes or submit, Ollama usage and quota-reset results never reached the account row, model statistics were blanked during a refresh, and invalid JSON imports did not name the failing file.
- Restored admin settings such as the compact home toggle, default platform quota matrix, admin recharge rebate switch and Claude OAuth system prompt injection.
- The full frontend suite shows zero new failures against the pre-merge baseline; the Go backend build matches its existing test baseline.
Version 1.0.3 Updates
- Upgraded the backend toolchain to Go 1.26.5 and refreshed vulnerable AWS SDK dependencies used by storage integrations.
- Added Grok OAuth integration, Kiro OAuth integration, K12 account-level support, and video-related gateway endpoint coverage.
- Added free-model provider onboarding, multi-group API key routing, and API Key IP access-control support.
- Improved carpool pool, private account, subscription, billing, reasoning-token, and usage-stat workflows.
- Updated CI, security scanning, and frontend audit handling for the current dependency set.
Tech Stack
- Backend: Go 1.26.5, Gin, Ent, PostgreSQL, Redis
- Frontend: Vue 3, TypeScript, Vite, Pinia, Tailwind CSS
- Testing: Go test, Vitest, vue-tsc, ESLint
- Deployment: Docker or source build, with external PostgreSQL and Redis recommended
Repository Layout
.
├── backend/ # Go backend, migrations, services, handlers, repositories
├── frontend/ # Vue 3 admin/user console
├── deploy/ # Deployment examples and configuration template
├── docs/ # Additional integration and operation documents
├── assets/ # Static project assets
├── Makefile # Common build and test entry points
└── Dockerfile # Production image build
Requirements
- Go 1.26.5
- Node.js 20+
- pnpm 9+
- PostgreSQL
- Redis
- Docker, optional but recommended for deployment
Configuration
Start from the example configuration:
cp deploy/config.example.yaml deploy/config.yaml
Edit the generated configuration for your environment:
server: host, port, frontend URL, request body limits, CORS, and security headers.database: PostgreSQL connection settings.redis: cache and queue backend settings.gateway: upstream timeout, body-size limits, routing, and model behavior.security: URL allowlist, response header filtering, proxy fallback, and CSP.- payment, email, storage, moderation, and OAuth sections as needed.
Never commit real production credentials. Local and deployment-specific config files are intentionally ignored by git.
Development
Install frontend dependencies:
pnpm --dir frontend install
Run the frontend dev server:
pnpm --dir frontend run dev
Run the backend from source:
cd backend
go run ./cmd/server
On first run, the backend may start the setup flow if no valid configuration or installation state is detected.
Build
Build backend and frontend:
make build
Build only the backend:
make build-backend
Build only the frontend:
make build-frontend
Build a Docker image:
docker build -t ikik-api:local .
Tests
Run all configured checks:
make test
Run backend tests:
cd backend
go test -tags=unit ./...
go test -tags=integration ./...
Run frontend checks:
pnpm --dir frontend run lint:check
pnpm --dir frontend run typecheck
pnpm --dir frontend run i18n:audit:strict
pnpm --dir frontend exec vitest run
Run golangci-lint with the repository configuration:
cd backend
golangci-lint run ./... --timeout=30m
If golangci-lint is not installed locally, use the same version as CI:
cd backend
go run github.com/golangci/golangci-lint/v2/cmd/[email protected] run ./... --timeout=30m
Deployment Notes
For production, run ikik-api behind a reverse proxy such as Nginx, Caddy, or a managed load balancer.
Nginx Reverse Proxy Note
When using Nginx with account scheduling, sticky sessions, Codex CLI, or clients that send headers containing underscores, enable underscore headers in the Nginx http block:
underscores_in_headers on;
Nginx drops headers containing underscores by default. That can break session routing and some native client compatibility paths.
Recommended production basics:
- Use PostgreSQL and Redis outside the application container.
- Mount a production config file instead of baking secrets into the image.
- Terminate TLS at the reverse proxy or load balancer.
- Keep
/api/*,/v1/*, streaming, and gateway routes out of CDN cache. - Configure request body limits consistently across the reverse proxy and backend.
- Back up PostgreSQL before applying migrations or upgrading the application.
Security
- Do not commit API keys, OAuth secrets, payment keys, database passwords, or server credentials.
- Review
deploy/config.example.yamlbefore exposing the service publicly. - Restrict admin access with strong passwords, MFA where available, and trusted reverse-proxy rules.
- Keep payment, storage, moderation, and email credentials scoped to the minimum required permissions.
- Run
make secret-scanbefore publishing changes.
License
This project follows the license included in LICENSE.
Acknowledgements
ikik-api is based on Sub2API and extends it for self-hosted AI gateway, subscription, accounting, and operation workflows.
Ähnliche Projekte entdecken
Wird geladen…