Skip to content

OpenViking Gateway configuration reference ​

This page is for operators editing ov.conf, gateway.conf or environment variables, and for anyone mapping a Studio label to its management API name. Every table gives the name, default and accepted values; what a setting does and when to change it are on the feature page linked from each section.

Where the settings live ​

An embedded and a standalone gateway share most fields; they differ in which file holds them and how you create it. The Form column under Gateway fields marks the fields that only one form uses.

EmbeddedStandalone
FileThe gateway section of ov.confThe root of gateway.conf, with no gateway wrapper
Created byopenviking-server initopenviking-gateway init
Which file is readThe server's own ov.conf--config or OPENVIKING_GATEWAY_CONFIG_FILE, which must point to an existing file; otherwise the first of ~/.openviking/gateway.conf and /etc/openviking/gateway.conf that exists
Host, port and workersCome from the serverThe host, port and workers fields

OPENVIKING_CONFIG_FILE only selects the server's configuration; it never points a standalone gateway at a file.

Gateway fields ​

FieldFormDefaultAccepted valuesMeaning
enabledEmbeddedfalseTurns the gateway on inside the server
openviking_urlStandalone— (required)HTTP(S) URLAddress of the OpenViking Server
hostStandalone127.0.0.1Listen address
portStandalone19351–65,535Listen port
workersStandalone11–64Worker processes
log_pathStandaloneemptyFile pathWrite the application log using the common UTC text format to this rotating file (256 MiB, four old files) instead of stderr; needs workers: 1. See Monitoring
keep_alive_secondsStandalone75More than 0Seconds to keep an idle HTTP connection open between requests; set it above the load balancer's backend idle timeout
public_urlBothemptyHTTP(S) URL, without /gatewayThe external address clients use; the gateway appends /gateway itself. When empty, an embedded gateway uses the server's public address; with neither, setup guides use the request's origin, and MCP file uploads and downloads do not work unless mcp_file_links is direct. See Public address
mcp_file_linksBothproxyproxy, directHow links from the MCP upload and download tools reach the client. proxy rewrites them to public_url plus /gateway/uploads or /gateway/downloads and needs public_url. direct passes OpenViking's links through unchanged and needs the server's OPENVIKING_PUBLIC_BASE_URL (or server.public_base_url) to be reachable by the client
storage_pathBoth~/.openviking/gatewayLocal storage directory
storageBothBoth ports sqliteSee Storage providersPer-port providers and one shared Redis connection
encryptionStandalonenot set (plain text)Same fields as the encryption section of ov.confEncrypts stored data; see Encryption. Embedded gateways use the server's section
management_apiBothtruetrue, falseRegisters the gateway administration routes; disabling it also removes the standalone OpenViking admin proxy and Studio. Model routes and /health remain available
management_keyBothemptyAt least 32 charactersOptional gateway management key
openviking_keysBothfalsetrue, falseLets clients use a user's OpenViking API key in place of a gateway key, with the account's default context profile and every enabled upstream; see Use an OpenViking API key directly
tenancyBothaccountaccount, keyPartitions OpenViking-key requests by account or by key; key requires management_api: false
default_upstreamsBoth{}Object mapping stable IDs to upstream settingsUpstreams for OpenViking keys when the account stores none; see Deployment default upstreams
default_profileBothBuilt-in profile defaultsContext profile settingsUsed when the account has no profile with the ID default; also the initial profile seeded in embedded dev mode
min_server_versionBoth0.4.16Version stringLowest OpenViking Server version a standalone gateway accepts
session_ttl_secondsBoth86400 (1 day)3600 or moreSeconds of inactivity before a conversation expires; also the fixed lifetime of cached OpenViking keys and their user records. Retention says what a conversation continued after that loses.
response_ttl_secondsBoth2592000 (30 days)60 or moreSeconds to remember which upstream created a Responses response
request_log_sinkBothstorestore, stdout, fileWrite request logs to storage, as one flushed JSON line per record on stdout, or as the same lines to request_log_path from a background thread; see Monitoring. The file sink needs one worker process: workers: 1 standalone, one server worker embedded
request_log_pathBothemptyFile pathFile for the file sink; required with it
request_log_rotation_interval_hoursBoth11 or moreHours after which the file sink rotates its file, as the server's usage log does; old files are named after the UTC hour they started, such as requests.jsonl.2026-01-31_13. The parent directory is created if missing
request_log_backup_countBoth1680 or moreOld file sink files kept; 0 keeps all
request_log_limitBoth100001 or moreMaximum records read for an overview; also Redis's retained request-log count per account. SQLite writes are not trimmed by this count. Each overview read scans the loaded records. For capacity planning, roughly 10 MB per 10,000 Redis records is a starting estimate; actual size depends on per-call metadata. Does not retain stdout/file logs
snapshot_interval_secondsBoth00 or moreSeconds between status lines with this process's counters. 0 writes none
trusted_host_headersBothfalsetrue, falseRecord X-OpenViking-Resource-Id and X-OpenViking-Request-Source from a service in front of the gateway as resource_id and request_source; see Host integration contract. Turn it on only when clients cannot reach the gateway directly; see Headers from a host
log_retention_daysBoth301 or moreDays to keep request logs in storage; stdout and file retention is managed by the log collector
max_body_bytesBoth268435456 (256 MiB)1,024 or moreSize limit for requests and uploads, in bytes
upstream_timeout_secondsBoth600More than 0Seconds the gateway waits on the provider: for a reply to start (connecting, sending the request, receiving the headers), and then for each further part of the reply. A reply that keeps arriving is not cut off, however long it runs. When the wait runs out the client gets 504 upstream_timeout, or an error event at the end of a stream that has started
prepare_timeout_secondsBoth00 or moreSeconds the gateway may spend adding memory to a request (session lookup, recall, profile, tools) before it forwards the request without memory, flagged prepare_timeout. A compaction summary call does not count. 0 means no limit
summary_timeout_secondsBoth00 or moreTotal seconds for one compaction summary call; see How the summary is written. 0 means upstream_timeout_seconds
openviking_budget_secondsBoth00 or moreOne deadline per request, counted from its arrival, for the key check, recall, the profile and the tool list; see OpenViking is degraded. 0 keeps each call's own timeout
openviking_breaker_failuresBoth00 or moreConsecutive unanswered OpenViking calls for one account after which its requests skip OpenViking for openviking_breaker_seconds; then one trial call decides. 0 turns this off
openviking_breaker_secondsBoth30More than 0How long an account's OpenViking calls are skipped before a trial call
health_interval_secondsBoth601 or moreSeconds between OpenViking status checks
openviking_auto_commitBothfalsetrue, falseLeave committing saved conversations to OpenViking's session auto-commit instead of the gateway; its idle commit needs memory.session_auto_commit.enabled: true on the OpenViking server. See Save conversations
max_inflight_requestsBoth00 or moreModel requests one process serves at once; a request above it gets HTTP 503 gateway_overloaded. 0 sets no limit; see Scaling
client_rulesBoth{} (packaged rules only)See Client rulesText added to or removed from what the gateway recognizes as housekeeping requests and client-inserted messages

