Configuration

Every field in meted.config.json, and every environment override.

meted.config.json lives at the root of your project and is meant to be committed. apiKeyEnv holds the name of the environment variable your provider key lives in, never the key.

{
  "$schema": "https://meted.dev/schema/v0.1.json",
  "version": 1,
  "mode": "observe",
  "provider": {
    "id": "openai",
    "baseUrl": "https://api.openai.com/v1",
    "apiKeyEnv": "OPENAI_API_KEY",
    "headers": {},
  },
  "gateway": {
    "host": "127.0.0.1",
    "port": 8787,
    "requestTimeoutMs": 120000,
    "responseHeaders": true,
  },
  "engine": {
    "module": null,
    "wasm": null,
    "exportName": null,
    "timeoutMs": 250,
    "options": {},
  },
  "policy": {},
  "cloudflare": {
    "workerName": "meted-gateway",
    "accountId": null,
    "routes": [],
    "compatibilityDate": "2025-01-01",
  },
}

A broken configuration never stops a running gateway. Unreadable fields fall back to their defaults and are reported as warnings.

mode

observe | conservative | balanced | aggressive. Default observe. See Policies.

provider

FieldDefault
idopenaiAdapter id
baseUrlOpenAIUpstream base URL
apiKeyEnvOPENAI_API_KEYName of the variable holding the key
headers{}Extra headers forwarded upstream. Non-secret only

gateway

FieldDefault
host127.0.0.1Bind address
port8787Port
requestTimeoutMs120000Upstream timeout. Streams are exempt once started
responseHeaderstrueAdd x-meted-* headers

engine

FieldDefault
modulenullPackage name or path exporting an engine
wasmnullPath to a WASM engine
exportNamenullNamed export to use
timeoutMs250Past this, the engine counts as failed
options{}Passed to the engine factory

policy

Overrides for the current mode. Every field is optional.

Field
ceilingMultiplierMultiplier on the engine's ceiling
floorTokensThe applied ceiling is never lower than this
minConfidenceBelow this, forward unchanged
lengthHintAppend a length hint to the prompt
{
  "mode": "balanced",
  "policy": { "minConfidence": 0.7 },
}

cloudflare

Used by meted deploy.

FieldDefault
workerNamemeted-gatewayWorker name
accountIdnullWritten into wrangler.toml when set
routes[]Route patterns for the Worker
compatibilityDate2025-01-01Workers compatibility date

Environment overrides

Environment variables win over the file, so one committed config can behave differently per deployment.

VariableOverrides
METED_MODEmode
METED_HOST, METED_PORTgateway.host, gateway.port
METED_PROVIDER_BASE_URLprovider.baseUrl
METED_PROVIDER_API_KEY_ENVprovider.apiKeyEnv
METED_ENGINE_MODULEengine.module
METED_ENGINE_WASMengine.wasm
METED_DEBUGPrint stack traces on CLI errors

Discovery

Meted walks up from the working directory looking for meted.config.json, so commands work from anywhere inside a project. With no config file, defaults are used and the CLI prints No meted.config.json here. Using defaults.

Was this page helpful?