Cloudflare

Running Meted in production, in your own account.

Application

Your Cloudflare Worker

Meted Sufficiency Engine

LLM Provider
meted deploy

The gateway and the Sufficiency Engine run in your Cloudflare account. The Worker forwards each request to the provider base URL you configure, using the credential stored as a Cloudflare secret. Meted operates no infrastructure in this path.

The pieces

WorkersThe gateway
SecretsThe provider credential
WranglerDeployment

What deploy does

  1. Scaffolds meted-cloudflare/ into your repository: wrangler.toml, src/worker.ts, package.json, tsconfig.json, README.md
  2. Prints the plan and asks before running anything
  3. Uploads the secret and deploys the Worker

Files you might have edited are never overwritten once they exist.

Preview deployment

meted deploy --dry-run

Writes the scaffold, prints the plan and runs nothing. Review src/worker.ts and wrangler.toml before running the plan.

Pointing at it

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: 'https://meted-gateway.<your-subdomain>.workers.dev/v1',
})

Meted's /_meted/health route is unauthenticated too. It reports configuration rather than traffic, but block it at the edge or remove it from the Worker if you would rather not publish which model and mode you are running.

Configuration in production

The committed meted.config.json is the baseline; environment variables layer over it, so the same config can behave differently per environment.

# wrangler.toml
[vars]
METED_MODE = "observe"
METED_PROVIDER_BASE_URL = "https://api.openai.com/v1"

Deploy in observe first. Production traffic is not the place to find out that a mode is too tight.

wrangler deploy --var METED_MODE:balanced

Cost

The gateway adds one or two milliseconds of CPU per request, in front of provider calls that take hundreds of milliseconds. There is no storage line at all.

Other runtimes

The gateway is a Hono app.

import { createGateway } from '@meted/gateway'

const gateway = createGateway({ config, engine, apiKey })
export default gateway.app

The same app runs on Deno, Bun, Node behind a load balancer, or in a container. Cloudflare is the path meted deploy scaffolds.

Was this page helpful?