For example, a standalone gateway.conf can route OpenViking keys before any account is configured:

json
{
  "openviking_url": "http://openviking:1933",
  "openviking_keys": true,
  "default_upstreams": {
    "ark-chat": {
      "name": "Ark Chat",
      "protocol": "chat",
      "base_url": "https://ark.cn-beijing.volces.com/api/v3",
      "api_key": "$ARK_API_KEY",
      "models": ["your-model-id"]
    }
  },
  "default_profile": {"max_tokens": 2400}
}

Storage providers ​

The default is local SQLite, with no external service. storage.kernel and storage.management each select sqlite or redis; Redis ports share one client and the settings in storage.redis. Install pip install "openviking[expiry]" for Redis; the official image already includes it. Standalone Redis and Redis Cluster are tested. Sentinel configuration is accepted but is not covered by gateway CI.

json
{
  "storage": {
    "kernel": "redis",
    "management": "redis",
    "key_prefix": "ovgw:",
    "redis": {
      "mode": "standalone",
      "endpoints": ["rediss://redis.example.com:6379"],
      "username": "gateway",
      "password_env": "OPENVIKING_GATEWAY_REDIS_PASSWORD",
      "pool_size": 32,
      "command_timeout_ms": 5000
    }
  },
  "session_ttl_seconds": 604800
}

OPENVIKING_GATEWAY_STORAGE accepts the same storage object as JSON. Inject the password through the named environment variable, for example from a Kubernetes Secret. key_prefix defaults to ovgw: and cannot contain {, }, *, ?, [, ] or \; every key starts with that prefix plus v1:. Give separate deployments different prefixes.

storage.redis reuses OpenViking's RedisCacheConfig: mode, endpoints, username, password_env, legacy password, db, pool_size, connect_timeout_ms, command_timeout_ms, default_ttl_seconds, tls_insecure_skip_verify, and the Sentinel fields master_name, sentinel_username, sentinel_password_env, sentinel_password. The shared command timeout defaults to 5000 ms and must be greater than zero; default_ttl_seconds does not set gateway retention. URLs contain only a scheme, host and port; use the dedicated credentials and db fields. For Cluster use mode: "cluster", multiple seed endpoints and db: 0. TLS follows the rediss:// scheme. For a private CA, mount its certificate and set SSL_CERT_FILE to its path (with Helm, use extraVolumes and extraVolumeMounts).

Give the gateway its own Redis instance with volatile-lru eviction and AOF; the redis.conf settings and what to monitor are in Redis memory policy.

Create an ACL user with the following command, replacing the password and prefix. Run it on every Cluster node, because ACLs are not replicated between nodes:

bash
redis-cli ACL SETUSER gateway reset on '>replace-with-secret' '~ovgw:*' \
  +@read +@write +@scripting +@connection +@transaction +ping +time +scan +unlink

For Cluster also grant '+cluster|slots' '+cluster|shards'. +time is required by Lua scripts. These permissions and prefix isolation are exercised in CI. Application commands do not retry after connection errors because a failed write may already have reached Redis.

Environment variables ​

Every gateway field can be set as an environment variable named OPENVIKING_GATEWAY_ plus the field name in upper case, in both forms:

bash
OPENVIKING_GATEWAY_PUBLIC_URL=https://ov.example.com
OPENVIKING_GATEWAY_MANAGEMENT_KEY='<management-key>'
  • Environment variables override the file. A non-empty variable wins over the value in the file; an empty variable counts as unset.
  • Values that start with tcp:// or udp:// are ignored, so the variables Kubernetes sets for a Service named openviking-gateway (such as OPENVIKING_GATEWAY_PORT=tcp://…) do not override the file.
  • A value in the file can also be a "$VAR" reference, resolved from the environment.
  • The encryption block can only be set in the file.
  • client_rules, storage, default_upstreams and default_profile take whole sections as JSON, for example OPENVIKING_GATEWAY_CLIENT_RULES='{"auxiliary_patterns":{"add":["You are the Acme title writer"]}}' or OPENVIKING_GATEWAY_DEFAULT_PROFILE='{"max_tokens":2400}'.
  • Containers usually need no file: set the fields they need as variables.

Validation ​

WhatRule
openviking_url and public_urlHTTP(S), with no credentials, query or fragment
Upstream base_urlIts own rules; see Endpoint
management_keyAt least 32 characters once $VAR references are resolved; an unresolved $VAR fails
tenancykey requires management_api: false; it has no effect when openviking_keys is off
client_rulesEvery added pattern must be a valid Python regular expression; added tag names start with an ASCII letter and use only ASCII letters, digits, _, ., : and -
Unknown fieldsFail validation
Removed fieldsIgnored, with a startup warning: encryption_key_env, session_ttl_days (replaced by session_ttl_seconds), capture_concurrency, capture_delivery_records, request_log_max_bytes (the file sink rotates by time), and in ov.conf also the v0.5 fields listed in Migration

Client rules ​

