refactor: rename manager codebase dir new-api → heicode, module github.com/heicode/manager

Remove user-facing new-api naming; Docker/network/container names use heicode.
Go imports updated; Dockerfiles and workflows ldflags fixed.

Made-with: Cursor
This commit is contained in:
gongzhiyong
2026-05-01 01:47:23 +08:00
parent 5d2d463db3
commit 1f21309597
1941 changed files with 2170 additions and 2056 deletions
+13 -9
View File
@@ -7,7 +7,7 @@
| 路径 | 角色 | 栈 / 备注 |
|------|------|-----------|
| `cc-haha/` | **Heicode** 客户端:CLI(Ink)+ 本地 HTTP/WS 服务 + **Desktop**(Tauri + React) | Bun + TypeScript;产品入口 `bin/heicode` |
| `new-api/` | **Heicode Manager**:网关 + 管理控制台 | Go(Gin/GORM)+ `web/default` 前端(Bun/Rsbuild/React) |
| `heicode/` | **Heicode Manager**:网关 + 管理控制台 | Go(Gin/GORM)+ `web/default` 前端(Bun/Rsbuild/React) |
| `website/` | 产品介绍站点 | Next.js;根 `docker-compose.yml` 提供 `heicode-www` :8888 |
| `docs/` | 愿景、**里程碑**(`docs/milestones/`)、**Agnet 集成**(`docs/integration/`) | Markdown |
@@ -16,7 +16,7 @@
## 权威子文档(改代码前先打开对应一篇)
- **客户端(cc-haha)**:[`cc-haha/AGENTS.md`](./cc-haha/AGENTS.md) — 目录结构、运行命令、测试、提交约定。
- **网关(new-api)**:[`new-api/CLAUDE.md`](./new-api/CLAUDE.md) — Go 分层、JSON/i18n/DB 规则等。
- **网关(heicode)**:[`heicode/CLAUDE.md`](./heicode/CLAUDE.md) — Go 分层、JSON/i18n/DB 规则等。
- **产品愿景与交付节奏**:[`docs/vision-heicode-full-stack-agentic-dev.md`](./docs/vision-heicode-full-stack-agentic-dev.md)、[`docs/milestones/README.md`](./docs/milestones/README.md)。
## 最小开发闭环
@@ -32,7 +32,7 @@ bun run src/server/index.ts
cd desktop && bun run tauri dev
```
联调本机 Manager(new-api)时常见:
联调本机 Manager(heicode)时常见:
```bash
HEICODE_TAIJIAICLOUD_BASE_URL=http://localhost:3000 bun run src/server/index.ts
@@ -45,11 +45,11 @@ HEICODE_TAIJIAICLOUD_BASE_URL=http://localhost:3000 bun run src/server/index.ts
- **客户端登录 / Provider**:`cc-haha/src/server/api/heicode-auth.ts`,路由前缀 `/api/heicode-auth/*`(由 `cc-haha/src/server/router.ts` 挂载)。
- **模型发现**:`cc-haha/src/server/services/providerService.ts`、`cc-haha/src/server/api/providers.ts`。
- **Provider 预设**:`cc-haha/src/server/config/providerPresets.json` + `providerPresets.ts`。
- **Manager 侧 Heicode OAuth**:`new-api/controller/heicode_oauth.go`,路由 `new-api/router/heicode-router.go`(例如 `/heicode/oauth/authorize`、`/heicode/oauth/session`)。
- **Manager 侧 Heicode OAuth**:`heicode/controller/heicode_oauth.go`,路由 `heicode/router/heicode-router.go`(例如 `/heicode/oauth/authorize`、`/heicode/oauth/session`)。
## 协作约定(根级)
1. **改哪一层跟哪篇文档**:Go 行为以 `new-api/CLAUDE.md` 为准;客户端 TS/React 以 `cc-haha/AGENTS.md` 为准。
1. **改哪一层跟哪篇文档**:Go 行为以 `heicode/CLAUDE.md` 为准;客户端 TS/React 以 `cc-haha/AGENTS.md` 为准。
2. **小步提交**:沿用历史风格(如 `feat:` / `fix:` / `docs:`);PR 写清影响面与验证步骤。
3. **集成与「SK」边界**:平台契约见 [`docs/integration/agnet-platform-api-design.md`](./docs/integration/agnet-platform-api-design.md),里程碑见 `docs/milestones/`。
4. **不要臆测计费**:计费与订阅在平台侧,不在 Heicode 客户端内实现。
@@ -57,7 +57,9 @@ HEICODE_TAIJIAICLOUD_BASE_URL=http://localhost:3000 bun run src/server/index.ts
## Docker / 站点
- 根目录 [`docker-compose.yml`](./docker-compose.yml):构建 `website/` 静态站点镜像(端口 **8888**)。
- Manager 本地编排以 `new-api/docker-compose.yml` 及仓库内 override 为准(若存在)。
- Manager 本地编排以 `heicode/docker-compose.yml` 及仓库内 override 为准(若存在)。
- **VM / 生产同步代码**:优先在目标机上 **`git clone` / `git pull`** 与本仓库远程一致;**不要**用 `scp` 传整份源码或 compose(仅在仓库不可用或紧急热修时例外)。
- **VM 部署后清镜像**:每次 `docker compose ... up -d --build` 后执行 **`sudo docker image prune -f`**,清掉重建产生的悬空层;定期可 **`sudo docker system prune -f`**(不删仍在使用的卷)。避免只叠新镜像、旧层占满磁盘。
## 当前线上入口(2026-04)
@@ -68,11 +70,13 @@ HEICODE_TAIJIAICLOUD_BASE_URL=http://localhost:3000 bun run src/server/index.ts
## Manager 生产拓扑(Azure)
- 应用层:Azure VM 上运行 `new-api`(当前用 Docker 容器承载应用进程)。
- 数据层:仅使用云资源
- 应用层:Azure VM 上运行 `heicode`(当前用 Docker 容器承载应用进程)。
- 数据库与缓存:使用 Azure 托管服务(不在 VM 上跑 PostgreSQL/Redis 容器)
- PostgreSQL: `heicode.postgres.database.azure.com` / DB `heicode`
- Redis: `heicode.redis.cache.windows.net:6380`(TLS)
- 说明:VM 上本地 `postgres/redis` 不参与生产,若被创建应删除,避免数据源混淆。
- 容器落盘:VM 仅承载应用进程;**容器内产生的文件**(如 `/data` 上传与持久文件、`/app/logs`)通过 **bind mount** 写到 VM 本地磁盘,便于备份与重建容器后不丢。编排见 `heicode/docker-compose.azure-vm.yml`,目录由环境变量 `HEICODE_DATA_ROOT` 指定。
- 说明:不要在生产 VM 上再启本地 `postgres`/`redis` 容器并指向业务库,避免与托管实例混淆。
- 镜像清理:发版构建后删除悬空/旧镜像层(见上文「VM 部署后清镜像」),防止 OS 盘被 Docker 占满。
---
+4 -4
View File
@@ -9,7 +9,7 @@ Heicode 面向**多人协作、可追溯交付**的软件团队:把需求对
| 目录 | 大致含义 |
|------|----------|
| `cc-haha/` | **Heicode**(终端与桌面客户端及本地服务;此为源码目录名)。 |
| `new-api/` | **Heicode Manager**(网关与管理控制台服务端;此为源码目录名)。 |
| `heicode/` | **Heicode Manager**(网关与管理控制台服务端;此为源码目录名)。 |
| `website/` | 产品介绍站点(Next.js;可 `pnpm dev` 或 Docker 预览)。 |
| `docs/` | 愿景与范式;**[`docs/milestones/`](./docs/milestones/README.md)** 交付里程碑;**[`docs/integration/`](./docs/integration/README.md)** Agnet 等平台接口设计。 |
@@ -44,12 +44,12 @@ bun run tauri dev
HEICODE_TAIJIAICLOUD_BASE_URL=http://localhost:3000 bun run src/server/index.ts
```
**Heicode Manager**(`new-api/`)中与 Heicode 登录相关的路由(最小集,以实际代码为准):
**Heicode Manager**(`heicode/`)中与 Heicode 登录相关的路由(最小集,以实际代码为准):
- `GET /heicode/oauth/authorize`
- `GET /heicode/oauth/session`
平台侧能力还包括模型发现(如 `GET /v1/models`)与 Anthropic Messages 兼容入口等,详见 **Heicode Manager**(`new-api/`)与 **Heicode 客户端**(`cc-haha/`)各自 README。
平台侧能力还包括模型发现(如 `GET /v1/models`)与 Anthropic Messages 兼容入口等,详见 **Heicode Manager**(`heicode/`)与 **Heicode 客户端**(`cc-haha/`)各自 README。
## 官网(Next.js)
@@ -72,4 +72,4 @@ cd website && pnpm install && pnpm dev
## 许可证
各子项目许可证见各子目录内 `LICENSE`(例如 Heicode Manager / `new-api/` 侧常见为 AGPLv3)。
各子项目许可证见各子目录内 `LICENSE`(例如 Heicode Manager / `heicode/` 侧常见为 AGPLv3)。
+3 -3
View File
@@ -7,7 +7,7 @@
## 当前形态
- **登录方式**:用户启动 HeiCode 后只看到两个登录入口
- **TaijiAICloud**(自建网关,基于 [`new-api`](https://github.com/Calcium-Ion/new-api))
- **TaijiAICloud**(自建网关,基于 [`heicode`](https://github.com/Calcium-Ion/heicode))
- **ClawdRouter**(聚合网关)
- **支持模式**:
- 浏览器跳转 OAuth(推荐 / 平台支持后启用)
@@ -118,7 +118,7 @@ curl -X POST http://127.0.0.1:3456/api/heicode-auth/login \
详见 [`docs/HEICODE-PLAN.md`](./docs/HEICODE-PLAN.md)。简版:
### TaijiAICloud(基于 new-api)
### TaijiAICloud(基于 heicode)
- 必备:`/v1/messages`(Anthropic 原生协议) · `/v1/models` · API Key 子分组管理
- 推荐:OAuth2 Authorization Code + PKCE 端点;Webhook(额度告警)
@@ -154,4 +154,4 @@ curl -X POST http://127.0.0.1:3456/api/heicode-auth/login \
## 致谢
- 上游 [`cc-haha`](https://github.com/NanmiCoder/cc-haha) — 提供基础工程
- [`new-api`](https://github.com/Calcium-Ion/new-api) — 模型网关后端
- [`heicode`](https://github.com/Calcium-Ion/heicode) — 模型网关后端
@@ -19,7 +19,7 @@ type Props = {
* - http:// (not https://) — typical for in-cluster gateways
* - localhost / 127.0.0.1
* - 10/172.16-31/192.168 RFC1918 ranges
* - any hostname without a dot (e.g. `new-api`, `heicode-server`) — Docker DNS aliases
* - any hostname without a dot (e.g. `heicode`, `heicode-server`) — Docker DNS aliases
*/
function isLocalBaseUrl(rawUrl: string): boolean {
if (!rawUrl) return false
@@ -86,7 +86,7 @@ export function ProviderLoginCard({ provider }: Props) {
{/* Always-visible baseUrl indicator. Helps the user immediately tell
whether this card is pointing at the public TaijiAICloud endpoint
or has been overridden to a local new-api dev gateway. */}
or has been overridden to a local heicode dev gateway. */}
<div
className="flex flex-wrap items-center gap-1.5 text-xs text-[var(--color-text-tertiary)]"
data-testid={`heicode-login-card-baseurl-${provider.id}`}
+9 -9
View File
@@ -5,9 +5,9 @@
# curl http://127.0.0.1:3456/health
# curl http://127.0.0.1:3456/api/heicode-auth/providers
#
# This compose joins the existing `new-api_new-api-network` so HeiCode can
# reach the local new-api gateway directly via http://new-api:3000
# (no need to expose new-api on the host LAN).
# This compose joins the existing `heicode_heicode-network` so HeiCode can
# reach the local heicode gateway directly via http://heicode:3000
# (no need to expose heicode on the host LAN).
services:
heicode-server:
@@ -26,16 +26,16 @@ services:
# to it without a bearer. Set to "1" in any non-trivial deployment.
SERVER_AUTH_REQUIRED: "0"
CLAUDE_CONFIG_DIR: "/data/.claude"
# When you want HeiCode to default to the local new-api gateway
# When you want HeiCode to default to the local heicode gateway
# instead of TaijiAICloud / ClawdRouter, point ANTHROPIC_BASE_URL at
# the in-network address. The auth flow can override this at runtime.
# ANTHROPIC_BASE_URL: "http://new-api:3000"
# ANTHROPIC_BASE_URL: "http://heicode:3000"
# ANTHROPIC_AUTH_TOKEN: ""
volumes:
- heicode-data:/data
networks:
- default
- new-api-network
- heicode-network
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:3456/health"]
interval: 15s
@@ -47,9 +47,9 @@ volumes:
heicode-data:
networks:
# `default` is automatic; we declare it only so we can list `new-api-network`
# `default` is automatic; we declare it only so we can list `heicode-network`
# alongside it without accidentally dropping the default.
default:
new-api-network:
heicode-network:
external: true
name: new-api_new-api-network
name: heicode_heicode-network
+8 -8
View File
@@ -12,7 +12,7 @@
|---|---|
| 用户 | 个人开发者 |
| 形态 | Claude Code 桌面客户端 + CLI |
| 模型来源 | TaijiAICloud(自建网关,基于 new-api) + ClawdRouter(聚合网关) |
| 模型来源 | TaijiAICloud(自建网关,基于 heicode) + ClawdRouter(聚合网关) |
| 计费 | 完全在平台侧(不在 HeiCode 内做任何计费) |
| 中台 | **不需要**。客户端 → 平台直连。|
| 私有化 | **不做**。HeiCode 只对外销售客户端,平台是你公司运营的 SaaS。|
@@ -114,7 +114,7 @@ HeiCode 自动 /v1/models 拉模型列表 → 注入 ANTHROPIC_DEFAULT_*_MODEL
### S3 阶段(差异化)
- [ ] **配额状态栏**:拉平台 `/v1/usage` 或 new-api `/api/quota/`
- [ ] **配额状态栏**:拉平台 `/v1/usage` 或 heicode `/api/quota/`
- [ ] **多模型快捷切换**:顶部下拉选模型(已具备 `/api/providers/:id/models`)
- [ ] **Taiji Agent 工具融合**:通过 MCP 把 Taiji Agent 的工具挂载进 HeiCode
@@ -122,16 +122,16 @@ HeiCode 自动 /v1/models 拉模型列表 → 注入 ANTHROPIC_DEFAULT_*_MODEL
## 五、给 TaijiAICloud / ClawdRouter 的对接 SOW
### TaijiAICloud(基于 new-api)
### TaijiAICloud(基于 heicode)
| # | 资产 / 接口 | 状态 | 说明 |
|---|---|---|---|
| 1 | `/v1/messages` Anthropic 原生协议 | **必须确认** | new-api 配置项: 启用 Claude Messages 转发 |
| 2 | `/v1/models` | 应已就绪 | new-api 默认提供 |
| 1 | `/v1/messages` Anthropic 原生协议 | **必须确认** | heicode 配置项: 启用 Claude Messages 转发 |
| 2 | `/v1/models` | 应已就绪 | heicode 默认提供 |
| 3 | OAuth2 Authorization Code + PKCE | **待开发** | 见 S2 阶段 |
| 4 | 子 Token 管理(限定 model 白名单 / 每日额度 / 过期) | new-api 自带 | 平台直接复用 |
| 5 | 调用日志 / 审计(≥180天) | new-api 自带 | `/api/log/` |
| 6 | (可选) Webhook 额度告警 | 待开发 | new-api 原生没有 |
| 4 | 子 Token 管理(限定 model 白名单 / 每日额度 / 过期) | heicode 自带 | 平台直接复用 |
| 5 | 调用日志 / 审计(≥180天) | heicode 自带 | `/api/log/` |
| 6 | (可选) Webhook 额度告警 | 待开发 | heicode 原生没有 |
### ClawdRouter
@@ -189,11 +189,11 @@ describe('ProviderService', () => {
const updated = await svc.updateProvider(added.id, {
name: 'Updated Name',
baseUrl: 'https://new-api.example.com',
baseUrl: 'https://heicode.example.com',
})
expect(updated.name).toBe('Updated Name')
expect(updated.baseUrl).toBe('https://new-api.example.com')
expect(updated.baseUrl).toBe('https://heicode.example.com')
// unchanged fields preserved
expect(updated.apiKey).toBe('sk-test-key-123')
})
@@ -216,13 +216,13 @@ describe('ProviderService', () => {
await svc.activateProvider(added.id)
await svc.updateProvider(added.id, {
baseUrl: 'https://new-api.example.com',
baseUrl: 'https://heicode.example.com',
apiKey: 'sk-new-key',
})
const settings = await readSettings()
const env = settings.env as Record<string, string>
expect(env.ANTHROPIC_BASE_URL).toBe('https://new-api.example.com')
expect(env.ANTHROPIC_BASE_URL).toBe('https://heicode.example.com')
expect(env.ANTHROPIC_API_KEY).toBe('sk-new-key')
expect(env.ANTHROPIC_MODEL).toBe('model-main')
})
+1 -1
View File
@@ -34,7 +34,7 @@ export type ProviderPreset = z.infer<typeof ProviderPresetSchema>
/**
* Per-provider base URL overrides via env. This lets a developer point
* HeiCode at a *local* gateway (e.g. a self-hosted new-api on Docker)
* HeiCode at a *local* gateway (e.g. a self-hosted heicode on Docker)
* without editing the preset JSON file.
*
* Examples:
@@ -409,7 +409,7 @@ export class ProviderService {
* Fetch the list of models exposed by a provider.
*
* Strategy:
* 1. Try `GET <baseUrl>/v1/models` (OpenAI-compatible — what TaijiAICloud (new-api) and ClawdRouter both expose).
* 1. Try `GET <baseUrl>/v1/models` (OpenAI-compatible — what TaijiAICloud (heicode) and ClawdRouter both expose).
* 2. Fall back to `GET <baseUrl>/models` (some Anthropic-flavoured proxies put it there).
* 3. If neither works, return an empty list — the UI should let the user enter a model id manually.
*
+1 -1
View File
@@ -13,7 +13,7 @@
## 路径 A · 内部研发 / 新成员上手
适合刚加入团队、负责 `cc-haha`(客户端)或 `new-api`(Manager)开发的同学。
适合刚加入团队、负责 `cc-haha`(客户端)或 `heicode`(Manager)开发的同学。
1. [`onboarding/README.md`](./onboarding/README.md):阅读顺序
2. [`onboarding/local-dev.md`](./onboarding/local-dev.md):本地联调步骤与排错
+3 -3
View File
@@ -11,7 +11,7 @@
```mermaid
flowchart TD
entry["人机入口<br/>官网 · 控制台 · CLI · Desktop"]
manager["Heicode Manager<br/>(new-api)"]
manager["Heicode Manager<br/>(heicode)"]
client["Heicode 客户端<br/>(cc-haha)"]
agnet["Agnet 平台<br/>(角色模板 · 执行单元)"]
assets["资产与环境<br/>仓库 · 流水线 · 运行时"]
@@ -107,7 +107,7 @@ flowchart LR
## 五、模块关注点对照
| 关注点 | Heicode 客户端 (`cc-haha/`) | Heicode Manager (`new-api/`) | Agnet 平台 |
| 关注点 | Heicode 客户端 (`cc-haha/`) | Heicode Manager (`heicode/`) | Agnet 平台 |
|--------|------------------------------|-------------------------------|------------|
| 用户身份 | 浏览器登录 / API Key 兼容 | OAuth 提供方、Token 颁发与吊销 | 接收 M2M JWT 与用户委派令牌 |
| 模型调用 | 不直连模型,请求经 Manager | 路由、计费、RBAC | 不参与基础模型调用 |
@@ -121,6 +121,6 @@ flowchart LR
- 客户端登录:`cc-haha/src/server/api/heicode-auth.ts`
- 客户端 Provider 预设:`cc-haha/src/server/config/providerPresets.ts`
- Manager OAuth:`new-api/controller/heicode_oauth.go`、`new-api/router/heicode-router.go`
- Manager OAuth:`heicode/controller/heicode_oauth.go`、`heicode/router/heicode-router.go`
> 代码会演进,本文以 **架构关系** 为准;具体路径请以仓库当前实现为最终事实。
+1 -1
View File
@@ -11,7 +11,7 @@
仓库与产品族的总称。在区分产品形态时,亦称 **Heicode 客户端**。
### Heicode Manager
账户、模型策略、渠道、计费与平台管控的服务端,源码目录 `new-api/`。在文档中亦称 **Manager**。
账户、模型策略、渠道、计费与平台管控的服务端,源码目录 `heicode/`。在文档中亦称 **Manager**。
### Heicode 客户端
面向开发者的 CLI(Ink)+ 桌面应用(Tauri + React)+ 本地 HTTP/WS 服务,源码目录 `cc-haha/`。
+4 -4
View File
@@ -5,7 +5,7 @@
> 代码位置:
>
> - 客户端:`cc-haha/src/server/api/heicode-auth.ts`
> - 服务端:`new-api/controller/heicode_oauth.go`、`new-api/router/heicode-router.go`
> - 服务端:`heicode/controller/heicode_oauth.go`、`heicode/router/heicode-router.go`
## 一、设计目标
@@ -22,8 +22,8 @@
| 端点 | 谁实现 | 用途 |
| -------------------------------------- | ---------------- | ---------------------------------- |
| `POST /api/heicode-auth/oauth/start` | 客户端本地服务 | 生成 `state` / PKCE,返回 authorize URL |
| `GET /heicode/oauth/authorize` | Manager(new-api) | 校验 loopback、引导登录、回跳 token |
| `GET /heicode/oauth/session` | Manager(new-api) | 给「请先登录」过渡页轮询登录态 |
| `GET /heicode/oauth/authorize` | Manager(heicode) | 校验 loopback、引导登录、回跳 token |
| `GET /heicode/oauth/session` | Manager(heicode) | 给「请先登录」过渡页轮询登录态 |
| `GET /api/heicode-auth/oauth/callback` | 客户端本地服务 | 接收 token / code,落地并激活 |
@@ -35,7 +35,7 @@ sequenceDiagram
participant U as 用户
participant C as Heicode 客户端<br/>(本地 HTTP 服务)
participant B as 浏览器
participant M as Heicode Manager<br/>(new-api)
participant M as Heicode Manager<br/>(heicode)
U->>C: 点击「浏览器登录」
C->>C: 生成 state / PKCE 并写入会话
+6 -6
View File
@@ -8,7 +8,7 @@
> - `todo`:尚未开始或仅有占位
> - `docs-only`:仅文档定义,待实现承接
>
> 来源依据:`cc-haha/src/server/api/heicode-auth.ts`、`cc-haha/src/server/services/providerService.ts`、`new-api/controller/heicode_oauth.go`、`new-api/router/heicode-router.go`、本仓库 `docs/`。
> 来源依据:`cc-haha/src/server/api/heicode-auth.ts`、`cc-haha/src/server/services/providerService.ts`、`heicode/controller/heicode_oauth.go`、`heicode/router/heicode-router.go`、本仓库 `docs/`。
## M1 · 契约与身份对齐
@@ -34,7 +34,7 @@
| DoD | 状态 | 备注 |
|-----|------|------|
| Agnet 控制面最小集(部署/伸缩/停止) | `docs-only` | 设计完整,本仓库不含实现 |
| Heicode Manager「一键部署 Agnet 团队」 | `todo` | 尚未在 `new-api` 中提供 |
| Heicode Manager「一键部署 Agnet 团队」 | `todo` | 尚未在 `heicode` 中提供 |
| SK 边界(写权仅 Heicode、子 agent 只读) | `partial` | 文档单点真相已就绪([`../sk-lifecycle.md`](../sk-lifecycle.md));客户端 SK 编辑入口待落地 |
| Webhook / 回调(Agnet → Heicode) | `todo` | Manager 未提供回调注册端点 |
| 幂等与 `deployment_id` / `correlation_id` | `docs-only` | 字段约定见 API 设计 §5.1、§2.3 |
@@ -45,11 +45,11 @@
| DoD | 状态 | 备注 |
|-----|------|------|
| 租户模型(`tenant` 顶层) | `partial` | `new-api` 自身有用户/组/Token 体系;Heicode 维度未与 Agnet 集成 |
| RBAC 角色矩阵 | `partial` | `new-api` 控制台已有基础角色;与 Agnet 设计(`agnet:*` 角色)未对齐 |
| 租户模型(`tenant` 顶层) | `partial` | `heicode` 自身有用户/组/Token 体系;Heicode 维度未与 Agnet 集成 |
| RBAC 角色矩阵 | `partial` | `heicode` 控制台已有基础角色;与 Agnet 设计(`agnet:*` 角色)未对齐 |
| 数据面隔离与跨租户负例 | `todo` | 待联合 Agnet 落地后补测 |
| 凭据写入隔离(Git Token / 云 SA) | `docs-only` | 见 API 设计 §3.2 |
| 审计日志(追加式) | `partial` | `new-api` 自带操作日志;统一 `correlation_id` 字段未规范化 |
| 审计日志(追加式) | `partial` | `heicode` 自带操作日志;统一 `correlation_id` 字段未规范化 |
## M5 · 可观测性与可视化
@@ -57,7 +57,7 @@
|-----|------|------|
| 实例快照 API | `docs-only` | 字段定义见 API 设计 §6.1 |
| 子 Agnet 输出流(SSE/WS) | `todo` | 客户端 UI 尚未实现订阅 |
| 项目级聚合 / Dashboard | `partial` | `new-api` 控制台具备模型/Token 指标基础 |
| 项目级聚合 / Dashboard | `partial` | `heicode` 控制台具备模型/Token 指标基础 |
| 事件流(含 `Last-Event-ID` 重连) | `docs-only` | 见 API 设计 §7 |
| 与 RBAC 联动 | `todo` | 需在 M4 落地后回填 |
| SLI 指标导出 | `todo` | Prometheus / JSON 端点未配置 |
+4 -4
View File
@@ -4,13 +4,13 @@
## 推荐阅读顺序
1. [`local-dev.md`](./local-dev.md):把 `cc-haha`(客户端)、`new-api`(Manager)、`website`(站点)跑起来;含常见错误与排查
1. [`local-dev.md`](./local-dev.md):把 `cc-haha`(客户端)、`heicode`(Manager)、`website`(站点)跑起来;含常见错误与排查
2. [`env-variables.md`](./env-variables.md):客户端识别的环境变量(base URL、OAuth 配置)
3. 共用骨架:[`../architecture.md`](../architecture.md)、[`../glossary.md`](../glossary.md)、[`../sk-lifecycle.md`](../sk-lifecycle.md)
4. 现状对齐:[`../milestones/STATUS.md`](../milestones/STATUS.md)
5. 子项目细则:
- 客户端约定:[`../../cc-haha/AGENTS.md`](../../cc-haha/AGENTS.md)
- 网关约定:[`../../new-api/CLAUDE.md`](../../new-api/CLAUDE.md)
- 网关约定:[`../../heicode/CLAUDE.md`](../../heicode/CLAUDE.md)
## 改代码前的最小心智模型
@@ -19,7 +19,7 @@
| 客户端登录 / Provider | `cc-haha/src/server/api/heicode-auth.ts` | 路由前缀 `/api/heicode-auth/*` |
| 客户端模型发现 | `cc-haha/src/server/services/providerService.ts`、`cc-haha/src/server/api/providers.ts` | `/v1/models` 探活 |
| Provider 预设 | `cc-haha/src/server/config/providerPresets.json` + `providerPresets.ts` | 仅保留 `taijiaicloud` / `clawdrouter` |
| Manager OAuth | `new-api/controller/heicode_oauth.go` | 路由 `new-api/router/heicode-router.go` |
| Manager OAuth | `heicode/controller/heicode_oauth.go` | 路由 `heicode/router/heicode-router.go` |
| 桌面端 UI | `cc-haha/desktop/src/` | Tauri + React |
## 你不需要做的事
@@ -38,5 +38,5 @@
## 提问与求助
- 客户端 TS/React 行为问题:先看 [`../../cc-haha/AGENTS.md`](../../cc-haha/AGENTS.md)
- 网关 Go 行为问题:先看 [`../../new-api/CLAUDE.md`](../../new-api/CLAUDE.md)
- 网关 Go 行为问题:先看 [`../../heicode/CLAUDE.md`](../../heicode/CLAUDE.md)
- 集成 / Agnet 契约问题:先看 [`../integration/README.md`](../integration/README.md)
+1 -1
View File
@@ -1,6 +1,6 @@
# 环境变量手册(Heicode 客户端)
仅列出 Heicode 客户端(`cc-haha/`)当前 **代码中已支持** 的环境变量。Manager(`new-api/`)的环境变量请以 `new-api/CLAUDE.md` 与 `new-api/.env.example` 为准。
仅列出 Heicode 客户端(`cc-haha/`)当前 **代码中已支持** 的环境变量。Manager(`heicode/`)的环境变量请以 `heicode/CLAUDE.md` 与 `heicode/.env.example` 为准。
> 来源代码:
> - `cc-haha/src/server/config/providerPresets.ts`
+8 -8
View File
@@ -1,6 +1,6 @@
# 本地联调指引
把仓库内三块跑起来:`cc-haha`(客户端)、`new-api`(Manager)、`website`(站点)。下面命令以 macOS / Linux 为主,Windows 仅在差异点提示。
把仓库内三块跑起来:`cc-haha`(客户端)、`heicode`(Manager)、`website`(站点)。下面命令以 macOS / Linux 为主,Windows 仅在差异点提示。
> 命令以仓库当前 README 与 package.json 为准;如出现冲突,以代码为最终事实。
> 客户端工程级别的更细约定在 [`../../cc-haha/AGENTS.md`](../../cc-haha/AGENTS.md)。
@@ -34,11 +34,11 @@ bun run tauri dev
服务默认监听 `http://127.0.0.1:3456`(可用 `SERVER_PORT` 覆盖)。
## 三、联调本机 Manager(new-api)
## 三、联调本机 Manager(heicode)
```bash
# 1. 起 Manager(new-api)
cd new-api
# 1. 起 Manager(heicode)
cd heicode
docker compose -f docker-compose.yml -f docker-compose.override.yml up --build -d
# 2. 让客户端把 TaijiAICloud 指向本地 Manager
@@ -67,17 +67,17 @@ bun run lint # tsc --noEmit
桌面端构建产物:`bun run build` 或针对平台用 `bun run build:macos-arm64` / `bun run build:windows-x64`。
## 六、Manager(new-api)开发
## 六、Manager(heicode)开发
简版命令以 `new-api/CLAUDE.md` 为准,本节只列联调相关:
简版命令以 `heicode/CLAUDE.md` 为准,本节只列联调相关:
```bash
# 用本地 source 构建(覆盖镜像)
cd new-api
cd heicode
docker compose -f docker-compose.yml -f docker-compose.override.yml up --build -d
# 看日志
docker compose logs -f new-api
docker compose logs -f heicode
```
启动后访问 `http://localhost:3000`,注册管理员,再测试客户端登录链路。
@@ -11,7 +11,7 @@
# DEBUG=true
# Pyroscope 配置
# PYROSCOPE_URL=http://localhost:4040
# PYROSCOPE_APP_NAME=new-api
# PYROSCOPE_APP_NAME=heicode
# PYROSCOPE_BASIC_AUTH_USER=your-user
# PYROSCOPE_BASIC_AUTH_PASSWORD=your-password
# PYROSCOPE_MUTEX_RATE=5
@@ -10,7 +10,7 @@ assignees: ''
## 提交前必读(请勿删除本节)
- 文档:https://docs.newapi.ai/
- 使用问题先看或先问:https://deepwiki.com/QuantumNous/new-api
- 使用问题先看或先问:https://deepwiki.com/QuantumNous/heicode
- 警告:删除本模板、删除小节标题或随意清空内容的 issue,可能会被直接关闭;重复恶意提交者可能会被 block。
**您当前的 newapi 版本**
@@ -10,7 +10,7 @@ assignees: ''
## Read This First (Do Not Remove This Section)
- Docs: https://docs.newapi.ai/
- Usage questions first: https://deepwiki.com/QuantumNous/new-api
- Usage questions first: https://deepwiki.com/QuantumNous/heicode
- Warning: issues with this template removed, section headings deleted, or content cleared may be closed directly. Repeated abusive submissions may result in a block.
**Your current newapi version**
@@ -4,5 +4,5 @@ contact_links:
url: https://docs.newapi.ai/
about: 提交 issue 前请先查阅文档,确认现有说明无法解决你的问题。
- name: 使用问题 / Usage Questions
url: https://deepwiki.com/QuantumNous/new-api
url: https://deepwiki.com/QuantumNous/heicode
about: 使用、配置、接入等问题请优先在 DeepWiki 查询或提问。
@@ -10,7 +10,7 @@ assignees: ''
## 提交前必读(请勿删除本节)
- 文档:https://docs.newapi.ai/
- 使用问题先看或先问:https://deepwiki.com/QuantumNous/new-api
- 使用问题先看或先问:https://deepwiki.com/QuantumNous/heicode
- 警告:删除本模板、删除小节标题或随意清空内容的 issue,可能会被直接关闭;重复恶意提交者可能会被 block。
**您当前的 newapi 版本**
@@ -10,7 +10,7 @@ assignees: ''
## Read This First (Do Not Remove This Section)
- Docs: https://docs.newapi.ai/
- Usage questions first: https://deepwiki.com/QuantumNous/new-api
- Usage questions first: https://deepwiki.com/QuantumNous/heicode
- Warning: issues with this template removed, section headings deleted, or content cleared may be closed directly. Repeated abusive submissions may result in a block.
**Your current newapi version**
@@ -17,7 +17,7 @@
## ✅ 提交前检查项 / Checklist
- [ ] **人工确认:** 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
- [ ] **非重复提交:** 我已搜索现有的 [Issues](https://github.com/QuantumNous/new-api/issues) 与 [PRs](https://github.com/QuantumNous/new-api/pulls),确认不是重复提交。
- [ ] **非重复提交:** 我已搜索现有的 [Issues](https://github.com/QuantumNous/heicode/issues) 与 [PRs](https://github.com/QuantumNous/heicode/pulls),确认不是重复提交。
- [ ] **Bug fix 说明:** 若此 PR 标记为 `Bug fix`,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
- [ ] **变更理解:** 我已理解这些更改的工作原理及可能影响。
- [ ] **范围聚焦:** 本 PR 未包含任何与当前任务无关的代码改动。
@@ -19,7 +19,7 @@ We take security vulnerability reports very seriously. If you discover a securit
**Do NOT** report security vulnerabilities in public GitHub Issues.
To report a security issue, please use the GitHub Security Advisories tab to "[Open a draft security advisory](https://github.com/QuantumNous/new-api/security/advisories/new)". This is the preferred method as it provides a built-in private communication channel.
To report a security issue, please use the GitHub Security Advisories tab to "[Open a draft security advisory](https://github.com/QuantumNous/heicode/security/advisories/new)". This is the preferred method as it provides a built-in private communication channel.
Alternatively, you can report via email:
@@ -71,7 +71,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: calciumion/new-api
images: calciumion/heicode
- name: Build & push
id: build
@@ -81,8 +81,8 @@ jobs:
platforms: ${{ matrix.platform }}
push: true
tags: |
calciumion/new-api:${{ env.TAG }}-${{ matrix.arch }}
calciumion/new-api:latest-${{ matrix.arch }}
calciumion/heicode:${{ env.TAG }}-${{ matrix.arch }}
calciumion/heicode:latest-${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
@@ -93,13 +93,13 @@ jobs:
uses: sigstore/cosign-installer@v3
- name: Sign image with cosign
run: cosign sign --yes calciumion/new-api@${{ steps.build.outputs.digest }}
run: cosign sign --yes calciumion/heicode@${{ steps.build.outputs.digest }}
- name: Image summary
run: |
echo "### Docker Image Digest (${{ matrix.arch }})" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "calciumion/new-api:${TAG}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY
echo "calciumion/heicode:${TAG}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.build.outputs.digest }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
@@ -122,20 +122,20 @@ jobs:
- name: Create & push manifest (version)
run: |
docker buildx imagetools create \
-t calciumion/new-api:${TAG} \
calciumion/new-api:${TAG}-amd64 \
calciumion/new-api:${TAG}-arm64
-t calciumion/heicode:${TAG} \
calciumion/heicode:${TAG}-amd64 \
calciumion/heicode:${TAG}-arm64
- name: Create & push manifest (latest)
run: |
docker buildx imagetools create \
-t calciumion/new-api:latest \
calciumion/new-api:latest-amd64 \
calciumion/new-api:latest-arm64
-t calciumion/heicode:latest \
calciumion/heicode:latest-amd64 \
calciumion/heicode:latest-arm64
- name: Manifest summary
run: |
echo "### Multi-arch Manifest" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
docker buildx imagetools inspect calciumion/new-api:${TAG} >> $GITHUB_STEP_SUMMARY
docker buildx imagetools inspect calciumion/heicode:${TAG} >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
@@ -67,7 +67,7 @@ jobs:
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: |
calciumion/new-api
calciumion/heicode
ghcr.io/${{ env.GHCR_REPOSITORY }}
- name: Build & push single-arch (to both registries)
@@ -78,8 +78,8 @@ jobs:
platforms: ${{ matrix.platform }}
push: true
tags: |
calciumion/new-api:alpha-${{ matrix.arch }}
calciumion/new-api:${{ steps.version.outputs.value }}-${{ matrix.arch }}
calciumion/heicode:alpha-${{ matrix.arch }}
calciumion/heicode:${{ steps.version.outputs.value }}-${{ matrix.arch }}
ghcr.io/${{ env.GHCR_REPOSITORY }}:alpha-${{ matrix.arch }}
ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ steps.version.outputs.value }}-${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
@@ -93,14 +93,14 @@ jobs:
- name: Sign image with cosign
run: |
cosign sign --yes calciumion/new-api@${{ steps.build.outputs.digest }}
cosign sign --yes calciumion/heicode@${{ steps.build.outputs.digest }}
cosign sign --yes ghcr.io/${{ env.GHCR_REPOSITORY }}@${{ steps.build.outputs.digest }}
- name: Output digest
run: |
echo "### Docker Image Digest (${{ matrix.arch }})" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "calciumion/new-api:alpha-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY
echo "calciumion/heicode:alpha-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY
echo "ghcr.io/${{ env.GHCR_REPOSITORY }}:alpha-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.build.outputs.digest }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
@@ -137,16 +137,16 @@ jobs:
- name: Create & push manifest (Docker Hub - alpha)
run: |
docker buildx imagetools create \
-t calciumion/new-api:alpha \
calciumion/new-api:alpha-amd64 \
calciumion/new-api:alpha-arm64
-t calciumion/heicode:alpha \
calciumion/heicode:alpha-amd64 \
calciumion/heicode:alpha-arm64
- name: Create & push manifest (Docker Hub - versioned alpha)
run: |
docker buildx imagetools create \
-t calciumion/new-api:${VERSION} \
calciumion/new-api:${VERSION}-amd64 \
calciumion/new-api:${VERSION}-arm64
-t calciumion/heicode:${VERSION} \
calciumion/heicode:${VERSION}-amd64 \
calciumion/heicode:${VERSION}-arm64
- name: Log in to GHCR
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
@@ -173,7 +173,7 @@ jobs:
run: |
echo "### Multi-arch Manifest Digests" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
docker buildx imagetools inspect calciumion/new-api:alpha >> $GITHUB_STEP_SUMMARY
docker buildx imagetools inspect calciumion/heicode:alpha >> $GITHUB_STEP_SUMMARY
echo "---" >> $GITHUB_STEP_SUMMARY
docker buildx imagetools inspect ghcr.io/${GHCR_REPOSITORY}:alpha >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
@@ -57,7 +57,7 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
calciumion/new-api
calciumion/heicode
- name: Build & push single-arch
uses: docker/build-push-action@v6
@@ -66,8 +66,8 @@ jobs:
platforms: ${{ matrix.platform }}
push: true
tags: |
calciumion/new-api:nightly-${{ matrix.arch }}
calciumion/new-api:${{ steps.version.outputs.value }}-${{ matrix.arch }}
calciumion/heicode:nightly-${{ matrix.arch }}
calciumion/heicode:${{ steps.version.outputs.value }}-${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
@@ -101,13 +101,13 @@ jobs:
- name: Create & push manifest (Docker Hub - nightly)
run: |
docker buildx imagetools create \
-t calciumion/new-api:nightly \
calciumion/new-api:nightly-amd64 \
calciumion/new-api:nightly-arm64
-t calciumion/heicode:nightly \
calciumion/heicode:nightly-amd64 \
calciumion/heicode:nightly-arm64
- name: Create & push manifest (Docker Hub - versioned nightly)
run: |
docker buildx imagetools create \
-t calciumion/new-api:${VERSION} \
calciumion/new-api:${VERSION}-amd64 \
calciumion/new-api:${VERSION}-arm64
-t calciumion/heicode:${VERSION} \
calciumion/heicode:${VERSION}-amd64 \
calciumion/heicode:${VERSION}-arm64
@@ -55,13 +55,13 @@ jobs:
# if: runner.os != 'Windows'
# run: |
# go mod download
# go build -ldflags "-s -w -X 'new-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o new-api
# go build -ldflags "-s -w -X 'github.com/heicode/manager/common.Version=$(git describe --tags)' -extldflags '-static'" -o heicode
- name: Build Go binary (Windows)
if: runner.os == 'Windows'
run: |
go mod download
go build -ldflags "-s -w -X 'new-api/common.Version=$(git describe --tags)'" -o new-api.exe
go build -ldflags "-s -w -X 'github.com/heicode/manager/common.Version=$(git describe --tags)'" -o heicode.exe
- name: Update Electron version
run: |
@@ -52,21 +52,21 @@ jobs:
- name: Build Backend (amd64)
run: |
go mod download
go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-$VERSION
go build -ldflags "-s -w -X 'github.com/heicode/manager/common.Version=$VERSION' -extldflags '-static'" -o heicode-$VERSION
- name: Build Backend (arm64)
run: |
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gcc-aarch64-linux-gnu
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-arm64-$VERSION
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'github.com/heicode/manager/common.Version=$VERSION' -extldflags '-static'" -o heicode-arm64-$VERSION
- name: Generate checksums
run: sha256sum new-api-* > checksums-linux.txt
run: sha256sum heicode-* > checksums-linux.txt
- name: Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
new-api-*
heicode-*
checksums-linux.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -110,16 +110,16 @@ jobs:
- name: Build Backend
run: |
go mod download
go build -ldflags "-X 'new-api/common.Version=$VERSION'" -o new-api-macos-$VERSION
go build -ldflags "-X 'github.com/heicode/manager/common.Version=$VERSION'" -o heicode-macos-$VERSION
- name: Generate checksums
run: shasum -a 256 new-api-macos-* > checksums-macos.txt
run: shasum -a 256 heicode-macos-* > checksums-macos.txt
- name: Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
new-api-macos-*
heicode-macos-*
checksums-macos.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -165,16 +165,16 @@ jobs:
- name: Build Backend
run: |
go mod download
go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION'" -o new-api-$VERSION.exe
go build -ldflags "-s -w -X 'github.com/heicode/manager/common.Version=$VERSION'" -o heicode-$VERSION.exe
- name: Generate checksums
run: sha256sum new-api-*.exe > checksums-windows.txt
run: sha256sum heicode-*.exe > checksums-windows.txt
- name: Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
new-api-*.exe
heicode-*.exe
checksums-windows.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -13,8 +13,8 @@ on:
# 配置你的 Gitee 仓库信息
env:
GITEE_OWNER: 'QuantumNous' # 修改为你的 Gitee 用户名
GITEE_REPO: 'new-api' # 修改为你的 Gitee 仓库名
GITEE_OWNER: 'xiaohei' # 修改为你的 Gitee 用户名
GITEE_REPO: 'heicode' # 修改为你的 Gitee 仓库名
jobs:
sync-to-gitee:
+1 -1
View File
@@ -14,7 +14,7 @@ web/node_modules
web/dist
.env
one-api
new-api
heicode
/__debug_bin*
.DS_Store
tiktoken_cache
+1 -1
View File
@@ -1,4 +1,4 @@
# AGENTS.md — Project Conventions for new-api
# AGENTS.md — Project Conventions for heicode
## Overview
+1 -1
View File
@@ -1,4 +1,4 @@
# CLAUDE.md — Project Conventions for new-api
# CLAUDE.md — Project Conventions for heicode
## Overview
+3 -3
View File
@@ -34,7 +34,7 @@ RUN go mod download
COPY . .
COPY --from=builder /build/dist ./web/default/dist
COPY --from=builder-classic /build/dist ./web/classic/dist
RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api
RUN go build -ldflags "-s -w -X 'github.com/heicode/manager/common.Version=$(cat VERSION)'" -o heicode
FROM debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f2837acbf89ab020a
@@ -43,7 +43,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates
COPY --from=builder2 /build/new-api /
COPY --from=builder2 /build/heicode /
EXPOSE 3000
WORKDIR /data
ENTRYPOINT ["/new-api"]
ENTRYPOINT ["/heicode"]
@@ -20,7 +20,7 @@ RUN mkdir -p web/default/dist web/classic/dist && \
echo '<!doctype html><html><head><title>dev</title></head><body>use frontend dev server</body></html>' > web/default/dist/index.html && \
echo '<!doctype html><html><head><title>dev</title></head><body>use frontend dev server</body></html>' > web/classic/dist/index.html
RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api
RUN go build -ldflags "-s -w -X 'github.com/heicode/manager/common.Version=$(cat VERSION)'" -o heicode
FROM debian:bookworm-slim
@@ -29,7 +29,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates
COPY --from=builder /build/new-api /
COPY --from=builder /build/heicode /
EXPOSE 3000
WORKDIR /data
ENTRYPOINT ["/new-api"]
ENTRYPOINT ["/heicode"]
View File
+32 -32
View File
@@ -1,6 +1,6 @@
<div align="center">
![new-api](/web/default/public/logo.png)
![heicode](/web/default/public/logo.png)
# New API
@@ -14,26 +14,26 @@
</p>
<p align="center">
<a href="https://raw.githubusercontent.com/Calcium-Ion/new-api/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/new-api?color=brightgreen" alt="license">
<a href="https://raw.githubusercontent.com/Calcium-Ion/heicode/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/heicode?color=brightgreen" alt="license">
</a>
<a href="https://github.com/Calcium-Ion/new-api/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/new-api?color=brightgreen&include_prereleases" alt="release">
<a href="https://github.com/Calcium-Ion/heicode/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/heicode?color=brightgreen&include_prereleases" alt="release">
</a>
<a href="https://github.com/users/Calcium-Ion/packages/container/package/new-api">
<a href="https://github.com/users/Calcium-Ion/packages/container/package/heicode">
<img src="https://img.shields.io/badge/docker-ghcr.io-blue" alt="docker">
</a>
<a href="https://hub.docker.com/r/CalciumIon/new-api">
<a href="https://hub.docker.com/r/CalciumIon/heicode">
<img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker">
</a>
<a href="https://goreportcard.com/report/github.com/Calcium-Ion/new-api">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard">
<a href="https://goreportcard.com/report/github.com/Calcium-Ion/heicode">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/heicode" alt="GoReportCard">
</a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/8227" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/8227" alt="Calcium-Ion%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
<img src="https://trendshift.io/api/badge/repositories/8227" alt="Calcium-Ion%2Fheicode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
</p>
@@ -88,13 +88,13 @@
## 🙏 Special Thanks
<p align="center">
<a href="https://www.jetbrains.com/?from=new-api" target="_blank">
<a href="https://www.jetbrains.com/?from=heicode" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="120" />
</a>
</p>
<p align="center">
<strong>Thanks to <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> for providing free open-source development license for this project</strong>
<strong>Thanks to <a href="https://www.jetbrains.com/?from=heicode">JetBrains</a> for providing free open-source development license for this project</strong>
</p>
---
@@ -105,8 +105,8 @@
```bash
# Clone the project
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# Edit docker-compose.yml configuration
nano docker-compose.yml
@@ -120,22 +120,22 @@ docker-compose up -d
```bash
# Pull the latest image
docker pull calciumion/new-api:latest
docker pull calciumion/heicode:latest
# Using SQLite (default)
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
# Using MySQL
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 Tip:** `-v ./data:/data` will save data in the `data` folder of the current directory, you can also change it to an absolute path like `-v /your/custom/path:/data`
@@ -154,7 +154,7 @@ docker run --name new-api -d --restart always \
<div align="center">
### 📖 [Official Documentation](https://docs.newapi.pro/en/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api)
### 📖 [Official Documentation](https://docs.newapi.pro/en/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/heicode)
</div>
@@ -284,7 +284,7 @@ docker run --name new-api -d --restart always \
## 🚢 Deployment
> [!TIP]
> **Latest Docker image:** `calciumion/new-api:latest`
> **Latest Docker image:** `calciumion/heicode:latest`
### 📋 Deployment Requirements
@@ -311,12 +311,12 @@ docker run --name new-api -d --restart always \
| `AZURE_DEFAULT_API_VERSION` | Azure API version | `2025-04-01-preview` |
| `ERROR_LOG_ENABLED` | Error log switch | `false` |
| `PYROSCOPE_URL` | Pyroscope server address | - |
| `PYROSCOPE_APP_NAME` | Pyroscope application name | `new-api` |
| `PYROSCOPE_APP_NAME` | Pyroscope application name | `heicode` |
| `PYROSCOPE_BASIC_AUTH_USER` | Pyroscope basic auth user | - |
| `PYROSCOPE_BASIC_AUTH_PASSWORD` | Pyroscope basic auth password | - |
| `PYROSCOPE_MUTEX_RATE` | Pyroscope mutex sampling rate | `5` |
| `PYROSCOPE_BLOCK_RATE` | Pyroscope block sampling rate | `5` |
| `HOSTNAME` | Hostname tag for Pyroscope | `new-api` |
| `HOSTNAME` | Hostname tag for Pyroscope | `heicode` |
📖 **Complete configuration:** [Environment Variables Documentation](https://docs.newapi.pro/en/docs/installation/config-maintenance/environment-variables)
@@ -329,8 +329,8 @@ docker run --name new-api -d --restart always \
```bash
# Clone the project
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# Edit configuration
nano docker-compose.yml
@@ -346,21 +346,21 @@ docker-compose up -d
**Using SQLite:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
**Using MySQL:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 Path explanation:**
@@ -410,7 +410,7 @@ docker run --name new-api -d --restart always \
| Project | Description |
|------|------|
| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | Key quota query tool |
| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API high-performance optimized version |
| [heicode-horizon](https://github.com/Calcium-Ion/heicode-horizon) | New API high-performance optimized version |
---
@@ -440,7 +440,7 @@ Welcome all forms of contribution!
<div align="center">
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/new-api&type=Date)](https://star-history.com/#Calcium-Ion/new-api&Date)
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/heicode&type=Date)](https://star-history.com/#Calcium-Ion/heicode&Date)
</div>
@@ -452,7 +452,7 @@ Welcome all forms of contribution!
If this project is helpful to you, welcome to give us a ⭐️ Star!
**[Official Documentation](https://docs.newapi.pro/en/docs)** • **[Issue Feedback](https://github.com/Calcium-Ion/new-api/issues)** • **[Latest Release](https://github.com/Calcium-Ion/new-api/releases)**
**[Official Documentation](https://docs.newapi.pro/en/docs)** • **[Issue Feedback](https://github.com/Calcium-Ion/heicode/issues)** • **[Latest Release](https://github.com/Calcium-Ion/heicode/releases)**
<sub>Built with ❤️ by QuantumNous</sub>
+33 -33
View File
@@ -1,6 +1,6 @@
<div align="center">
![new-api](/web/default/public/logo.png)
![heicode](/web/default/public/logo.png)
# New API
@@ -15,29 +15,29 @@
</p>
<p align="center">
<a href="https://raw.githubusercontent.com/Calcium-Ion/new-api/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/new-api?color=brightgreen" alt="licence">
<a href="https://raw.githubusercontent.com/Calcium-Ion/heicode/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/heicode?color=brightgreen" alt="licence">
</a><!--
--><a href="https://github.com/Calcium-Ion/new-api/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/new-api?color=brightgreen&include_prereleases" alt="version">
--><a href="https://github.com/Calcium-Ion/heicode/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/heicode?color=brightgreen&include_prereleases" alt="version">
</a><!--
--><a href="https://hub.docker.com/r/CalciumIon/new-api">
--><a href="https://hub.docker.com/r/CalciumIon/heicode">
<img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker">
</a><!--
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/new-api">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard">
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/heicode">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/heicode" alt="GoReportCard">
</a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/20180" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fheicode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
<br>
<a href="https://hellogithub.com/repository/QuantumNous/new-api" target="_blank">
<a href="https://hellogithub.com/repository/QuantumNous/heicode" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=539ac4217e69431684ad4a0bab768811&claim_uid=tbFPfKIDHpc4TzR" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a><!--
--><a href="https://www.producthunt.com/products/new-api/launches/new-api?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-new-api" target="_blank" rel="noopener noreferrer">
--><a href="https://www.producthunt.com/products/heicode/launches/heicode?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-heicode" target="_blank" rel="noopener noreferrer">
<img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1047693&theme=light&t=1769577875005" alt="New API - All-in-one AI asset management gateway. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
</p>
@@ -93,13 +93,13 @@
## 🙏 Remerciements spéciaux
<p align="center">
<a href="https://www.jetbrains.com/?from=new-api" target="_blank">
<a href="https://www.jetbrains.com/?from=heicode" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="120" />
</a>
</p>
<p align="center">
<strong>Merci à <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> pour avoir fourni une licence de développement open-source gratuite pour ce projet</strong>
<strong>Merci à <a href="https://www.jetbrains.com/?from=heicode">JetBrains</a> pour avoir fourni une licence de développement open-source gratuite pour ce projet</strong>
</p>
---
@@ -110,8 +110,8 @@
```bash
# Cloner le projet
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# Modifier la configuration docker-compose.yml
nano docker-compose.yml
@@ -125,22 +125,22 @@ docker-compose up -d
```bash
# Tirer la dernière image
docker pull calciumion/new-api:latest
docker pull calciumion/heicode:latest
# Utilisation de SQLite (par défaut)
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
# Utilisation de MySQL
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 Astuce:** `-v ./data:/data` sauvegardera les données dans le dossier `data` du répertoire actuel, vous pouvez également le changer en chemin absolu comme `-v /your/custom/path:/data`
@@ -159,7 +159,7 @@ docker run --name new-api -d --restart always \
<div align="center">
### 📖 [Documentation officielle](https://docs.newapi.pro/en/docs) | [![Demander à DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api)
### 📖 [Documentation officielle](https://docs.newapi.pro/en/docs) | [![Demander à DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/heicode)
</div>
@@ -291,7 +291,7 @@ docker run --name new-api -d --restart always \
## 🚢 Déploiement
> [!TIP]
> **Dernière image Docker:** `calciumion/new-api:latest`
> **Dernière image Docker:** `calciumion/heicode:latest`
### 📋 Exigences de déploiement
@@ -318,12 +318,12 @@ docker run --name new-api -d --restart always \
| `AZURE_DEFAULT_API_VERSION` | Version de l'API Azure | `2025-04-01-preview` |
| `ERROR_LOG_ENABLED` | Interrupteur du journal d'erreurs | `false` |
| `PYROSCOPE_URL` | Adresse du serveur Pyroscope | - |
| `PYROSCOPE_APP_NAME` | Nom de l'application Pyroscope | `new-api` |
| `PYROSCOPE_APP_NAME` | Nom de l'application Pyroscope | `heicode` |
| `PYROSCOPE_BASIC_AUTH_USER` | Utilisateur Basic Auth Pyroscope | - |
| `PYROSCOPE_BASIC_AUTH_PASSWORD` | Mot de passe Basic Auth Pyroscope | - |
| `PYROSCOPE_MUTEX_RATE` | Taux d'échantillonnage mutex Pyroscope | `5` |
| `PYROSCOPE_BLOCK_RATE` | Taux d'échantillonnage block Pyroscope | `5` |
| `HOSTNAME` | Nom d'hôte tagué pour Pyroscope | `new-api` |
| `HOSTNAME` | Nom d'hôte tagué pour Pyroscope | `heicode` |
📖 **Configuration complète:** [Documentation des variables d'environnement](https://docs.newapi.pro/en/docs/installation/config-maintenance/environment-variables)
@@ -336,8 +336,8 @@ docker run --name new-api -d --restart always \
```bash
# Cloner le projet
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# Modifier la configuration
nano docker-compose.yml
@@ -353,21 +353,21 @@ docker-compose up -d
**Utilisation de SQLite:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
**Utilisation de MySQL:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 Explication du chemin:**
@@ -417,7 +417,7 @@ docker run --name new-api -d --restart always \
| Projet | Description |
|------|------|
| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | Outil de recherche de quota d'utilisation avec une clé |
| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | Version optimisée haute performance de New API |
| [heicode-horizon](https://github.com/Calcium-Ion/heicode-horizon) | Version optimisée haute performance de New API |
---
@@ -457,7 +457,7 @@ Si les politiques de votre organisation ne permettent pas l'utilisation de logic
<div align="center">
[![Graphique de l'historique des étoiles](https://api.star-history.com/svg?repos=Calcium-Ion/new-api&type=Date)](https://star-history.com/#Calcium-Ion/new-api&Date)
[![Graphique de l'historique des étoiles](https://api.star-history.com/svg?repos=Calcium-Ion/heicode&type=Date)](https://star-history.com/#Calcium-Ion/heicode&Date)
</div>
@@ -469,7 +469,7 @@ Si les politiques de votre organisation ne permettent pas l'utilisation de logic
Si ce projet vous est utile, bienvenue à nous donner une ⭐️ Étoile!
**[Documentation officielle](https://docs.newapi.pro/en/docs)** • **[Commentaires sur les problèmes](https://github.com/Calcium-Ion/new-api/issues)** • **[Dernière version](https://github.com/Calcium-Ion/new-api/releases)**
**[Documentation officielle](https://docs.newapi.pro/en/docs)** • **[Commentaires sur les problèmes](https://github.com/Calcium-Ion/heicode/issues)** • **[Dernière version](https://github.com/Calcium-Ion/heicode/releases)**
<sub>Construit avec ❤️ par QuantumNous</sub>
+33 -33
View File
@@ -1,6 +1,6 @@
<div align="center">
![new-api](/web/default/public/logo.png)
![heicode](/web/default/public/logo.png)
# New API
@@ -15,29 +15,29 @@
</p>
<p align="center">
<a href="https://raw.githubusercontent.com/Calcium-Ion/new-api/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/new-api?color=brightgreen" alt="license">
<a href="https://raw.githubusercontent.com/Calcium-Ion/heicode/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/heicode?color=brightgreen" alt="license">
</a><!--
--><a href="https://github.com/Calcium-Ion/new-api/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/new-api?color=brightgreen&include_prereleases" alt="release">
--><a href="https://github.com/Calcium-Ion/heicode/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/heicode?color=brightgreen&include_prereleases" alt="release">
</a><!--
--><a href="https://hub.docker.com/r/CalciumIon/new-api">
--><a href="https://hub.docker.com/r/CalciumIon/heicode">
<img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker">
</a><!--
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/new-api">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard">
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/heicode">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/heicode" alt="GoReportCard">
</a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/20180" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fheicode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
<br>
<a href="https://hellogithub.com/repository/QuantumNous/new-api" target="_blank">
<a href="https://hellogithub.com/repository/QuantumNous/heicode" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=539ac4217e69431684ad4a0bab768811&claim_uid=tbFPfKIDHpc4TzR" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a><!--
--><a href="https://www.producthunt.com/products/new-api/launches/new-api?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-new-api" target="_blank" rel="noopener noreferrer">
--><a href="https://www.producthunt.com/products/heicode/launches/heicode?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-heicode" target="_blank" rel="noopener noreferrer">
<img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1047693&theme=light&t=1769577875005" alt="New API - All-in-one AI asset management gateway. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
</p>
@@ -93,13 +93,13 @@
## 🙏 特別な感謝
<p align="center">
<a href="https://www.jetbrains.com/?from=new-api" target="_blank">
<a href="https://www.jetbrains.com/?from=heicode" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="120" />
</a>
</p>
<p align="center">
<strong>感謝 <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> が本プロジェクトに無料のオープンソース開発ライセンスを提供してくれたことに感謝します</strong>
<strong>感謝 <a href="https://www.jetbrains.com/?from=heicode">JetBrains</a> が本プロジェクトに無料のオープンソース開発ライセンスを提供してくれたことに感謝します</strong>
</p>
---
@@ -110,8 +110,8 @@
```bash
# プロジェクトをクローン
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# docker-compose.yml 設定を編集
nano docker-compose.yml
@@ -125,22 +125,22 @@ docker-compose up -d
```bash
# 最新のイメージをプル
docker pull calciumion/new-api:latest
docker pull calciumion/heicode:latest
# SQLiteを使用(デフォルト)
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
# MySQLを使用
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 ヒント:** `-v ./data:/data` は現在のディレクトリの `data` フォルダにデータを保存します。絶対パスに変更することもできます:`-v /your/custom/path:/data`
@@ -159,7 +159,7 @@ docker run --name new-api -d --restart always \
<div align="center">
### 📖 [公式ドキュメント](https://docs.newapi.pro/ja/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api)
### 📖 [公式ドキュメント](https://docs.newapi.pro/ja/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/heicode)
</div>
@@ -293,7 +293,7 @@ docker run --name new-api -d --restart always \
## 🚢 デプロイ
> [!TIP]
> **最新のDockerイメージ:** `calciumion/new-api:latest`
> **最新のDockerイメージ:** `calciumion/heicode:latest`
### 📋 デプロイ要件
@@ -320,12 +320,12 @@ docker run --name new-api -d --restart always \
| `AZURE_DEFAULT_API_VERSION` | Azure APIバージョン | `2025-04-01-preview` |
| `ERROR_LOG_ENABLED` | エラーログスイッチ | `false` |
| `PYROSCOPE_URL` | Pyroscopeサーバーのアドレス | - |
| `PYROSCOPE_APP_NAME` | Pyroscopeアプリ名 | `new-api` |
| `PYROSCOPE_APP_NAME` | Pyroscopeアプリ名 | `heicode` |
| `PYROSCOPE_BASIC_AUTH_USER` | Pyroscope Basic Authユーザー | - |
| `PYROSCOPE_BASIC_AUTH_PASSWORD` | Pyroscope Basic Authパスワード | - |
| `PYROSCOPE_MUTEX_RATE` | Pyroscope mutexサンプリング率 | `5` |
| `PYROSCOPE_BLOCK_RATE` | Pyroscope blockサンプリング率 | `5` |
| `HOSTNAME` | Pyroscope用のホスト名タグ | `new-api` |
| `HOSTNAME` | Pyroscope用のホスト名タグ | `heicode` |
📖 **完全な設定:** [環境変数ドキュメント](https://docs.newapi.pro/ja/docs/installation/config-maintenance/environment-variables)
@@ -338,8 +338,8 @@ docker run --name new-api -d --restart always \
```bash
# プロジェクトをクローン
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# 設定を編集
nano docker-compose.yml
@@ -355,21 +355,21 @@ docker-compose up -d
**SQLiteを使用:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
**MySQLを使用:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 パス説明:**
@@ -417,7 +417,7 @@ docker run --name new-api -d --restart always \
| プロジェクト | 説明 |
|------|------|
| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | キー使用量クォータ照会ツール |
| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API高性能最適化版 |
| [heicode-horizon](https://github.com/Calcium-Ion/heicode-horizon) | New API高性能最適化版 |
---
@@ -457,7 +457,7 @@ docker run --name new-api -d --restart always \
<div align="center">
[![スター履歴チャート](https://api.star-history.com/svg?repos=Calcium-Ion/new-api&type=Date)](https://star-history.com/#Calcium-Ion/new-api&Date)
[![スター履歴チャート](https://api.star-history.com/svg?repos=Calcium-Ion/heicode&type=Date)](https://star-history.com/#Calcium-Ion/heicode&Date)
</div>
@@ -469,7 +469,7 @@ docker run --name new-api -d --restart always \
このプロジェクトがあなたのお役に立てたなら、ぜひ ⭐️ スターをください!
**[公式ドキュメント](https://docs.newapi.pro/ja/docs)** • **[問題フィードバック](https://github.com/Calcium-Ion/new-api/issues)** • **[最新リリース](https://github.com/Calcium-Ion/new-api/releases)**
**[公式ドキュメント](https://docs.newapi.pro/ja/docs)** • **[問題フィードバック](https://github.com/Calcium-Ion/heicode/issues)** • **[最新リリース](https://github.com/Calcium-Ion/heicode/releases)**
<sub>❤️ で構築された QuantumNous</sub>
+33 -33
View File
@@ -1,6 +1,6 @@
<div align="center">
![new-api](/web/default/public/logo.png)
![heicode](/web/default/public/logo.png)
# New API
@@ -15,29 +15,29 @@
</p>
<p align="center">
<a href="https://raw.githubusercontent.com/Calcium-Ion/new-api/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/new-api?color=brightgreen" alt="license">
<a href="https://raw.githubusercontent.com/Calcium-Ion/heicode/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/heicode?color=brightgreen" alt="license">
</a><!--
--><a href="https://github.com/Calcium-Ion/new-api/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/new-api?color=brightgreen&include_prereleases" alt="release">
--><a href="https://github.com/Calcium-Ion/heicode/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/heicode?color=brightgreen&include_prereleases" alt="release">
</a><!--
--><a href="https://hub.docker.com/r/CalciumIon/new-api">
--><a href="https://hub.docker.com/r/CalciumIon/heicode">
<img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker">
</a><!--
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/new-api">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard">
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/heicode">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/heicode" alt="GoReportCard">
</a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/20180" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fheicode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
<br>
<a href="https://hellogithub.com/repository/QuantumNous/new-api" target="_blank">
<a href="https://hellogithub.com/repository/QuantumNous/heicode" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=539ac4217e69431684ad4a0bab768811&claim_uid=tbFPfKIDHpc4TzR" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a><!--
--><a href="https://www.producthunt.com/products/new-api/launches/new-api?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-new-api" target="_blank" rel="noopener noreferrer">
--><a href="https://www.producthunt.com/products/heicode/launches/heicode?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-heicode" target="_blank" rel="noopener noreferrer">
<img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1047693&theme=light&t=1769577875005" alt="New API - All-in-one AI asset management gateway. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
</p>
@@ -93,13 +93,13 @@
## 🙏 Special Thanks
<p align="center">
<a href="https://www.jetbrains.com/?from=new-api" target="_blank">
<a href="https://www.jetbrains.com/?from=heicode" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="120" />
</a>
</p>
<p align="center">
<strong>Thanks to <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> for providing free open-source development license for this project</strong>
<strong>Thanks to <a href="https://www.jetbrains.com/?from=heicode">JetBrains</a> for providing free open-source development license for this project</strong>
</p>
---
@@ -110,8 +110,8 @@
```bash
# Clone the project
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# Edit docker-compose.yml configuration
nano docker-compose.yml
@@ -125,22 +125,22 @@ docker-compose up -d
```bash
# Pull the latest image
docker pull calciumion/new-api:latest
docker pull calciumion/heicode:latest
# Using SQLite (default)
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
# Using MySQL
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 Tip:** `-v ./data:/data` will save data in the `data` folder of the current directory, you can also change it to an absolute path like `-v /your/custom/path:/data`
@@ -159,7 +159,7 @@ docker run --name new-api -d --restart always \
<div align="center">
### 📖 [Official Documentation](https://docs.newapi.pro/en/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api)
### 📖 [Official Documentation](https://docs.newapi.pro/en/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/heicode)
</div>
@@ -291,7 +291,7 @@ docker run --name new-api -d --restart always \
## 🚢 Deployment
> [!TIP]
> **Latest Docker image:** `calciumion/new-api:latest`
> **Latest Docker image:** `calciumion/heicode:latest`
### 📋 Deployment Requirements
@@ -318,12 +318,12 @@ docker run --name new-api -d --restart always \
| `AZURE_DEFAULT_API_VERSION` | Azure API version | `2025-04-01-preview` |
| `ERROR_LOG_ENABLED` | Error log switch | `false` |
| `PYROSCOPE_URL` | Pyroscope server address | - |
| `PYROSCOPE_APP_NAME` | Pyroscope application name | `new-api` |
| `PYROSCOPE_APP_NAME` | Pyroscope application name | `heicode` |
| `PYROSCOPE_BASIC_AUTH_USER` | Pyroscope basic auth user | - |
| `PYROSCOPE_BASIC_AUTH_PASSWORD` | Pyroscope basic auth password | - |
| `PYROSCOPE_MUTEX_RATE` | Pyroscope mutex sampling rate | `5` |
| `PYROSCOPE_BLOCK_RATE` | Pyroscope block sampling rate | `5` |
| `HOSTNAME` | Hostname tag for Pyroscope | `new-api` |
| `HOSTNAME` | Hostname tag for Pyroscope | `heicode` |
📖 **Complete configuration:** [Environment Variables Documentation](https://docs.newapi.pro/en/docs/installation/config-maintenance/environment-variables)
@@ -336,8 +336,8 @@ docker run --name new-api -d --restart always \
```bash
# Clone the project
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# Edit configuration
nano docker-compose.yml
@@ -353,21 +353,21 @@ docker-compose up -d
**Using SQLite:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
**Using MySQL:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 Path explanation:**
@@ -417,7 +417,7 @@ docker run --name new-api -d --restart always \
| Project | Description |
|------|------|
| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | Key quota query tool |
| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API high-performance optimized version |
| [heicode-horizon](https://github.com/Calcium-Ion/heicode-horizon) | New API high-performance optimized version |
---
@@ -457,7 +457,7 @@ If your organization's policies do not permit the use of AGPLv3-licensed softwar
<div align="center">
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/new-api&type=Date)](https://star-history.com/#Calcium-Ion/new-api&Date)
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/heicode&type=Date)](https://star-history.com/#Calcium-Ion/heicode&Date)
</div>
@@ -469,7 +469,7 @@ If your organization's policies do not permit the use of AGPLv3-licensed softwar
If this project is helpful to you, welcome to give us a ⭐️ Star!
**[Official Documentation](https://docs.newapi.pro/en/docs)** • **[Issue Feedback](https://github.com/Calcium-Ion/new-api/issues)** • **[Latest Release](https://github.com/Calcium-Ion/new-api/releases)**
**[Official Documentation](https://docs.newapi.pro/en/docs)** • **[Issue Feedback](https://github.com/Calcium-Ion/heicode/issues)** • **[Latest Release](https://github.com/Calcium-Ion/heicode/releases)**
<sub>Built with ❤️ by QuantumNous</sub>
@@ -1,6 +1,6 @@
# Heicode Manager(源码目录 `new-api`)
# Heicode Manager(源码目录 `heicode`)
本目录实现 **Heicode Manager**:网关与管理控制台(账号、渠道、模型策略、计费等)。目录名 `new-api` 为历史工程名;对外产品与文档统一称 **Heicode Manager**。目标是支撑 **Heicode 客户端**「浏览器登录后即用模型」。
本目录实现 **Heicode Manager**:网关与管理控制台(账号、渠道、模型策略、计费等)。目录名 `heicode` 为历史工程名;对外产品与文档统一称 **Heicode Manager**。目标是支撑 **Heicode 客户端**「浏览器登录后即用模型」。
## 本仓库角色
@@ -30,7 +30,7 @@
## 快速运行(本地 Docker)
```bash
cd new-api
cd heicode
docker compose -f docker-compose.yml -f docker-compose.override.yml up --build -d
```
@@ -38,7 +38,7 @@ docker compose -f docker-compose.yml -f docker-compose.override.yml up --build -
```bash
docker compose ps
docker compose logs -f new-api
docker compose logs -f heicode
```
默认访问地址:`http://localhost:3000`
@@ -67,4 +67,4 @@ docker compose logs -f new-api
## 许可证与来源
本工程在开源网关上游基础上演进(目录名 `new-api` 仅为历史路径),遵循对应许可证要求。企业使用前请完成内部合规审查。
本工程在开源网关上游基础上演进(目录名 `heicode` 仅为历史路径),遵循对应许可证要求。企业使用前请完成内部合规审查。
@@ -1,6 +1,6 @@
<div align="center">
![new-api](/web/default/public/logo.png)
![heicode](/web/default/public/logo.png)
# New API
@@ -15,29 +15,29 @@
</p>
<p align="center">
<a href="https://raw.githubusercontent.com/Calcium-Ion/new-api/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/new-api?color=brightgreen" alt="license">
<a href="https://raw.githubusercontent.com/Calcium-Ion/heicode/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/heicode?color=brightgreen" alt="license">
</a><!--
--><a href="https://github.com/Calcium-Ion/new-api/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/new-api?color=brightgreen&include_prereleases" alt="release">
--><a href="https://github.com/Calcium-Ion/heicode/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/heicode?color=brightgreen&include_prereleases" alt="release">
</a><!--
--><a href="https://hub.docker.com/r/CalciumIon/new-api">
--><a href="https://hub.docker.com/r/CalciumIon/heicode">
<img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker">
</a><!--
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/new-api">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard">
--><a href="https://goreportcard.com/report/github.com/Calcium-Ion/heicode">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/heicode" alt="GoReportCard">
</a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/20180" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fheicode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
<br>
<a href="https://hellogithub.com/repository/QuantumNous/new-api" target="_blank">
<a href="https://hellogithub.com/repository/QuantumNous/heicode" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=539ac4217e69431684ad4a0bab768811&claim_uid=tbFPfKIDHpc4TzR" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a><!--
--><a href="https://www.producthunt.com/products/new-api/launches/new-api?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-new-api" target="_blank" rel="noopener noreferrer">
--><a href="https://www.producthunt.com/products/heicode/launches/heicode?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-heicode" target="_blank" rel="noopener noreferrer">
<img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1047693&theme=light&t=1769577875005" alt="New API - All-in-one AI asset management gateway. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
</p>
@@ -93,13 +93,13 @@
## 🙏 特别鸣谢
<p align="center">
<a href="https://www.jetbrains.com/?from=new-api" target="_blank">
<a href="https://www.jetbrains.com/?from=heicode" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="120" />
</a>
</p>
<p align="center">
<strong>感谢 <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> 为本项目提供免费的开源开发许可证</strong>
<strong>感谢 <a href="https://www.jetbrains.com/?from=heicode">JetBrains</a> 为本项目提供免费的开源开发许可证</strong>
</p>
---
@@ -110,8 +110,8 @@
```bash
# 克隆项目
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# 编辑 docker-compose.yml 配置
nano docker-compose.yml
@@ -125,22 +125,22 @@ docker-compose up -d
```bash
# 拉取最新镜像
docker pull calciumion/new-api:latest
docker pull calciumion/heicode:latest
# 使用 SQLite(默认)
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
# 使用 MySQL
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 提示:** `-v ./data:/data` 会将数据保存在当前目录的 `data` 文件夹中,你也可以改为绝对路径如 `-v /your/custom/path:/data`
@@ -159,7 +159,7 @@ docker run --name new-api -d --restart always \
<div align="center">
### 📖 [官方文档](https://docs.newapi.pro/zh/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api)
### 📖 [官方文档](https://docs.newapi.pro/zh/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/heicode)
</div>
@@ -291,7 +291,7 @@ docker run --name new-api -d --restart always \
## 🚢 部署
> [!TIP]
> **最新版 Docker 镜像:** `calciumion/new-api:latest`
> **最新版 Docker 镜像:** `calciumion/heicode:latest`
### 📋 部署要求
@@ -318,12 +318,12 @@ docker run --name new-api -d --restart always \
| `AZURE_DEFAULT_API_VERSION` | Azure API 版本 | `2025-04-01-preview` |
| `ERROR_LOG_ENABLED` | 错误日志开关 | `false` |
| `PYROSCOPE_URL` | Pyroscope 服务地址 | - |
| `PYROSCOPE_APP_NAME` | Pyroscope 应用名 | `new-api` |
| `PYROSCOPE_APP_NAME` | Pyroscope 应用名 | `heicode` |
| `PYROSCOPE_BASIC_AUTH_USER` | Pyroscope Basic Auth 用户名 | - |
| `PYROSCOPE_BASIC_AUTH_PASSWORD` | Pyroscope Basic Auth 密码 | - |
| `PYROSCOPE_MUTEX_RATE` | Pyroscope mutex 采样率 | `5` |
| `PYROSCOPE_BLOCK_RATE` | Pyroscope block 采样率 | `5` |
| `HOSTNAME` | Pyroscope 标签里的主机名 | `new-api` |
| `HOSTNAME` | Pyroscope 标签里的主机名 | `heicode` |
📖 **完整配置:** [环境变量文档](https://docs.newapi.pro/zh/docs/installation/config-maintenance/environment-variables)
@@ -336,8 +336,8 @@ docker run --name new-api -d --restart always \
```bash
# 克隆项目
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# 编辑配置
nano docker-compose.yml
@@ -353,21 +353,21 @@ docker-compose up -d
**使用 SQLite:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
**使用 MySQL:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 路径说明:**
@@ -417,7 +417,7 @@ docker run --name new-api -d --restart always \
| 项目 | 说明 |
|------|------|
| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | Key 额度查询工具 |
| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API 高性能优化版 |
| [heicode-horizon](https://github.com/Calcium-Ion/heicode-horizon) | New API 高性能优化版 |
---
@@ -457,7 +457,7 @@ docker run --name new-api -d --restart always \
<div align="center">
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/new-api&type=Date)](https://star-history.com/#Calcium-Ion/new-api&Date)
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/heicode&type=Date)](https://star-history.com/#Calcium-Ion/heicode&Date)
</div>
@@ -469,7 +469,7 @@ docker run --name new-api -d --restart always \
如果这个项目对你有帮助,欢迎给我们一个 ⭐️ Star!
**[官方文档](https://docs.newapi.pro/zh/docs)** • **[问题反馈](https://github.com/Calcium-Ion/new-api/issues)** • **[最新发布](https://github.com/Calcium-Ion/new-api/releases)**
**[官方文档](https://docs.newapi.pro/zh/docs)** • **[问题反馈](https://github.com/Calcium-Ion/heicode/issues)** • **[最新发布](https://github.com/Calcium-Ion/heicode/releases)**
<sub>Built with ❤️ by QuantumNous</sub>
@@ -1,6 +1,6 @@
<div align="center">
![new-api](/web/default/public/logo.png)
![heicode](/web/default/public/logo.png)
# New API
@@ -15,29 +15,29 @@
</p>
<p align="center">
<a href="https://raw.githubusercontent.com/Calcium-Ion/new-api/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/new-api?color=brightgreen" alt="license">
<a href="https://raw.githubusercontent.com/Calcium-Ion/heicode/main/LICENSE">
<img src="https://img.shields.io/github/license/Calcium-Ion/heicode?color=brightgreen" alt="license">
</a>
<a href="https://github.com/Calcium-Ion/new-api/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/new-api?color=brightgreen&include_prereleases" alt="release">
<a href="https://github.com/Calcium-Ion/heicode/releases/latest">
<img src="https://img.shields.io/github/v/release/Calcium-Ion/heicode?color=brightgreen&include_prereleases" alt="release">
</a>
<a href="https://hub.docker.com/r/CalciumIon/new-api">
<a href="https://hub.docker.com/r/CalciumIon/heicode">
<img src="https://img.shields.io/badge/docker-dockerHub-blue" alt="docker">
</a>
<a href="https://goreportcard.com/report/github.com/Calcium-Ion/new-api">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard">
<a href="https://goreportcard.com/report/github.com/Calcium-Ion/heicode">
<img src="https://goreportcard.com/badge/github.com/Calcium-Ion/heicode" alt="GoReportCard">
</a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/20180" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fnew-api | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
<img src="https://trendshift.io/api/badge/repositories/20180" alt="QuantumNous%2Fheicode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
<br>
<a href="https://hellogithub.com/repository/QuantumNous/new-api" target="_blank">
<a href="https://hellogithub.com/repository/QuantumNous/heicode" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=539ac4217e69431684ad4a0bab768811&claim_uid=tbFPfKIDHpc4TzR" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
<a href="https://www.producthunt.com/products/new-api/launches/new-api?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-new-api" target="_blank" rel="noopener noreferrer">
<a href="https://www.producthunt.com/products/heicode/launches/heicode?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-heicode" target="_blank" rel="noopener noreferrer">
<img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1047693&theme=light&t=1769577875005" alt="New API - All-in-one AI asset management gateway. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
</p>
@@ -93,13 +93,13 @@
## 🙏 特別鳴謝
<p align="center">
<a href="https://www.jetbrains.com/?from=new-api" target="_blank">
<a href="https://www.jetbrains.com/?from=heicode" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="120" />
</a>
</p>
<p align="center">
<strong>感謝 <a href="https://www.jetbrains.com/?from=new-api">JetBrains</a> 為本項目提供免費的開源開發許可證</strong>
<strong>感謝 <a href="https://www.jetbrains.com/?from=heicode">JetBrains</a> 為本項目提供免費的開源開發許可證</strong>
</p>
---
@@ -110,8 +110,8 @@
```bash
# 複製項目
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# 編輯 docker-compose.yml 配置
nano docker-compose.yml
@@ -125,22 +125,22 @@ docker-compose up -d
```bash
# 拉取最新鏡像
docker pull calciumion/new-api:latest
docker pull calciumion/heicode:latest
# 使用 SQLite(預設)
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
# 使用 MySQL
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 提示:** `-v ./data:/data` 會將數據保存在當前目錄的 `data` 資料夾中,你也可以改為絕對路徑如 `-v /your/custom/path:/data`
@@ -159,7 +159,7 @@ docker run --name new-api -d --restart always \
<div align="center">
### 📖 [官方文件](https://docs.newapi.pro/zh/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/new-api)
### 📖 [官方文件](https://docs.newapi.pro/zh/docs) | [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QuantumNous/heicode)
</div>
@@ -291,7 +291,7 @@ docker run --name new-api -d --restart always \
## 🚢 部署
> [!TIP]
> **最新版 Docker 鏡像:** `calciumion/new-api:latest`
> **最新版 Docker 鏡像:** `calciumion/heicode:latest`
### 📋 部署要求
@@ -318,12 +318,12 @@ docker run --name new-api -d --restart always \
| `AZURE_DEFAULT_API_VERSION` | Azure API 版本 | `2025-04-01-preview` |
| `ERROR_LOG_ENABLED` | 錯誤日誌開關 | `false` |
| `PYROSCOPE_URL` | Pyroscope 服務位址 | - |
| `PYROSCOPE_APP_NAME` | Pyroscope 應用名 | `new-api` |
| `PYROSCOPE_APP_NAME` | Pyroscope 應用名 | `heicode` |
| `PYROSCOPE_BASIC_AUTH_USER` | Pyroscope Basic Auth 用戶名 | - |
| `PYROSCOPE_BASIC_AUTH_PASSWORD` | Pyroscope Basic Auth 密碼 | - |
| `PYROSCOPE_MUTEX_RATE` | Pyroscope mutex 採樣率 | `5` |
| `PYROSCOPE_BLOCK_RATE` | Pyroscope block 採樣率 | `5` |
| `HOSTNAME` | Pyroscope 標籤裡的主機名 | `new-api` |
| `HOSTNAME` | Pyroscope 標籤裡的主機名 | `heicode` |
📖 **完整配置:** [環境變數文件](https://docs.newapi.pro/zh/docs/installation/config-maintenance/environment-variables)
@@ -336,8 +336,8 @@ docker run --name new-api -d --restart always \
```bash
# 複製項目
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git clone https://github.com/QuantumNous/heicode.git
cd heicode
# 編輯配置
nano docker-compose.yml
@@ -353,21 +353,21 @@ docker-compose up -d
**使用 SQLite:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
**使用 MySQL:**
```bash
docker run --name new-api -d --restart always \
docker run --name heicode -d --restart always \
-p 3000:3000 \
-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" \
-e TZ=Asia/Shanghai \
-v ./data:/data \
calciumion/new-api:latest
calciumion/heicode:latest
```
> **💡 路徑說明:**
@@ -417,7 +417,7 @@ docker run --name new-api -d --restart always \
| 項目 | 說明 |
|------|------|
| [neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool) | Key 額度查詢工具 |
| [new-api-horizon](https://github.com/Calcium-Ion/new-api-horizon) | New API 高性能優化版 |
| [heicode-horizon](https://github.com/Calcium-Ion/heicode-horizon) | New API 高性能優化版 |
---
@@ -457,7 +457,7 @@ docker run --name new-api -d --restart always \
<div align="center">
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/new-api&type=Date)](https://star-history.com/#Calcium-Ion/new-api&Date)
[![Star History Chart](https://api.star-history.com/svg?repos=Calcium-Ion/heicode&type=Date)](https://star-history.com/#Calcium-Ion/heicode&Date)
</div>
@@ -469,7 +469,7 @@ docker run --name new-api -d --restart always \
如果這個項目對你有幫助,歡迎給我們一個 ⭐️ Star!
**[官方文件](https://docs.newapi.pro/zh/docs)** • **[問題回饋](https://github.com/Calcium-Ion/new-api/issues)** • **[最新發布](https://github.com/Calcium-Ion/new-api/releases)**
**[官方文件](https://docs.newapi.pro/zh/docs)** • **[問題回饋](https://github.com/Calcium-Ion/heicode/issues)** • **[最新發布](https://github.com/Calcium-Ion/heicode/releases)**
<sub>Built with ❤️ by QuantumNous</sub>
View File
@@ -2,7 +2,7 @@
set -euo pipefail
# Local executable acceptance for Agnet integration matrix.
# Requires an authenticated admin cookie from new-api dashboard.
# Requires an authenticated admin cookie from heicode dashboard.
#
# Example:
# AUTH_COOKIE="session=xxxx" BASE_URL="http://localhost:3000" ./bin/acceptance_agnet_local.sh
@@ -8,13 +8,13 @@ set -euo pipefail
# - project already synced to VM path
#
# Example:
# VM_HOST=20.1.2.3 VM_USER=azureuser REMOTE_DIR=/opt/heicode/new-api \
# IMAGE_TAG=new-api-heicode:local ./bin/azure_vm_deploy.sh
# VM_HOST=20.1.2.3 VM_USER=azureuser REMOTE_DIR=/opt/heicode/heicode \
# IMAGE_TAG=heicode-manager:local ./bin/azure_vm_deploy.sh
VM_HOST="${VM_HOST:-}"
VM_USER="${VM_USER:-azureuser}"
REMOTE_DIR="${REMOTE_DIR:-/opt/heicode/new-api}"
IMAGE_TAG="${IMAGE_TAG:-new-api-heicode:local}"
REMOTE_DIR="${REMOTE_DIR:-/opt/heicode/heicode}"
IMAGE_TAG="${IMAGE_TAG:-heicode-manager:local}"
HEALTH_URL="${HEALTH_URL:-http://127.0.0.1:3000/api/status}"
SSH_OPTS="${SSH_OPTS:-}"
@@ -33,7 +33,7 @@ echo "image=${IMAGE_TAG}"
# Persist previous image for rollback.
${SSH} "cd '${REMOTE_DIR}' && \
PREV=\$(docker inspect --format='{{.Config.Image}}' new-api 2>/dev/null || true) && \
PREV=\$(docker inspect --format='{{.Config.Image}}' heicode 2>/dev/null || true) && \
echo \"\${PREV}\" > .last_success_image && \
echo \"last_success_image=\${PREV}\""
@@ -1,6 +1,6 @@
package common
import "github.com/QuantumNous/new-api/constant"
import "github.com/heicode/manager/constant"
func ChannelType2APIType(channelType int) (int, bool) {
apiType := -1
@@ -18,7 +18,7 @@ const (
)
// 统一的缓存目录名
const diskCacheDir = "new-api-body-cache"
const diskCacheDir = "heicode-body-cache"
// GetDiskCacheDir 获取统一的磁盘缓存目录
// 注意:每次调用都会重新计算,以响应配置变化
@@ -1,6 +1,6 @@
package common
import "github.com/QuantumNous/new-api/constant"
import "github.com/heicode/manager/constant"
// EndpointInfo 描述单个端点的默认请求信息
// path: 上游路径
@@ -1,6 +1,6 @@
package common
import "github.com/QuantumNous/new-api/constant"
import "github.com/heicode/manager/constant"
// GetEndpointTypesByChannelType 获取渠道最优先端点类型(所有的渠道都支持 OpenAI 端点)
func GetEndpointTypesByChannelType(channelType int, modelName string) []constant.EndpointType {
@@ -11,7 +11,7 @@ import (
"strings"
"time"
"github.com/QuantumNous/new-api/constant"
"github.com/heicode/manager/constant"
"github.com/pkg/errors"
"github.com/gin-gonic/gin"
@@ -11,7 +11,7 @@ import (
"strings"
"time"
"github.com/QuantumNous/new-api/constant"
"github.com/heicode/manager/constant"
)
var (
@@ -22,10 +22,10 @@ var (
)
func printHelp() {
fmt.Println("NewAPI(Based OneAPI) " + Version + " - The next-generation LLM gateway and AI asset management system supports multiple languages.")
fmt.Println("Original Project: OneAPI by JustSong - https://github.com/songquanpeng/one-api")
fmt.Println("Maintainer: QuantumNous - https://github.com/QuantumNous/new-api")
fmt.Println("Usage: newapi [--port <port>] [--log-dir <log directory>] [--version] [--help]")
fmt.Println("Heicode Manager " + Version + " — gateway and admin console (upstream lineage: One API / new-api fork).")
fmt.Println("Original lineage: OneAPI by JustSong — https://github.com/songquanpeng/one-api")
fmt.Println("Maintainer: Heicode — https://github.com/heicode/manager")
fmt.Println("Usage: heicode [--port <port>] [--log-dir <log directory>] [--version] [--help]")
}
func InitEnv() {
@@ -6,7 +6,7 @@ import (
"fmt"
"sync"
"github.com/QuantumNous/new-api/common"
"github.com/heicode/manager/common"
"github.com/go-redis/redis/v8"
)
@@ -13,10 +13,10 @@ func StartPyroScope() error {
return nil
}
pyroscopeAppName := GetEnvOrDefaultString("PYROSCOPE_APP_NAME", "new-api")
pyroscopeAppName := GetEnvOrDefaultString("PYROSCOPE_APP_NAME", "heicode")
pyroscopeBasicAuthUser := GetEnvOrDefaultString("PYROSCOPE_BASIC_AUTH_USER", "")
pyroscopeBasicAuthPassword := GetEnvOrDefaultString("PYROSCOPE_BASIC_AUTH_PASSWORD", "")
pyroscopeHostname := GetEnvOrDefaultString("HOSTNAME", "new-api")
pyroscopeHostname := GetEnvOrDefaultString("HOSTNAME", "heicode")
mutexRate := GetEnvOrDefault("PYROSCOPE_MUTEX_RATE", 5)
blockRate := GetEnvOrDefault("PYROSCOPE_BLOCK_RATE", 5)

Some files were not shown because too many files have changed in this diff Show More