Skip to content
Last updated December 3, 2026

PromptGate 0.2 — changelog

Archived from CHANGELOG.md, which keeps the unreleased changes and the latest release.

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 explicitly promptgate:fast) to provider + model, an optional system prompt and default parameters. The system prompt goes into each API’s slot (Chat system message, Responses instructions, Anthropic system) and only when the client sent none; client parameters always win. Unknown explicit aliases return 400.
  • Rate limits — limits: caps requests per pg_ key, model alias and provider (60/m, {requests: 600/m, burst: 50}, "*" for every name in a scope). Over the limit: 429 with Retry-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), per pg_ key and per provider ("*" for every name), with budgets.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 or provider:model) tried in order when its provider answers with a status in fallback_on (default 429, 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; fallback in logs --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) and cohere (v2 Chat), presets gemini-native and cohere (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 first pg_ key with its name; it confirms before overwriting. --yes and non-terminal runs ask nothing, as before.
  • Logo and version on start, info, setup, update, install and version — only in a terminal, never in --json, pipes or services; NO_COLOR respected.
  • Prometheus metrics — metrics.listen (or start --metrics, PROMPTGATE_METRICS_LISTEN) serves /metrics on 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 bearer token, max_series against client-driven label growth, configurable buckets. No dependencies, no allocations and no measurable overhead per request.
  • promptgate budgets — spend against each budget, with % used; --json.
  • logging.stats_retention (default 90d) — the per-minute aggregates behind stats and budget history are kept separately from request rows.
  • Anthropic paths no longer refuse non-Anthropic providers; they translate. count_tokens and 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 follow logging.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.
  • 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 gemini preset is unchanged.
  • Translation covers chat routes only; embeddings, completions, the Responses API and count_tokens need a provider of their own format.
  • Rate-limit and budget counters live in one process; shared counters for several nodes are planned.

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.
Was this page helpful?