The gateway tells housekeeping requests and the messages clients insert on the user's behalf apart from real user messages by fixed text, listed in the packaged client-rules.json. When a client's title or summary requests show up as New message in the request log, or a real message is treated as housekeeping, add or remove entries in client_rules:

json
{
  "gateway": {
    "enabled": true,
    "client_rules": {
      "auxiliary_patterns": {
        "add": ["You are the Acme title writer"],
        "remove": ["Create a short.{0,40}title"]
      },
      "noise_tags": { "add": ["acme-context"] }
    }
  }
}

In gateway.conf, client_rules sits at the root, without the gateway wrapper.

ListEntriesWhat a match does
auxiliary_patternsRegular expressions, ignoring caseEach is matched separately against the Messages system field, the Responses instructions, the latest user message and text a client appended after the last tool result. A match makes the request Housekeeping. System and developer messages inside Chat Completions messages or Responses input are not checked, so for those clients match text in the user message.
noise_patternsRegular expressions, case-sensitiveIgnored when the gateway reads the conversation: left out of request classification, the memory search and saved messages and tool results, but still sent to the model unchanged. A user message left empty is not a new user message, so the request continues the turn.
noise_tagsTag names<tag …>…</tag> blocks, in any letter case, handled the same way as noise_patterns.
plugin_tagsTag namesA complete <tag>…</tag> block outside code, in the system prompt or a client message, marks an OpenViking memory plugin in the client. For the rest of that conversation the gateway only forwards requests: no memory, no OpenViking tools, nothing saved (see When both are in use). Add only a tag the plugin itself writes.
  • add appends to the packaged list and remove takes entries out of it. Write a removal exactly as it appears in client-rules.json. A removal that matches nothing, for example after an upgrade changed the entry, is ignored with a startup warning. The packaged list cannot be replaced as a whole, so entries added in later releases keep working.
  • Match text only the client writes. Use a full sentence from the client's own prompt rather than a short phrase. A user message that matches makes its whole turn housekeeping, so none of it is searched for or saved; a pattern that also matches the main conversation's system prompt does this to every request. Anchor a noise pattern to the whole message ("\\A…\\Z" in JSON) so it never cuts text out of a real message.
  • Changes take effect at startup. Restart the server or the standalone gateway after editing.

Context profile settings ​

In Studio: Profiles → a profile. The tables follow the editor's sections, with the Studio label first and then the name in the management API, which calls context profiles policies. Name (name, default Default) is the profile's display name; what each section does is explained in Context profiles. Let clients override settings (client_overrides, default true) lets clients change every other setting for a new conversation with the X-OpenViking-Context header; see Let clients override settings. The two switches below it, which that header cannot set either, are in Secret sealing.

Secret sealing ​

Explained in Secret sealing in the gateway.

Studio labelAPI nameDefaultRangeMeaning
Seal secretsseal_secretsfalseSend registered credentials, and new tokens the user types, to the model only as references; give client tools the real values. Needs OpenViking Server 0.5.7 or later. A request that cannot be sealed is refused. X-OpenViking-Context cannot set it.
Also store secrets found in tool outputenroll_tool_secretsfalseAlso store new tokens from tool results and attached blocks. Only with seal_secrets. X-OpenViking-Context cannot set it.

Recall memory ​

Explained in Recall memory.

Studio labelAPI nameDefaultRangeMeaning
Recall memoryrecalltrueSearch memory for each new user message.
User profile at conversation startprofiletrueProvide the user profile when a conversation starts, independently of recall.
Soul at conversation startsoultrueProvide the user's memories/soul.md when a conversation starts and tell the model to follow it, independently of recall. It is added whole, outside the opening context budget.
Opening context budgetprofile_max_tokens40000–32,000Separate budget for the profile and catalogs; 0 leaves them out. Catalogs need the OpenViking read tool (openviking_read).
Show recall summaryshow_recallfalseStart the reply with a summary of what OpenViking added, or why recall failed. The model never sees it.
Sourcescontext_typesmemory, resource, skillAt least one while recall is on (checked by Studio only)What to search: memories, resources, skills.
Budget per messagemax_tokens160064–32,000Most tokens added to one message.
Budget per context windowsession_max_tokens300000 or moreMost tokens added within one context window; resets after each compaction. 0 turns recall off.
Relevance thresholdscore_threshold0.350–1Lowest relevance score accepted.
Time limitrecall_timeout2 (seconds)More than 0, up to 30How long a search may take before the message goes on without memory.
Query lengthquery_max_chars80003–32,000Characters of the message used as the search query.
Peer scoperecall_peer_scopeallall, actorall: the request's peer comes first, and other peers' memories can still be recalled. actor: recall and OpenViking tools reach only the user's own memories and the request's peer's; see Recall only the current peer.
Limit by categoryquotas{} (off)Keys: events, entities, preferences, experiences, resources, skills; when set, at least one above 0 (checked by Studio only)Most entries per category; only categories above 0 are searched.

