MCPcopy Index your code
hub / github.com/ENTERPILOT/GoModel

github.com/ENTERPILOT/GoModel @v0.1.48

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.48 ↗ · + Follow
9,623 symbols 38,734 edges 777 files 2,643 documented · 27%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GoModel logo

GoModel - AI Gateway in Go

CI GO Version Docker Pulls Discord

Hacker News docs GoModel

GoModel on Hacker News

A fast and lightweight AI gateway written in Go, providing unified OpenAI-compatible and Anthropic-compatible APIs for OpenAI, Anthropic, Gemini, DeepSeek, xAI, Groq, OpenRouter, Z.ai, Azure OpenAI, Oracle, Ollama, and more.

GoModel AI gateway dashboard showing AI usage analytics, observability panel, token and costs tracking, and estimated cost monitoring

Quick Start with Docker

Step 1: Start GoModel container

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

Full list of environment variables (including all available providers): .env.template

⚠️ Avoid passing secrets with -e on the command line in production — they can leak through shell history and process lists. 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

GoModel supports OpenAI, Anthropic, Google Gemini, Vertex AI, DeepSeek, Groq, OpenRouter, Z.ai, xAI (Grok), Alibaba Cloud Model Studio (Bailian), MiniMax, Xiaomi MiMo, OpenCode Go, Azure OpenAI, Oracle, Ollama, vLLM, Amazon Bedrock, and all OpenAI-compatible providers.

See the Providers Overview for the full per-provider feature matrix (chat, /responses, embeddings, files, batches, passthrough), credentials, and configuration notes.


Alternative Setup Methods

Running from Source

Prerequisites: Go 1.26.4+

  1. Create a .env file:

bash cp .env.template .env

  1. Add your API keys to .env (at least one required).

  2. Start the server:

bash 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

API Endpoints

GoModel exposes OpenAI-compatible and Anthropic-compatible APIs, provider-native passthrough, and operations routes. See the API Endpoints reference for the full endpoint tables, and Admin Endpoints for the admin REST API and dashboard.


Gateway Configuration

GoModel is configured through environment variables and an optional config.yaml. Environment variables override YAML values. See the Configuration reference for the full list of settings organized by category, along with .env.template and config/config.example.yaml.

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.


See DEVELOPMENT.md for testing, linting, and pre-commit setup.


Roadmap

See the Roadmap for commercial features and the public 0.2.0 milestone.

Community

Join our Discord to connect with other GoModel users.

Star History

Star History Chart

Extension points exported contracts — how you extend this code

Pinger (Interface)
Pinger is an optional capability for stores backed by a network service that can verify connectivity. Network-backed sto [7 …
internal/cache/store.go
ChatProvider (Interface)
ChatProvider is the minimal interface needed by the shared Responses-to-Chat adapter. Any provider that supports ChatCom [42 …
internal/providers/responses_adapter.go
BatchFileTransport (Interface)
BatchFileTransport is the minimal provider-native file API surface needed to preprocess file-backed batch requests. [13 …
internal/core/batch_preparation.go
Storage (Interface)
Storage manages the lifecycle of a shared storage backend. [148 implementers]
internal/storage/storage.go
FileDeleter (Interface)
FileDeleter is the native file API surface needed to remove temporary batch input files created during request rewriting [14 …
internal/batchrewrite/helpers.go
LogStore (Interface)
LogStore defines the interface for audit log storage backends. Implementations must be safe for concurrent use. [10 implementers]
internal/auditlog/auditlog.go
ChatCompletionExecutor (Interface)
ChatCompletionExecutor provides the auxiliary model call used by llm_based_altering guardrails. [47 implementers]
internal/guardrails/llm_based_altering.go
ReadinessProbe (Interface)
ReadinessProbe verifies that a dependency the gateway owns is reachable. It is deliberately narrow so the server stays d [7 …
internal/server/http.go

Core symbols most depended-on inside this repo

Set
called by 692
internal/cache/store.go
Close
called by 529
internal/authkeys/store.go
String
called by 523
docs/2026-06-25_aws_gateway_benchmark/remote/bench-tools/loadgen/main.go
Get
called by 475
internal/filestore/store.go
NewInvalidRequestError
called by 473
internal/core/errors.go
String
called by 368
internal/modelselectors/selectors.go
Write
called by 366
internal/usage/logger.go
Error
called by 242
internal/pricingoverrides/snapshot.go

Shape

Function 5,946
Method 2,576
Struct 912
Interface 130
TypeAlias 31
FuncType 18
Class 10

Languages

Go88%
TypeScript12%
Python1%

Modules by API surface

internal/server/handlers_test.go278 symbols
internal/admin/handler_test.go127 symbols
internal/admin/dashboard/static/js/modules/workflows.js121 symbols
internal/providers/router.go104 symbols
internal/providers/anthropic/anthropic_test.go103 symbols
internal/admin/dashboard/static/js/modules/virtual-models.js89 symbols
internal/auditlog/auditlog_test.go87 symbols
internal/core/interfaces.go85 symbols
internal/guardrails/provider_test.go83 symbols
internal/providers/router_test.go77 symbols
internal/providers/config_test.go71 symbols
internal/admin/dashboard/static/js/dashboard.js71 symbols

Datastores touched

usageCollection · 1 repos
audit_logsCollection · 1 repos
budgetsCollection · 1 repos
aliasesCollection · 1 repos
auth_keysCollection · 1 repos
batchesCollection · 1 repos
budget_settingsCollection · 1 repos
failover_rulesCollection · 1 repos

For agents

$ claude mcp add GoModel \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact