Hacker News 中文摘要

RSS订阅

展示 HN:GoModel —— 一个用 Go 编写的开源 AI 网关 -- Show HN: GoModel – an open-source AI gateway in Go

文章摘要

GoModel是一个用Go语言编写的高性能AI网关,提供统一的OpenAI兼容API,支持OpenAI、Anthropic、Gemini、Groq、xAI和Ollama等多种AI服务。它是LiteLLM的替代方案,具备可观测性、防护机制和流式处理功能。

文章总结

GoModel - 基于Go语言的高性能AI网关

项目概述
GoModel是一个用Go语言编写的高性能AI网关,提供统一的OpenAI兼容API,支持OpenAI、Anthropic、Gemini、Groq、xAI、Ollama等多种AI服务。作为LiteLLM的替代方案,具备可观测性、安全护栏和流式传输功能。

核心功能
1. 统一API接口
- 兼容OpenAI API规范,支持聊天补全、嵌入、文件操作等端点 - 提供/responses生命周期管理端点 - 支持供应商原生API透传路由(/p/{provider}/...

  1. 多供应商支持
    | 供应商 | 认证方式 | 示例模型 | |--------------|---------------------------|------------------------| | OpenAI | OPENAI_API_KEY | gpt-4o-mini | | Anthropic | ANTHROPIC_API_KEY | claude-sonnet-4 | | Google Gemini| GEMINI_API_KEY | gemini-2.5-flash |

  2. 智能缓存系统

    • 精确匹配缓存:毫秒级响应重复请求
    • 语义缓存:通过向量搜索处理语义相似查询(支持Qdrant/PGVector等后端)
  3. 管理功能

    • 实时用量统计与成本估算仪表盘
    • 审计日志和工作流追踪
    • 可配置的速率限制和访问策略

快速部署
shell docker run --rm -p 8080:8080 \ -e OPENAI_API_KEY="your-key" \ -e ANTHROPIC_API_KEY="your-key" \ enterpilot/gomodel

技术特性
- 支持Prometheus指标监控 - 提供Swagger UI文档 - 多存储后端支持(SQLite/PostgreSQL/MongoDB) - 模块化架构设计

路线图
- 增强智能路由功能 - 扩展供应商支持(Cohere/DeepSeek等) - 完善预算管理系统 - 集群模式开发

社区资源
- 在线文档 - Discord社区 - MIT开源协议

该项目已获得250+星标,由ENTERPILOT团队维护,最新版本v0.1.19发布于2026年4月。

评论总结

以下是评论内容的总结:

1. 与其他路由器的比较

部分用户质疑该工具相比成熟路由器(如Bifrost)的优势,要求提供性能基准。
- "I don't see any significant advantage over mature routers like Bifrost. Are there even any benchmarks?" (rvz)
- "how does this compare to bifrost - another golang router?" (anilgulecha)

2. 技术实现细节

用户关注语义缓存层的工作原理、本地模型集成和统一API的实现。
- "are you embedding requests on the gateway side and doing a vector similarity lookup before proxying?" (Talderigi)
- "how would I implement that in gomodel?" (driese)
- "Does this have a unified API?" (mosselman)

3. 实用性与需求

用户肯定项目的实用性,特别是模型切换和成本跟踪功能,并提出具体需求。
- "The biggest pain point has been exactly what you describe: switching models without changing app code." (tahosin)
- "One thing I'd love to see is built-in cost tracking per model/route." (tahosin)

4. 语言选择与供应链安全

用户赞赏使用Go语言的选择,认为编译型语言更安全。
- "we need more alternatives in compiled languages." (pjmlp)
- "golang is interesting for the gateway is having clear control of the supply chain at compile time." (crawdog)

5. 维护与治理挑战

用户提出维护更新速度和治理(如日志记录、威胁缓解)是主要挑战。
- "if there is a not a < 24 hour turn around for new model integration the project is not properly maintained." (pizzafeelsright)
- "Governance is the biggest concern at this point - with proper logging, and integration to 3rd party services." (pizzafeelsright)

6. 开源与长期承诺

用户询问项目是否会像其他开源项目一样突然停止维护。
- "are you also planning on doing an open-source rug pull like so many projects out there?" (mosselman)

7. 行业现象讨论

用户讨论这类兼容层库是否是临时现象,认为供应商应统一API。
- "It strikes me as weird that providers haven't settled on a single API by now." (sowbug)

8. 其他Go工具推荐

用户分享其他满意的Go语言AI工具,并请求支持订阅服务。
- "Any other Go-based AI / LLM tools folks are happy with?" (nzoschke)
- "I'll second the request to add support for harnesses with subscriptions." (nzoschke)

9. 上游更新维护

用户询问如何跟上API供应商的更新变化。
- "How do you plan on keeping up with upstream changes from the API providers?" (glerk)