Skip to main content

Configuration file

Use config.yml to configure core gateway settings for self-hosted Otari Gateway deployments.

The config file is passed at startup with --config:

gateway serve --config config.yml

Full example

# Database
database_url: "postgresql://gateway:gateway@postgres:5432/gateway"

# Server
host: "0.0.0.0"
port: 8000

# Auth
master_key: "your-secret-master-key"

# Rate limiting (requests per minute per user, omit to disable)
# rate_limit_rpm: 60

# Prometheus metrics at /metrics
# enable_metrics: true

# Providers
providers:
openai:
api_key: "sk-..."
anthropic:
api_key: "sk-ant-..."
mistral:
api_key: "..."
vertexai:
credentials: "/app/service_account.json"
project: "my-gcp-project"
location: "us-central1"

# Pricing (USD per million tokens)
pricing:
openai:gpt-4o:
input_price_per_million: 2.50
output_price_per_million: 10.00

Config reference

Field

Type

Default

Description

database_url

string

sqlite:///./otari-gateway.db

Database connection URL (SQLite or PostgreSQL)

auto_migrate

bool

true

Run Alembic migrations automatically on startup

db_pool_size

int

10

Persistent DB connections per worker

db_max_overflow

int

20

Extra burst connections above pool size

db_pool_timeout

float

30.0

Seconds to wait for a connection

db_pool_recycle

int

-1

Recycle connections older than N seconds (-1 = disabled)

host

string

0.0.0.0

Server bind host

port

int

8000

Server bind port

master_key

string

none

Master key for management endpoints

rate_limit_rpm

int

none

Max requests per minute per user (none = disabled)

cors_allow_origins

list

[]

Allowed CORS origins (empty = disabled)

providers

dict

{}

Provider credentials (see below)

pricing

dict

{}

Model pricing entries

enable_metrics

bool

false

Enable Prometheus /metrics endpoint

enable_docs

bool

true

Enable /docs, /redoc, /openapi.json

bootstrap_api_key

bool

true

Create a first-use API key on startup when none exist

log_writer_strategy

string

"single"

Usage log writing: "single" (inline) or "batch" (background)

budget_strategy

string

"for_update"

Budget validation: "for_update", "cas", or "disabled"

mode

string

"standalone"

Configured mode ("standalone" or "platform"). Effective behavior is driven by presence of OTARI_AI_TOKEN.

platform

dict

{}

otari.ai integration settings (base_url, timeouts, retries)

Source: mozilla-ai/otari/docs/configuration.md

Did this answer your question?