gomodel

module
v0.1.88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: MIT

README

GoModel logo

GoModel - The last AI gateway you will ever need

CI GO Version Docker Pulls Discord

Hacker News docs GoModel

GoModel on Hacker News

GoModel is the fastest and the most resource-efficient AI Gateway (the self-reproducible benchmarks). It's an alternative to LiteLLM (which was hacked recently) and Portkey (which is no longer maintained on GitHub).

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

(click on the animation ↑ to see the live demo)

GoModel saves you money and nerves.

Money - because you can remember the responses on this layer (caching), track your spending and do tricks like prompt compression and intelligent routing.

Nerves - because we strive to achieve good quality and reliability. Our ambition is to be the last AI gateway you will need - the most reliable, resource-optimal, feature-rich and fast.

Quick Start

Step 1: Install and start GoModel

macOS / Linux

curl -fsSL https://gomodel.enterpilot.io/install.sh | sh
# OPENAI_API_KEY="your-openai-key" # (optional)
gomodel

Windows (PowerShell)

irm https://gomodel.enterpilot.io/install.ps1 | iex
# $env:OPENAI_API_KEY = "your-openai-key" # (optional)
gomodel

Docker

docker run --rm -p 8080:8080 \
  -e OPENAI_API_KEY="your-openai-key" \
  enterpilot/gomodel

ℹ️ Configure GoModel with .env, a config.yaml file, or manage the most important settings directly in the dashboard.

ℹ️ See .env.template for the complete list of environment variables, including all available providers.

Step 2: Open the dashboard

http://localhost:8080/admin/dashboard

Step 3: Make an API call

curl http://localhost:8080/v1/responses \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5-chat-latest",
    "input": "Hello!"
  }'

GoModel and official SDKs

GoModel accepts requests in two compatible formats:

  • OpenAI-compatible at /v1
  • Anthropic-compatible at /v1/messages

The official SDKs therefore work unchanged. Configure their base URLs as follows:

  • OpenAI SDK: http://localhost:8080/v1
  • Anthropic SDK: http://localhost:8080 (the SDK appends /v1/messages)

List of Supported LLM Providers

  • OpenAI
  • Anthropic
  • xAI (Grok)
  • Google Gemini
  • Cohere
  • Vertex AI
  • DeepSeek
  • Groq
  • Fireworks AI
  • Meta (Muse Spark)
  • OpenRouter
  • Z.ai
  • Alibaba Cloud Model Studio (Bailian)
  • Kilo AI
  • MiniMax
  • Xiaomi MiMo
  • OpenCode Go
  • Azure OpenAI
  • Oracle
  • Ollama
  • SGLang
  • vLLM
  • llm-d
  • Amazon Bedrock Runtime and Bedrock Mantle
  • ChatGPT (the Codex backend) and Claude
  • ElevenLabs (text-to-speech and speech-to-text)
  • All OpenAI-compatible providers

See the Providers Overview for the full per-provider feature matrix.


Docker Compose

Infrastructure only (Redis, PostgreSQL, MongoDB, Adminer - no image build):

cp .env.template .env
# Add your API keys to .env
docker compose up -d
# or: make infra

Full stack (adds GoModel + Prometheus; builds the app image):

docker compose --profile app up -d
# or: make image

API docs


Gateway Configuration

GoModel resolves configuration in the following order, with each source overriding those to its left:

Good defaultsconfig.yaml.env → exported environment variables

See the Configuration reference for the full list of settings.


Features

  • Caching - exact and semantic response caching, so repeated prompts cost nothing
  • Cost tracking - per-request cost estimates, usage analytics, and spending breakdowns in the dashboard
  • Budgets - hard spend limits per user, team, or key
  • Rate limits - requests, tokens, and concurrency caps per user path, provider, or model
  • Virtual models - aliases and load balancing (round-robin or cost-based) behind stable model names
  • Failover - automatic rerouting to backup providers, with retries and circuit breakers
  • Labelling - tag requests from HTTP headers or API keys and break down usage by label
  • User paths - hierarchical scoping of keys, model access, budgets, usage, and audit logs
  • MCP gateway - aggregate your MCP servers behind one authenticated endpoint
  • Passthrough API - provider-native APIs under /p/{provider}/..., with GoModel auth and tracking
  • Guardrails - request and response policies enforced at the gateway
  • Provider key rotation - round-robin over multiple API keys to lift per-key rate limits
  • Observability - Prometheus metrics, OpenTelemetry traces, audit logs, and live request streaming in the dashboard

Roadmap

