ccx / backend-go
CLAUDE.md4k starsChanged 2 months agoMITView on GitHub
Go 后端核心服务:HTTP API、多上游适配、协议转换、多渠道调度、会话管理、指标与日志记录、配置热重载。 说明:实际命令以 backend-go/Makefile 为准。 所有日志输出使用 [Component-Action] 标签格式,禁止使用 emoji。 渠道日志模型定义于 internal/metrics/channel_log.go。 关键字段包括: - status - statusCode - requestSource - interfaceType - baseUrl - keyMask 对于 Images 渠道,还会额外记录: - operation:generations / edits / variations
Trending
Quiet since September.thin dataabout the whole repository
Who's talking about BenedictKing/ccx
- Soju06/codex-lb“bug: compaction fails”GitHub · Jun 13, 2026 · 2 reactions
- AppImage/appimage.github.io“Add -_CCX”GitHub · Sep 27, 2026
- Phala-Network/phala-cloud“feat: add ccx template”GitHub · May 30, 2026
The biggest 3 of 3 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- desktop/CLAUDE.mdCLAUDE.md
- frontend/CLAUDE.mdCLAUDE.md
- github-releaseSkill
- model-updateSkill
- store-updateSkill
- upstream-checkSkill
- version-bumpSkill
The file
Files
backend-go 模块文档
← 根目录
模块职责
Go 后端核心服务:HTTP API、多上游适配、协议转换、多渠道调度、会话管理、指标与日志记录、配置热重载。
启动命令
make dev
make run
make build
make test
make test-cover
make fmt
make lint
make deps说明:实际命令以 backend-go/Makefile 为准。
API 总览
代理入口
GET /healthPOST /v1/messagesPOST /v1/messages/count_tokensPOST /v1/chat/completionsPOST /v1/responsesPOST /v1/responses/compactGET /v1/modelsGET /v1/models/:modelPOST /v1beta/models/{model}:generateContentPOST /v1/images/generationsPOST /v1/images/editsPOST /v1/images/variationsPOST /v1/embeddings
管理入口
/api/messages/channels/*/api/chat/channels/*/api/responses/channels/*/api/gemini/channels/*/api/images/channels/*/api/vectors/channels/*
能力测试
能力测试接口仅适用于 messages、chat、responses、gemini。
Images 与 Vectors 当前没有 capability-test / snapshot 路由。
关键实现点
渠道类型
当前正式支持六类渠道:
messageschatresponsesgeminiimagesvectors
Provider 接口
所有上游服务实现 internal/providers/Provider 接口:
type Provider interface {
ConvertToProviderRequest(c *gin.Context, upstream *config.UpstreamConfig, apiKey string) (*http.Request, []byte, error)
ConvertToClaudeResponse(providerResp *types.ProviderResponse) (*types.ClaudeResponse, error)
HandleStreamResponse(body io.ReadCloser) (<-chan string, <-chan error, error)
}核心模块
| 模块 | 职责 |
internal/handlers/ | 代理与管理接口处理器 |
internal/providers/ | 上游适配 |
internal/converters/ | Responses 协议转换 |
internal/scheduler/ | 多渠道调度 |
internal/session/ | 会话与 Trace 亲和性 |
internal/config/ | 配置管理与热重载 |
internal/metrics/ | 指标、日志、持久化 |
日志规范
所有日志输出使用 [Component-Action] 标签格式,禁止使用 emoji。
log.Printf("[Component-Action] 消息内容: %v", value)Channels logs
渠道日志模型定义于 internal/metrics/channel_log.go。
关键字段包括:
statusstatusCoderequestSourceinterfaceTypebaseUrlkeyMask
对于 Images 渠道,还会额外记录:
operation:generations/edits/variations
扩展指南
添加新上游能力
- 在
internal/providers/中新增或扩展 provider - 在需要时补充
internal/converters/的协议转换 - 接入对应 handler、调度与前端配置
- 将指标、日志与模型过滤纳入统一链路
调整调度逻辑
- 修改
internal/scheduler/ - 如涉及熔断、恢复或日志,联动检查
internal/metrics/ - 调度优先级链路(Override → Promotion → Trace 亲和 → 优先级排序 → 降级)说明见 README.md#调度优先级链路
文档导航
- ../README.md - 项目入口
- README.md - 后端专项文档
- ../docs/guide/architecture.md - 架构说明
- ../docs/guide/development.md - 开发指南
- ../docs/guide/release.md - 发布流程
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

