메뉴
HN
Hacker News 39일 전

Go 기반 오픈소스 AI 게이트웨이 'GoModel' 공개

IMP
7/10
핵심 요약

Go 언어로 작성된 고성능 오픈소스 AI 게이트웨이인 GoModel이 공개되었습니다. 이 도구는 OpenAI, Anthropic, 구글 Gemini 등 다양한 LLM 제공업체의 API를 단일 OpenAI 호환 인터페이스로 통합해줍니다. 특히 기존 유사 도구인 LiteLLM보다 44배 더 가볍게 설계되어 가볍고 빠른 서비스 연동이 필요한 실무 환경에서 유용하게 활용할 수 있습니다.

번역된 본문

GoModel - Go로 작성된 AI 게이트웨이 Go로 작성된 고성능 AI 게이트웨이로, OpenAI, Anthropic, Gemini, xAI, Groq, OpenRouter, Z.ai, Azure OpenAI, Oracle, Ollama 등을 위한 통합된 OpenAI 호환 API를 제공합니다.

빠른 시작 - AI 게이트웨이 배포하기 1단계: GoModel 시작하기 docker run --rm -p 8080:8080
-e LOGGING_ENABLED=true
-e LOGGING_LOG_BODIES=true
-e LOG_FORMAT=text
-e LOGGING_LOG_HEADERS=true
-e OPENAI_API_KEY="your-openai-key"
enterpilot/gomodel

필요한 제공업체의 자격 증명(Credential) 또는 베이스 URL만 전달하세요 (최소 1개 필요): docker run --rm -p 8080:8080
-e OPENAI_API_KEY="your-openai-key"
-e ANTHROPIC_API_KEY="your-anthropic-key"
-e GEMINI_API_KEY="your-gemini-key"
-e GROQ_API_KEY="your-groq-key"
-e OPENROUTER_API_KEY="your-openrouter-key"
-e ZAI_API_KEY="your-zai-key"
-e XAI_API_KEY="your-xai-key"
-e AZURE_API_KEY="your-azure-key"
-e AZURE_BASE_URL="https://your-resource.openai.azure.com/openai/deployments/your-deployment"
-e AZURE_API_VERSION="2024-10-21"
-e ORACLE_API_KEY="your-oracle-key"
-e ORACLE_BASE_URL="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/v1"
-e ORACLE_MODELS="openai.gpt-oss-120b,xai.grok-3"
-e OLLAMA_BASE_URL="http://host.docker.internal:11434/v1"
enterpilot/gomodel

⚠️ 명령줄의 -e 옵션을 통해 비밀 키(Secrets)를 직접 전달하는 것은 피하세요. 셸 기록(Shell history)이나 프로세스 목록을 통해 유출될 수 있습니다. 상용(Production) 환경에서는 대신 docker run --env-file .env를 사용하여 파일에서 API 키를 로드하세요.

2단계: 첫 API 호출하기 curl http://localhost:8080/v1/chat/completions
-H "Content-Type: application/json"
-d '{ "model": "gpt-5-chat-latest", "messages": [{"role": "user", "content": "Hello!"}] }'

끝입니다! GoModel은 제공된 자격 증명을 기반으로 사용 가능한 제공업체를 자동으로 감지합니다.

지원되는 LLM 제공업체 예시 모델 식별자는 설명을 위한 것이며 변경될 수 있습니다. 현재 모델에 대해서는 각 제공업체 카탈로그를 참조하세요. 기능 열은 게이트웨이 API 지원을 반영하며, 업스트림 제공업체가 노출하는 개별 모델 기능을 모두 나타내지는 않습니다.

