Odock.ai
Installation

Configuration

Runtime configuration for the gateway, UI, cache invalidation, plugins, and observability.

Configuration

Configuration is split between odock-server, odock-ui, Docker Compose, and the observability profile.

Gateway Configuration

odock-server loads .env best-effort and then reads environment variables. POSTGRES_DSN is required.

HTTP

VariableDefaultDescription
HTTP_HOST0.0.0.0Bind host
HTTP_PORT8080Bind port
HTTP_READ_TIMEOUT15sRequest read timeout
HTTP_WRITE_TIMEOUT60sResponse write timeout
HTTP_IDLE_TIMEOUT60sKeep-alive timeout
HTTP_MAX_HEADER_BYTES1048576Maximum header size
HTTP_ENABLE_TLSfalseEnable direct TLS
HTTP_TLS_CERT_FILEemptyRequired when TLS is enabled
HTTP_TLS_KEY_FILEemptyRequired when TLS is enabled
HTTP_TRUST_PROXY_HEADERSfalseRespect forwarded client IP headers
HTTP_TRUSTED_PROXY_CIDRSemptyTrusted proxy CIDR or IP list
HTTP_MAX_CONCURRENT_REQUESTS0Global in-process request cap; 0 disables

Storage

VariableDefaultDescription
POSTGRES_DSNrequiredPostgres DSN used by the gateway
POSTGRES_MAX_OPEN25Max open DB connections
POSTGRES_MAX_IDLE5Max idle DB connections
POSTGRES_MAX_LIFETIME30mConnection lifetime
POSTGRES_LOG_QUERIESfalseQuery logging flag
REDIS_ADDRlocalhost:6379Redis address
REDIS_USERNAMEemptyRedis username
REDIS_PASSWORDemptyRedis password
REDIS_DB0Redis DB
REDIS_POOL_SIZE20Redis pool size
REDIS_DIAL_TIMEOUT5sRedis dial timeout

Provider Defaults

Provider defaults are used when a request does not receive provider settings from the model database row.

ProviderBase URL variableAPI key variableTimeout variable
OpenAIPROVIDER_OPENAI_BASE_URLPROVIDER_OPENAI_API_KEY or OPENAI_API_KEYPROVIDER_OPENAI_TIMEOUT
AnthropicPROVIDER_ANTHROPIC_BASE_URLPROVIDER_ANTHROPIC_API_KEY or ANTHROPIC_API_KEYPROVIDER_ANTHROPIC_TIMEOUT
GeminiPROVIDER_GEMINI_BASE_URLPROVIDER_GEMINI_API_KEY or GEMINI_API_KEYPROVIDER_GEMINI_TIMEOUT
vLLMPROVIDER_VLLM_BASE_URLPROVIDER_VLLM_API_KEYPROVIDER_VLLM_TIMEOUT

In normal UI-managed operation, provider base URLs and encrypted provider keys come from the configured Provider, ProviderApiKey, and Model rows.

Observability

VariableDefaultDescription
OBSERVABILITY_PROMETHEUS_ENABLEDtrueExpose /metrics
OBSERVABILITY_OTEL_EXPORTERotlphttpShared exporter fallback
OBSERVABILITY_OTEL_TRACES_EXPORTERfallbackTrace exporter
OBSERVABILITY_OTEL_METRICS_EXPORTERfallbackMetric exporter
OBSERVABILITY_OTEL_ENDPOINThttp://localhost:4318Shared OTLP endpoint
OBSERVABILITY_OTEL_TRACES_ENDPOINTemptyTrace endpoint override
OBSERVABILITY_OTEL_METRICS_ENDPOINTemptyMetric endpoint override
OBSERVABILITY_SERVICE_NAMEgateway-serviceService name
OBSERVABILITY_SERVICE_NAMESPACEodockService namespace
OBSERVABILITY_SERVICE_VERSIONdevService version
OBSERVABILITY_DEPLOYMENT_ENVIRONMENTdevelopmentEnvironment
OBSERVABILITY_SAMPLE_RATE0.1Trace sampling rate, between 0 and 1

Governance Runtime

VariableDefaultDescription
AUTH_CACHE_TTL5mPositive API key cache TTL
AUTH_NEGATIVE_CACHE_TTL30sNegative auth cache TTL
RATELIMIT_GLOBAL_POLICYemptyJSON policy applied globally
RATELIMIT_POLICY_CACHE_TTL5mPolicy cache TTL
MODEL_CACHE_TTL5mModel metadata and access cache TTL
MCP_CACHE_TTL5mMCP server cache TTL
SMART_ROUTING_POLICY_CACHE_TTL5mSmart routing policy cache TTL
SAFETY_ENGINE_MODEnoopUse security to enable SafetySec
SAFETY_SESSION_TTL24hSafetySec Redis session TTL
SAFETY_BLOCK_THRESHOLD0.85Accumulated safety score block threshold