See the roadmap for GoModel Pro and the upcoming 0.2.0 release.

Sponsors

Neiko2002

Community

We are on Discord. Feel free to stop by and tell us what you think about GoModel.

Directories

Path Synopsis
cmd
gomodel command
Package main is the entry point for the LLM gateway server.
Package main is the entry point for the LLM gateway server.
recordapi command
Package main provides a CLI tool to record real API responses for contract tests.
Package main provides a CLI tool to record real API responses for contract tests.
Package config provides configuration management for the application.
Package config provides configuration management for the application.
docs
Package ext is the public extension API for building custom gateway binaries on top of GoModel.
Package ext is the public extension API for building custom gateway binaries on top of GoModel.
internal
admin
Package admin provides the admin REST API and dashboard for GoModel.
Package admin provides the admin REST API and dashboard for GoModel.
admin/dashboard
Package dashboard provides the embedded admin dashboard UI for GoModel.
Package dashboard provides the embedded admin dashboard UI for GoModel.
anthropicapi
Package anthropicapi translates the Anthropic Messages API dialect to and from GoModel's canonical chat types.
Package anthropicapi translates the Anthropic Messages API dialect to and from GoModel's canonical chat types.
app
Package app provides the main application struct for centralized dependency management and lifecycle control of the GoModel server.
Package app provides the main application struct for centralized dependency management and lifecycle control of the GoModel server.
auditlog
Package auditlog provides audit logging for the AI gateway.
Package auditlog provides audit logging for the AI gateway.
batch
Package batch provides persistence for OpenAI-compatible batch lifecycle endpoints.
Package batch provides persistence for OpenAI-compatible batch lifecycle endpoints.
cache
Package cache provides a generic key-value store abstraction.
Package cache provides a generic key-value store abstraction.
cache/modelcache
Package modelcache provides model-specific cache types and interfaces.
Package modelcache provides model-specific cache types and interfaces.
conversationstore
Package conversationstore provides persistence for the OpenAI-compatible Conversations lifecycle endpoints.
Package conversationstore provides persistence for the OpenAI-compatible Conversations lifecycle endpoints.
core
Package core provides core types and interfaces for the LLM gateway.
Package core provides core types and interfaces for the LLM gateway.
filestore
Package filestore persists provider ownership for uploaded files.
Package filestore persists provider ownership for uploaded files.
gateway
Package gateway contains transport-independent gateway use cases.
Package gateway contains transport-independent gateway use cases.
guardrails
Package guardrails provides a pluggable pipeline for request-level guardrails.
Package guardrails provides a pluggable pipeline for request-level guardrails.
httpclient
Package httpclient provides a centralized HTTP client factory with unified configuration.
Package httpclient provides a centralized HTTP client factory with unified configuration.
live
Package live provides in-process realtime dashboard event fan-out.
Package live provides in-process realtime dashboard event fan-out.
llmclient
Package llmclient provides a base HTTP client for LLM providers with: - Request marshaling/unmarshaling - Retries with exponential backoff and jitter - Standardized error parsing, including errors embedded in 200-status bodies - Circuit breaking with half-open state protection
Package llmclient provides a base HTTP client for LLM providers with: - Request marshaling/unmarshaling - Retries with exponential backoff and jitter - Standardized error parsing, including errors embedded in 200-status bodies - Circuit breaking with half-open state protection
mcpgateway
Package mcpgateway aggregates upstream MCP servers behind GoModel's authenticated /mcp endpoints.
Package mcpgateway aggregates upstream MCP servers behind GoModel's authenticated /mcp endpoints.
modeldata
Package modeldata provides fetching, parsing, and merging of the external AI model metadata registry (models.json) for enriching GoModel's model data.
Package modeldata provides fetching, parsing, and merging of the external AI model metadata registry (models.json) for enriching GoModel's model data.
modelselectors
Package modelselectors normalizes provider/model selector strings shared by model-level admin features.
Package modelselectors normalizes provider/model selector strings shared by model-level admin features.
observability
Package observability provides instrumentation for metrics, tracing, and logging.
Package observability provides instrumentation for metrics, tracing, and logging.
platformdir
Package platformdir resolves the OS-conventional per-user directories for GoModel's durable data and caches, used when no explicit path is configured.
Package platformdir resolves the OS-conventional per-user directories for GoModel's durable data and caches, used when no explicit path is configured.
providers
Package providers provides a factory for creating provider instances.
Package providers provides a factory for creating provider instances.
providers/anthropic
Package anthropic provides Anthropic API integration for the LLM gateway.
Package anthropic provides Anthropic API integration for the LLM gateway.
providers/bailian
Package bailian provides the Alibaba Cloud Bailian (百炼 / DashScope) provider.
Package bailian provides the Alibaba Cloud Bailian (百炼 / DashScope) provider.
providers/bedrock
Package bedrock provides Amazon Bedrock integration for the LLM gateway.
Package bedrock provides Amazon Bedrock integration for the LLM gateway.
providers/bedrockmantle
Package bedrockmantle provides direct access to Amazon Bedrock's OpenAI-compatible Mantle API.
Package bedrockmantle provides direct access to Amazon Bedrock's OpenAI-compatible Mantle API.
providers/chatgpt
Package chatgpt routes Responses API traffic to the ChatGPT Codex backend, billed against a ChatGPT subscription instead of an OpenAI Platform API key.
Package chatgpt routes Responses API traffic to the ChatGPT Codex backend, billed against a ChatGPT subscription instead of an OpenAI Platform API key.
providers/chutes
Package chutes provides Chutes AI integration for the LLM gateway.
Package chutes provides Chutes AI integration for the LLM gateway.
providers/cohere
Package cohere provides Cohere API v2 integration for the LLM gateway.
Package cohere provides Cohere API v2 integration for the LLM gateway.
providers/deepseek
Package deepseek provides DeepSeek API integration for the LLM gateway.
Package deepseek provides DeepSeek API integration for the LLM gateway.
providers/elevenlabs
Package elevenlabs provides ElevenLabs voice API integration for the LLM gateway.
Package elevenlabs provides ElevenLabs voice API integration for the LLM gateway.
providers/fireworks
Package fireworks provides Fireworks AI API integration for the LLM gateway.
Package fireworks provides Fireworks AI API integration for the LLM gateway.
providers/gemini
Package gemini provides Google Gemini API integration for the LLM gateway.
Package gemini provides Google Gemini API integration for the LLM gateway.
providers/googlecommon
Package googlecommon holds infrastructure shared by GoModel's Google-backed providers (Gemini AI Studio + Vertex AI).
Package googlecommon holds infrastructure shared by GoModel's Google-backed providers (Gemini AI Studio + Vertex AI).
providers/groq
Package groq provides Groq API integration for the LLM gateway.
Package groq provides Groq API integration for the LLM gateway.
providers/health
Package health tracks recent request outcomes per provider and model.
Package health tracks recent request outcomes per provider and model.
providers/hetzner
Package hetzner provides Hetzner Inference API integration for the LLM gateway.
Package hetzner provides Hetzner Inference API integration for the LLM gateway.
providers/kilo
Package kilo provides Kilo AI Gateway integration for the LLM gateway.
Package kilo provides Kilo AI Gateway integration for the LLM gateway.
providers/kimicode
Package kimicode provides Kimi Code API integration for the LLM gateway.
Package kimicode provides Kimi Code API integration for the LLM gateway.
providers/llamacpp
Package llamacpp provides llama.cpp llama-server OpenAI-compatible API integration for the LLM gateway.
Package llamacpp provides llama.cpp llama-server OpenAI-compatible API integration for the LLM gateway.
providers/llmd
Package llmd provides integration with the llm-d Router's OpenAI-compatible API.
Package llmd provides integration with the llm-d Router's OpenAI-compatible API.
providers/meta
Package meta provides Meta Model API integration for the LLM gateway.
Package meta provides Meta Model API integration for the LLM gateway.
providers/minimax
Package minimax provides MiniMax API integration for the LLM gateway.
Package minimax provides MiniMax API integration for the LLM gateway.
providers/ollama
Package ollama provides Ollama API integration for the LLM gateway.
Package ollama provides Ollama API integration for the LLM gateway.
providers/openai
Package openai provides OpenAI API integration for the LLM gateway.
Package openai provides OpenAI API integration for the LLM gateway.
providers/opencodego
Package opencodego provides OpenCode Zen (Go subscription) integration for the LLM gateway.
Package opencodego provides OpenCode Zen (Go subscription) integration for the LLM gateway.
providers/sglang
Package sglang provides SGLang OpenAI-compatible API integration for the LLM gateway.
Package sglang provides SGLang OpenAI-compatible API integration for the LLM gateway.
providers/vertex
Package vertex provides Google Vertex AI Gemini integration.
Package vertex provides Google Vertex AI Gemini integration.
providers/vllm
Package vllm provides vLLM OpenAI-compatible API integration for the LLM gateway.
Package vllm provides vLLM OpenAI-compatible API integration for the LLM gateway.
providers/xai
Package xai provides xAI (Grok) API integration for the LLM gateway.
Package xai provides xAI (Grok) API integration for the LLM gateway.
providers/xiaomi
Package xiaomi provides Xiaomi MiMo API integration for the LLM gateway.
Package xiaomi provides Xiaomi MiMo API integration for the LLM gateway.
providers/zai
Package zai provides Z.ai API integration for the LLM gateway.
Package zai provides Z.ai API integration for the LLM gateway.
ratelimit
Package ratelimit enforces request, token, and concurrency limits for the AI gateway.
Package ratelimit enforces request, token, and concurrency limits for the AI gateway.
realtime
Package realtime implements a transparent, provider-agnostic websocket reverse proxy for OpenAI-compatible realtime (speech-to-speech) sessions.
Package realtime implements a transparent, provider-agnostic websocket reverse proxy for OpenAI-compatible realtime (speech-to-speech) sessions.
responsestore
Package responsestore provides persistence for OpenAI-compatible Responses lifecycle endpoints.
Package responsestore provides persistence for OpenAI-compatible Responses lifecycle endpoints.
server
Package server provides HTTP handlers and server setup for the LLM gateway.
Package server provides HTTP handlers and server setup for the LLM gateway.
session
Package session identifies the client session a request belongs to, so the gateway can route one conversation consistently and group its audit entries.
Package session identifies the client session a request belongs to, so the gateway can route one conversation consistently and group its audit entries.
storage
Package storage provides shared database connections for all features.
Package storage provides shared database connections for all features.
storage/mongotest
Package mongotest runs a store's test suite against MongoDB.
Package mongotest runs a store's test suite against MongoDB.
storage/sqlutil
Package sqlutil provides small SQL query-building and value-conversion helpers shared by the SQL-backed stores and readers.
Package sqlutil provides small SQL query-building and value-conversion helpers shared by the SQL-backed stores and readers.
storage/sqlx
Package sqlx lets one store implementation serve both SQL backends.
Package sqlx lets one store implementation serve both SQL backends.
storage/sqlx/sqlxtest
Package sqlxtest runs a store's test suite against every SQL dialect.
Package sqlxtest runs a store's test suite against every SQL dialect.
tagging
Package tagging labels requests based on configurable HTTP headers.
Package tagging labels requests based on configurable HTTP headers.
telemetry
Package telemetry provides GoModel's OpenTelemetry integration: OTLP trace and metric export for inbound HTTP requests and outbound provider calls.
Package telemetry provides GoModel's OpenTelemetry integration: OTLP trace and metric export for inbound HTTP requests and outbound provider calls.
usage
Package usage provides token usage tracking for the AI gateway.
Package usage provides token usage tracking for the AI gateway.
users
Package users manages per-user-path model access policies.
Package users manages per-user-path model access policies.
validation
Package validation provides the shared validation error type used by admin-managed resources (aliases, auth keys, guardrails, workflows, model selectors and overrides).
Package validation provides the shared validation error type used by admin-managed resources (aliases, auth keys, guardrails, workflows, model selectors and overrides).
versioncheck
Package versioncheck reports whether a newer GoModel release exists.
Package versioncheck reports whether a newer GoModel release exists.
virtualmodels
Package virtualmodels unifies model aliases (redirects) and model access overrides (policies) behind one entity, the virtual model, persisted in a single virtual_models table.
Package virtualmodels unifies model aliases (redirects) and model access overrides (policies) behind one entity, the virtual model, persisted in a single virtual_models table.
Package run exposes the complete GoModel gateway lifecycle as an importable entry point.
Package run exposes the complete GoModel gateway lifecycle as an importable entry point.
tests
contract
Package contract provides contract tests that validate API response structures against recorded golden files.
Package contract provides contract tests that validate API response structures against recorded golden files.
e2e/mockmcp command
Command mockmcp serves two deterministic MCP upstream servers ("alpha" and "beta") over streamable HTTP for the release E2E curl matrix.
Command mockmcp serves two deterministic MCP upstream servers ("alpha" and "beta") over streamable HTTP for the release E2E curl matrix.
integration
Package integration provides integration tests that verify database state after requests.
Package integration provides integration tests that verify database state after requests.
integration/dbassert
Package dbassert provides database assertion helpers for integration tests.
Package dbassert provides database assertion helpers for integration tests.
Package tools pins developer tooling dependencies used by this repository.
Package tools pins developer tooling dependencies used by this repository.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL