PromptGate 0.2 — changelog
Archived from CHANGELOG.md, which keeps the unreleased changes and the latest release.
0.2.0 - 2026-10-18
Section titled “0.2.0 - 2026-10-18”The teams release: one gateway that routes by name, limits and budgets
traffic per key, falls back when a provider fails, translates between
API formats, and exports Prometheus metrics. Every feature is configured
in promptgate.yaml and reloads without a restart, except the metrics
listener and the budget time zone.
- Model aliases —
models:in YAML maps a name (fast, or explicitlypromptgate:fast) to provider + model, an optional system prompt and default parameters. The system prompt goes into each API’s slot (Chatsystemmessage, Responsesinstructions, Anthropicsystem) and only when the client sent none; client parameters always win. Unknown explicit aliases return 400. - Rate limits —
limits:caps requests perpg_key, model alias and provider (60/m,{requests: 600/m, burst: 50},"*"for every name in a scope). Over the limit: 429 withRetry-After, in the SDK’s error shape, logged like any request. In-memory token buckets (85 ns per check, no allocations); reloads keep counters, refused requests are not charged to earlier buckets. - Budgets —
budgets:caps spend per calendar day and month in USD and/or tokens for all traffic (total), perpg_key and per provider ("*"for every name), withbudgets.timezone. A used-up budget answers 402 (insufficient_quota/billing_error) before the request reaches a provider. Counters live in memory and are restored from the request log on start; checking costs nothing measurable. - Fallbacks — an alias lists
fallbacks(other aliases orprovider:model) tried in order when its provider answers with a status infallback_on(default429,5xx,unreachable) before any byte reached the client, or is at its rate limit or out of budget (spillover). Passthrough keys never travel to another provider. Failed attempts are logged (after anthropic 529;fallbackinlogs --json); the request log schema moves to v2 automatically. - Format translation — chat requests reach every provider in either format: Anthropic clients (Claude Code) run on OpenAI, every OpenAI-compatible provider, Gemini and Cohere; OpenAI clients on Gemini and Cohere natively. Requests, answers, streams, tool calls, images, JSON output, usage and errors are translated through a canonical message model; content a format can’t express is refused with 400. Same-format traffic stays byte for byte. Fallback chains may mix formats.
- Native Gemini and Cohere adapters — provider types
gemini(generateContent,x-goog-api-key) andcohere(v2 Chat), presetsgemini-nativeandcohere(CO_API_KEY); Cohere prices in the price table. Presets can name their price table entry (prices). - Guided
setup— in a terminal, setup asks for the default provider (keys found in the environment are marked), its API key (from the environment, or typed hidden and stored in the config), the listen address and a firstpg_key with its name; it confirms before overwriting.--yesand non-terminal runs ask nothing, as before. - Logo and version on
start,info,setup,update,installandversion— only in a terminal, never in--json, pipes or services;NO_COLORrespected. - Prometheus metrics —
metrics.listen(orstart --metrics,PROMPTGATE_METRICS_LISTEN) serves/metricson a separate port: requests by route, provider, model, key and status; latency and time-to-first-byte histograms; tokens and estimated cost; fallback requests and failed attempts by reason; in-flight requests; budget spend per day and month. Optional bearertoken,max_seriesagainst client-driven label growth, configurablebuckets. No dependencies, no allocations and no measurable overhead per request. promptgate budgets— spend against each budget, with % used;--json.logging.stats_retention(default90d) — the per-minute aggregates behindstatsand budget history are kept separately from request rows.
Changed
Section titled “Changed”- Anthropic paths no longer refuse non-Anthropic providers; they
translate.
count_tokensand the non-chat OpenAI paths still need a provider of their own format (400 otherwise). - Translated requests don’t forward the client SDK’s vendor headers
(
anthropic-*,openai-*,x-stainless-*). - Rate-limit and budget refusals use the SDK error types
(
rate_limit_error,insufficient_quota/billing_error) instead of a generic gateway error. - Per-minute aggregates are no longer deleted with
logging.retention; they followlogging.stats_retention. - The agent proxy handler is now a pipeline of stages (authenticate, read body, resolve, admit, budget, rate limit, forward). Provider rate limits and budgets are checked per candidate, so a fallback can take over.
Known limitations
Section titled “Known limitations”- The native Gemini and Cohere adapters are tested against their
documented request, response and stream shapes, not yet against the
live APIs. The OpenAI-compatible
geminipreset is unchanged. - Translation covers chat routes only; embeddings, completions, the
Responses API and
count_tokensneed a provider of their own format. - Rate-limit and budget counters live in one process; shared counters for several nodes are planned.
Performance
Section titled “Performance”Every v0.2 feature on at once — alias with fallback chain, rate limits,
budgets, request log, metrics scraped every second — measured with the
v0.1 matrix (bench/results/2026-10-18-go-v0.2.0-release.md):
- Gateway overhead at p50: 0.15 ms buffered, 0.13 ms streamed (v0.1.0: 0.14 / 0.12 ms).
- Throughput with 16 concurrent clients: ≈ 33,000 req/s, 0 errors.
- Rate-limit check 85 ns, metrics recording 160 ns, both without allocations; budget checks and fallbacks cost nothing measurable while providers are healthy.
- Translating a streamed event between formats: ≈ 1 µs.
- 15.4 MB binary (6.2 MB gzip), ready in ≈ 60 ms, ≈ 32 MB RAM at idle.