Provider Key Decryption

VariableDescription
PROVIDER_KEY_ENCRYPTION_KEY_IDExpected key ID for encrypted provider-key envelopes
PROVIDER_KEY_ENCRYPTION_PRIVATE_KEYRSA private key PEM, often with literal \n escapes
PROVIDER_KEY_DECRYPT_CACHE_TTLIn-process plaintext decrypt cache TTL

PROVIDER_KEY_ENCRYPTION_KEY_ID and PROVIDER_KEY_ENCRYPTION_PRIVATE_KEY must be configured together.

Cache Invalidation

VariableDefaultDescription
CACHE_INVALIDATION_SECRETemptyEnables /v1/internal/cache/invalidate when set
CACHE_INVALIDATION_CHANNELodock:cache-invalidationRedis pub/sub channel

When the UI mutates API keys, model access, models, providers, organisations, teams, or MCP servers, it sends invalidation commands to the gateway if both ODOCK_SERVER_INTERNAL_URL and CACHE_INVALIDATION_SECRET are configured in odock-ui.

UI Configuration

The UI is a Next.js application using Better Auth and Prisma.

Important variables:

VariableDescription
DATABASE_URLPostgres DSN for Prisma
BETTER_AUTH_SECRETBetter Auth secret
BETTER_AUTH_URL or NEXT_PUBLIC_APP_URLPublic auth base URL
GITHUB_CLIENT_IDGitHub OAuth client ID
GITHUB_CLIENT_SECRETGitHub OAuth client secret
NEXT_PUBLIC_APP_URLPublic UI URL
NEXT_PUBLIC_PROVIDER_KEY_ENCRYPTION_KEY_IDBrowser-side key ID
NEXT_PUBLIC_PROVIDER_KEY_ENCRYPTION_PUBLIC_KEYRSA public key used by browser encryption
ODOCK_SERVER_INTERNAL_URLInternal URL for gateway cache invalidation
CACHE_INVALIDATION_SECRETMust match the gateway secret
RBAC_AUDIT_LOGEnables RBAC audit logging when set by implementation
RESEND_API_KEYInvitation email provider key when email sending is enabled
INVITATION_EMAIL_FROMInvitation email sender

Provider-key encryption values prefixed with NEXT_PUBLIC_ are compiled into the browser bundle. Provide them at build time.

Plugin Configuration

The gateway loads plugin configuration from PLUGINS_CONFIG_PATH, defaulting to ./configs/plugins.json.

Runtime tuning:

VariableDefaultDescription
PLUGINS_CONFIG_PATH./configs/plugins.jsonConfig JSON path
PLUGINS_MAX_PARALLEL4Max parallel plugin workers per phase
PLUGINS_ASYNC_POST_RESPONSEfalseEnable async post-response plugins
PLUGINS_ASYNC_QUEUE_SIZE128Async plugin queue size
PLUGINS_ASYNC_WORKERS2Async plugin workers
PLUGINS_ENV_*emptyExtra env values available to plugin factories

Config shape:

{
  "plugins": [
    {
      "name": "audit_log",
      "enabled": true,
      "storage_access": ["usage", "api_keys"],
      "config": { "level": "info" }
    }
  ],
  "phases": {
    "pre_route": { "sequential": [], "parallel": ["audit_log"] },
    "pre_upstream": { "sequential": [], "parallel": [] },
    "post_upstream": { "sequential": [], "parallel": [] },
    "post_response": { "sequential": ["audit_log"], "parallel": [], "async": true }
  }
}

Policy JSON Shape

Policy JSON stored on organisations, teams, API keys, models, and MCP servers uses this envelope:

{
  "policies": {
    "ip": {
      "allowlist": ["10.0.0.0/8"],
      "blocklist": []
    },
    "ratelimit": {
      "requests": {
        "per_second": 20,
        "per_minute": 1200,
        "burst": 50
      },
      "tokens": {
        "per_minute": 120000
      },
      "concurrency": {
        "max": 40,
        "lease_ttl_seconds": 30
      },
      "payload": {
        "max_request_bytes": 2097152,
        "max_tokens": 8192
      }
    }
  }
}

The implementation currently validates non-negative values. lease_ttl_seconds is accepted in schema/config shape, but the active Redis leaser uses the gateway's stage defaults.

On this page