[제공업체] / [자격 증명] / [예시 모델] / [기능 지원: 채팅, 응답, 임베딩, 파일, 배치, 통과(Passthru)]

  • OpenAI: OPENAI_API_KEY / gpt-4o-mini / 모두 지원 (✅)
  • Anthropic: ANTHROPIC_API_KEY / claude-sonnet-4-20250514 / 채팅, 응답, 배치, 통과 지원 (임베딩, 파일 미지원 ❌)
  • Google Gemini: GEMINI_API_KEY / gemini-2.5-flash / 채팅, 응답, 임베딩, 파일, 배치 지원 (통과 미지원 ❌)
  • Groq: GROQ_API_KEY / llama-3.3-70b-versatile / 채팅, 응답, 임베딩, 파일, 배치 지원 (통과 미지원 ❌)
  • OpenRouter: OPENROUTER_API_KEY / google/gemini-2.5-flash / 모두 지원 (✅)
  • Z.ai: ZAI_API_KEY (ZAI_BASE_URL 선택 사항) / glm-5.1 / 채팅, 응답, 임베딩, 통과 지원 (파일, 배치 미지원 ❌)
  • xAI (Grok): XAI_API_KEY / grok-2 / 채팅, 응답, 임베딩, 파일, 배치 지원 (통과 미지원 ❌)
  • Azure OpenAI: AZURE_API_KEY + AZURE_BASE_URL (AZURE_API_VERSION 선택 사항) / gpt-4o / 모두 지원 (✅)
  • Oracle: ORACLE_API_KEY + ORACLE_BASE_URL / openai.gpt-oss-120b / 채팅, 응답 지원 (나머지 미지원 ❌)
  • Ollama: OLLAMA_BASE_URL / llama3.2 / 채팅, 응답, 임베딩, 통과 지원 (파일, 배치 미지원 ❌)

참고 사항:

  • Z.ai의 GLM 코딩 플랜의 경우, ZAI_BASE_URL=https://api.z.ai/api/coding/paas/v4 로 설정하세요.
  • Oracle의 경우, 업스트림 /models 엔드포인트를 사용할 수 없을 때 ORACLE_MODELS=openai.gpt-oss-120b,xai.grok-3 으로 설정하세요.

대체 설치 방법 소스 코드에서 실행 사전 요구 사항: Go 1.26.2 이상 .env 파일 생성: cp .env.template .env .env 파일에 API 키 추가 (최소 1개 필요). 서버 시작: make run

Docker Compose 인프라 전용 (Redis, PostgreSQL, MongoDB, Adminer - 이미지 빌드 없음): docker compose up -d # 또는: make infra

풀 스택 (GoModel + Prometheus 추가, 앱 이미지 빌드): cp .env.template .env # .env에 API 키 추가 docker compose --profile app up -d # 또는: make image

서비스 URL:

로컬에서 Docker 이미지 빌드하기 docker build -t gomodel . docker run --rm -p 8080:8080 --env-file .env gomodel

OpenAI 호환 API 엔드포인트

  • /v1/chat/completions [POST]: 채팅 완성 (스트리밍 지원)
  • /v1/responses [POST]: OpenAI 응답 API
  • /v1/embeddings [POST]: 텍스트 임베딩
  • /v1/files [POST]: 파일 업로드 (OpenAI 호환 멀티파트)
  • /v1/files [GET]: 파일 목록 조회
원문 보기
원문 보기 (영어)
GoModel - AI Gateway Written in Go A high-performance AI gateway written in Go, providing a unified OpenAI-compatible API for OpenAI, Anthropic, Gemini, xAI, Groq, OpenRouter, Z.ai, Azure OpenAI, Oracle, Ollama, and more. Quick Start - Deploy the AI Gateway Step 1: Start GoModel docker run --rm -p 8080:8080 \ -e LOGGING_ENABLED=true \ -e LOGGING_LOG_BODIES=true \ -e LOG_FORMAT=text \ -e LOGGING_LOG_HEADERS=true \ -e OPENAI_API_KEY= " your-openai-key " \ enterpilot/gomodel Pass only the provider credentials or base URL you need (at least one required): docker run --rm -p 8080:8080 \ -e OPENAI_API_KEY= " your-openai-key " \ -e ANTHROPIC_API_KEY= " your-anthropic-key " \ -e GEMINI_API_KEY= " your-gemini-key " \ -e GROQ_API_KEY= " your-groq-key " \ -e OPENROUTER_API_KEY= " your-openrouter-key " \ -e ZAI_API_KEY= " your-zai-key " \ -e XAI_API_KEY= " your-xai-key " \ -e AZURE_API_KEY= " your-azure-key " \ -e AZURE_BASE_URL= " https://your-resource.openai.azure.com/openai/deployments/your-deployment " \ -e AZURE_API_VERSION= " 2024-10-21 " \ -e ORACLE_API_KEY= " your-oracle-key " \ -e ORACLE_BASE_URL= " https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/v1 " \ -e ORACLE_MODELS= " openai.gpt-oss-120b,xai.grok-3 " \ -e OLLAMA_BASE_URL= " http://host.docker.internal:11434/v1 " \ enterpilot/gomodel ⚠️ Avoid passing secrets via -e on the command line - they can leak via shell history and process lists. For production, use docker run --env-file .env to load API keys from a file instead. Step 2: Make your first API call curl http://localhost:8080/v1/chat/completions \ -H " Content-Type: application/json " \ -d ' { "model": "gpt-5-chat-latest", "messages": [{"role": "user", "content": "Hello!"}] } ' That's it! GoModel automatically detects which providers are available based on the credentials you supply. Supported LLM Providers Example model identifiers are illustrative and subject to change; consult provider catalogs for current models. Feature columns reflect gateway API support, not every individual model capability exposed by an upstream provider. Provider Credential Example Model Chat /responses Embed Files Batches Passthru OpenAI OPENAI_API_KEY gpt-4o-mini ✅ ✅ ✅ ✅ ✅ ✅ Anthropic ANTHROPIC_API_KEY claude-sonnet-4-20250514 ✅ ✅ ❌ ❌ ✅ ✅ Google Gemini GEMINI_API_KEY gemini-2.5-flash ✅ ✅ ✅ ✅ ✅ ❌ Groq GROQ_API_KEY llama-3.3-70b-versatile ✅ ✅ ✅ ✅ ✅ ❌ OpenRouter OPENROUTER_API_KEY google/gemini-2.5-flash ✅ ✅ ✅ ✅ ✅ ✅ Z.ai ZAI_API_KEY ( ZAI_BASE_URL optional) glm-5.1 ✅ ✅ ✅ ❌ ❌ ✅ xAI (Grok) XAI_API_KEY grok-2 ✅ ✅ ✅ ✅ ✅ ❌ Azure OpenAI AZURE_API_KEY + AZURE_BASE_URL ( AZURE_API_VERSION optional) gpt-4o ✅ ✅ ✅ ✅ ✅ ✅ Oracle ORACLE_API_KEY + ORACLE_BASE_URL openai.gpt-oss-120b ✅ ✅ ❌ ❌ ❌ ❌ Ollama OLLAMA_BASE_URL llama3.2 ✅ ✅ ✅ ❌ ❌ ❌ ✅ Supported ❌ Unsupported For Z.ai's GLM Coding Plan, set ZAI_BASE_URL=https://api.z.ai/api/coding/paas/v4 . For Oracle, set ORACLE_MODELS=openai.gpt-oss-120b,xai.grok-3 when the upstream /models endpoint is unavailable. Alternative Setup Methods Running from Source Prerequisites: Go 1.26.2+ Create a .env file: cp .env.template .env Add your API keys to .env (at least one required). Start the server: make run Docker Compose Infrastructure only (Redis, PostgreSQL, MongoDB, Adminer - no image build): docker compose up -d # or: make infra Full stack (adds GoModel + Prometheus; builds the app image): cp .env.template .env # Add your API keys to .env docker compose --profile app up -d # or: make image Service URL GoModel API http://localhost:8080 Adminer (DB UI) http://localhost:8081 Prometheus http://localhost:9090 Building the Docker Image Locally docker build -t gomodel . docker run --rm -p 8080:8080 --env-file .env gomodel OpenAI-Compatible API Endpoints Endpoint Method Description /v1/chat/completions POST Chat completions (streaming supported) /v1/responses POST OpenAI Responses API /v1/embeddings POST Text embeddings /v1/files POST Upload a file (OpenAI-compatible multipart) /v1/files GET List files /v1/files/{id} GET Retrieve file metadata /v1/files/{id} DELETE Delete a file /v1/files/{id}/content GET Retrieve raw file content /v1/batches POST Create a native provider batch (OpenAI-compatible schema; inline requests supported where provider-native) /v1/batches GET List stored batches /v1/batches/{id} GET Retrieve one stored batch /v1/batches/{id}/cancel POST Cancel a pending batch /v1/batches/{id}/results GET Retrieve native batch results when available /p/{provider}/... GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS Provider-native passthrough with opaque upstream responses /v1/models GET List available models /health GET Health check /metrics GET Prometheus metrics (when enabled) /admin/api/v1/usage/summary GET Aggregate token usage statistics /admin/api/v1/usage/daily GET Per-period token usage breakdown /admin/api/v1/usage/models GET Usage breakdown by model /admin/api/v1/usage/log GET Paginated usage log entries /admin/api/v1/audit/log GET Paginated audit log entries /admin/api/v1/audit/conversation GET Conversation thread around one audit log entry /admin/api/v1/models GET List models with provider type /admin/api/v1/models/categories GET List model categories /admin/dashboard GET Admin dashboard UI /swagger/index.html GET Swagger UI (when enabled) Gateway Configuration GoModel is configured through environment variables and an optional config.yaml . Environment variables override YAML values. See .env.template and config/config.example.yaml for the available options. Key settings: Variable Default Description PORT 8080 Server port GOMODEL_MASTER_KEY (none) API key for authentication ENABLE_PASSTHROUGH_ROUTES true Enable provider-native passthrough routes under /p/{provider}/... ALLOW_PASSTHROUGH_V1_ALIAS true Allow /p/{provider}/v1/... aliases while keeping /p/{provider}/... canonical ENABLED_PASSTHROUGH_PROVIDERS openai,anthropic,openrouter,zai Comma-separated list of enabled passthrough providers STORAGE_TYPE sqlite Storage backend ( sqlite , postgresql , mongodb ) METRICS_ENABLED false Enable Prometheus metrics LOGGING_ENABLED false Enable audit logging GUARDRAILS_ENABLED false Enable the configured guardrails pipeline Quick Start - Authentication: By default GOMODEL_MASTER_KEY is unset. Without this key, API endpoints are unprotected and anyone can call them. This is insecure for production. Strongly recommend setting a strong secret before exposing the service. Add GOMODEL_MASTER_KEY to your .env or environment for production deployments. Response Caching GoModel has a two-layer response cache that reduces LLM API costs and latency for repeated or semantically similar requests. Layer 1 - Exact-match cache Hashes the full request body (path + Workflow + body) and returns a stored response on byte-identical requests. Sub-millisecond lookup. Activate by environment variables: RESPONSE_CACHE_SIMPLE_ENABLED and REDIS_URL . Responses served from this layer carry X-Cache: HIT (exact) . Layer 2 - Semantic cache Embeds the last user message via your configured provider’s OpenAI-compatible /v1/embeddings API ( cache.response.semantic.embedder.provider must name a key in the top-level providers map) and performs a KNN vector search. Semantically equivalent queries - e.g. "What's the capital of France?" vs "Which city is France's capital?" - can return the same cached response without an upstream LLM call. Expected hit rates: ~60–70% in high-repetition workloads vs. ~18% for exact-match alone. Responses served from this layer carry X-Cache: HIT (semantic) . Supported vector backends: qdrant , pgvector , pinecone , weaviate (set cache.response.semantic.vector_store.type and the matching nested block). Both cache layers run after guardrail/workflow patching so they always see the final prompt. Use Cache-Control: no-cache or Cache-Control: no-store to bypass caching per-request. See DEVELOPMENT.md for testing, linting, and pre-commit setup. Roadmap to 0.2.0 Must Have Intelligent routing Broader provider support: Oracle