meted dev

Run the gateway locally.

meted dev

Starts the Meted gateway on 127.0.0.1:8787. Point your OpenAI client's baseURL at http://localhost:8787/v1.

Options

Flag
--port <n>Port to listen on. Default 8787
--host <addr>Address to bind. Default 127.0.0.1
--mode <mode>Override the configured mode for this run only
--quietDo not log each request

The banner

Meted 0.1.0  →  http://127.0.0.1:8787/v1

  Mode        observe    Compute and report the allocation. No ceiling is set on the request.
  Engine      baseline-heuristic 0.1.0 (open source, baseline)
  Provider    openai     https://api.openai.com/v1
  Credential  OPENAI_API_KEY is set

When the credential is missing, the banner reads OPENAI_API_KEY is not set in red, and requests are rejected with a 401 naming that variable.

The live log

ID    TASK          ACTUAL  TARGET    DIFF    TOTAL  ALLOCATION
a19f  definition       184      38    -79%    902ms  observe_mode
b91c  coding           722     680     -6%     3.1s  applied 960
7daa  fact              91      18    -80%    410ms  observe_mode  truncated

A response with finish_reason: "length" is flagged truncated. An engine failure is flagged engine:<kind>.

The log goes to stdout. Redirect it to keep it:

meted dev | tee meted.log

To collect the same fields as structured data, embed the gateway and use onRecord.

Routes

POST /v1/chat/completionsSized, allocated, forwarded
ANY /v1/*Proxied to the provider
GET /_meted/healthConfiguration and engine status

Everything Meted decided about a request comes back on that request, as x-meted-* headers. There is no endpoint to read history from.

Shutdown

On Ctrl-C, meted dev stops accepting connections, lets in-flight requests finish streaming so their token counts are measured rather than guessed, and exits.

Security

Was this page helpful?