The management API saves context_types and the quotas keys without checking them. An unknown quotas key makes every recall fail, because OpenViking rejects it.

Save conversations ​

Explained in Save conversations. With openviking_auto_commit: true, OpenViking commits by these values: the gateway gives them to OpenViking as the session's auto_commit_policy when it first saves to the session, and again on its first save after the setting changes.

Studio labelAPI nameDefaultRangeMeaning
Save conversationscapturetrueSave finished turns to OpenViking.
Commit when idle foridle_seconds1800 (seconds)1 or more; with openviking_auto_commit, values below 300 count as 300Time after the conversation's last finished turn at which everything left in the session is committed. With openviking_auto_commit, needs memory.session_auto_commit.enabled: true on the OpenViking server.
Commit aftercommit_tokens1000001 or more; with openviking_auto_commit, values above 1,000,000 count as 1,000,000Uncommitted tokens at the end of a turn at which the session is committed at once.
Keep recent messageskeep_recent_messages100–1,000Latest messages a Commit after commit leaves in the session.
(API only)capture_memory_typesnull (inherit the user's policy on Server 0.5.0+)Memory type names, such as preferences or events; [] extracts noneMemory types OpenViking extracts from saved conversations. An explicit list sets a session policy.

The management API saves capture_memory_types without checking the names. OpenViking rejects a name it does not know, or a type it has disabled, when the gateway creates the conversation's OpenViking session: nothing from the conversation is saved, and every request that ends a turn shows Failed with the reason openviking_http_400. A corrected profile reaches only conversations that start afterwards. cases and trajectories are extracted only together with experiences: listing experiences adds both, and without it they are dropped, so a list of only those two extracts nothing.

Long conversations ​

Explained in Long conversations in the gateway.

Studio labelAPI nameDefaultRangeMeaning
CompactioncompactiontrueReplace the earlier part of a conversation with a summary near the context window.
Compact atcompaction_threshold0.90.5–0.98Share of the context window that triggers compaction.
Summary lengthsummary_max_tokens80001,000–32,000Most tokens in one summary.
Default context windowcontext_windowNot set (1,000,000 assumed)1,024 or moreWindow used when the upstream does not list the model; see Set the model's context window.
Agent-managed context windowsagent_windowsfalseExperimental. Let the model start new context windows itself; needs OpenViking tools.
Soft reminder atwindow_soft_ratio0.70.3–0.95, below window_hard_ratioShare of the window at which the model is reminded to start a new window soon.
Hard reminder atwindow_hard_ratio0.850.4–0.97Share of the window at which the model is told to start a new window now.

OpenViking tools ​

Explained in Choose tools and Limits.

Studio labelAPI nameDefaultRangeMeaning
OpenViking toolsgateway_toolstrueOffer OpenViking tools for Chat Completions, full-history Responses and Anthropic Messages.
Tools (unchecked boxes)disabled_tools[] (none)OpenViking tool names, without openviking_Tools new conversations do not get; every other available tool is offered, including ones added later.
Show tool callsshow_tool_callstrueAdd a one-line notice to the reply for each OpenViking tool call.
Rounds per requesttool_max_roundsnull (no limit)1 or moreTool rounds after which further OpenViking calls are refused.
Time limit per calltool_timeout_seconds30 (seconds)More than 0, up to 120A slower call returns an error to the model.
Result sizetool_result_bytes65536 (bytes)1,024–1,048,576Longer results are cut off before the model sees them.
Total timetool_total_secondsnull (no limit)More than 0Seconds after which a request still using tools fails.
Token budgettool_total_tokensnull (no limit)1,024 or moreEstimated tokens tool calls and results may add to one request before further OpenViking calls are refused.

API requests that omit disabled_tools get an empty list, so with gateway_tools on every available tool is offered.

Upstream settings ​

In Studio: Upstreams → an upstream. The tables follow the editor's four sections; what each field does is explained in Upstreams.

Endpoint ​

Studio labelAPI nameDefaultAccepted valuesMeaning
Namename— (required)Display name.
Providervendorgenericgeneric, anthropic, openai, deepseek, ark (Volcano Engine Ark), byteplus (BytePlus ModelArk)Studio offers only the protocols a provider supports; the API accepts any pair.
Protocolprotocol— (required)anthropic (Anthropic Messages), chat (Chat Completions), responses (Responses)The API this upstream speaks.
Base URLbase_url— (required)HTTP(S) URLProvider address; defaults are in What an upstream is and path rules in Endpoint.
Append protocol endpoint pathappend_endpoint_pathtrueAppends the selected protocol's path; when false, uses base_url as the complete request URL.

Credentials ​

Studio labelAPI nameDefaultAccepted valuesMeaning
Who provides the API keyauth_modemanagedmanaged (the gateway holds the API key), passthrough (each client sends its own key)See Credentials.
Send the key askey_headerauthorizationauthorization (Bearer), api-key, x-api-keyIgnored when base_url contains {api_key}.
API keyapi_keyemptyWrite-only; see Credentials.
Extra headersheaders{}Header name → valueWrite-only; see Credentials.
This key is a Coding Plan or subscription keycoding_planfalseRejects requests to this upstream unless allowed.
Allow this plan through the gatewayallow_coding_planfalseAllows use of a key marked as Coding Plan.

Models ​

Studio labelAPI nameDefaultAccepted valuesMeaning
Modelsmodels[]Model namesModel names served; empty accepts any name.
Model aliasesaliases{}Name clients use → model sent to the upstream
Context windowscontext_windows{}Model → tokens, each at least 1,024Each model's context window; see Set the model's context window.

Prices ​

These fields are accepted both by the upstream API and in default_upstreams. See Prices for model lookup, authentication exclusions and the upgrade order.

Studio labelAPI nameDefaultAccepted valuesMeaning
Pricesprices{}Nonempty model name → price objectAll prices are per million tokens; estimates use current prices when logs are read.
Currencycurrency""Free label, at most 16 charactersFor example USD or CNY; labels are not converted or added together.

Each price object requires input and output. Optional cache_read and cache_write default to null, meaning use input. All supplied numeric prices must be finite and at least zero; unknown fields are rejected. For example, an upstream can include:

json
{
  "prices": {
    "example-model": {"input": 2, "output": 8, "cache_read": 0.2}
  },
  "currency": "USD"
}

Routing ​

Studio labelAPI nameDefaultAccepted valuesMeaning
List positionpriority0IntegerHigher values come first for new conversations; ties use ascending upstream ID order. In Studio, set this by moving rows in the upstream list.
Use the next upstream on failurefailoverfalsetrue, falseAllows leaving this upstream on eligible failures before the client response starts; applies separately to each hop. See Failover for triggers, target restrictions and rolling upgrades.
EnabledenabledtrueA turned-off upstream receives no requests.
Allow OpenViking toolsallow_gateway_toolstrueWhether OpenViking tools can be offered through this upstream.
Restore reasoning the client dropsreplay_reasoningnull (follows the provider)null, true, falsePuts reasoning the client dropped back on earlier replies. null means on for deepseek, ark and byteplus and off for other providers; true or false overrides that. Studio saves null while the switch matches the provider default.
Minimum cacheable promptcache_min_tokens10240 or moreArk and ModelArk only; affects how cache eligibility is reported.

Next steps ​

Open source under the AGPL-3.0 License. Font licenses