Initialize Meted
Create and configure meted.config.json.
npx @meted/cli init
What it asks
Which environment variable holds your provider key? Default
OPENAI_API_KEY. Meted reads the key from the environment at request time and
never writes it to disk.
Provider base URL? Default https://api.openai.com/v1. Change it to point
at Azure OpenAI, a proxy, or a local model server that speaks the OpenAI API.
Starting mode? Default observe, which reports an allocation without
applying a ceiling. See Policies for the other three.
Non-interactive
meted init --yes
Accepts every default. It also runs this way when stdin is not a terminal, which covers CI, Dockerfiles and scripts.
meted init --yes \
--mode observe \
--api-key-env AZURE_OPENAI_KEY \
--base-url https://my-resource.openai.azure.com/openai/v1
What it writes
// meted.config.json, commit this
{
"$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, "timeoutMs": 250, "options": {} },
"policy": {},
"cloudflare": {
"workerName": "meted-gateway",
"compatibilityDate": "2025-01-01",
"routes": [],
},
}
apiKeyEnv records the name of the environment variable holding the provider
key. The key itself is read at request time and is not written to this file.
See Configuration for every field.
Running it again
meted init refuses to overwrite an existing configuration. To change the mode,
use meted mode. To start over:
meted init --force