Skip to content
Last updated December 3, 2026

PromptGate 0.4 — changelog

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

The end-user release: one key can now serve many people. Each request names the end user it is for — in the X-PromptGate-User header or in the provider’s own field the app already sends — and PromptGate logs it, reports usage per user, limits and budgets every user on their own, and can tell OpenAI and Anthropic who it is, hashed. Each key decides whether user ids are optional, required or ignored.

  • End users — a request can name the end user it is for: the X-PromptGate-User header, or the provider’s own body field (OpenAI safety_identifier / user, Anthropic metadata.user_id), in a configurable order (users.sources). The id shows in the console as user=…. Each key decides with users: optional | required | ignore (promptgate keys create --users required), so a backend key must name a user and a key held by end users can’t claim one. An invalid header gets 400 in the client’s error format; the header is never forwarded. users.log: hashed keeps only a keyed hash. See docs/users.md.
  • Usage per end user — the request log stores the user (schema v4, migrated on start), promptgate logs --user <id> filters by it, and promptgate stats --by user [--key k] [--top n] lists requests, tokens and cost per user from new daily per-user totals, which stay fast with many users and keep for logging.stats_retention. metrics.user_label: true adds a user label to the request, token and cost counters (off by default: every user is a series). stats also gains --top n.
  • Rate limits per end user — limits.users with "*" for every user and named ids for exceptions, counted per key and user, checked after the key’s own limit. About 0.1 µs per check and ≈ 130 bytes per active user at 100,000 users. The 429 names no id, so hashed logs stay free of ids.
  • Budgets per end user — budgets.users caps each user per day and month (USD and/or tokens), counted per key and user; 402 until the period resets. Spend is restored after a restart from the daily per-user totals. promptgate budgets lists the users closest to their limits (--top n), and with metrics.user_label the spend gauges include users.
  • User passed on to the provider — users.forward: hashed | plain sets OpenAI’s safety_identifier (Embeddings, Completions: user) or Anthropic’s metadata.user_id, so the provider’s abuse detection can act on one user instead of the whole API key; also after translation. A value the client set is kept; OpenAI-compatible providers get nothing.
  • Quality gate for end users — the pgfuzz gate runs three new stages against every build: users are isolated by their per-user limits, a required key rejects requests without an id, and an ignore key’s ids are never limited.
  • Faster request parsing — reading model and stream from a request body now skips long strings 8 bytes at a time: 2.6 GB/s instead of 0.36 GB/s, so a 26 KB agent request spends about 10 µs instead of 70 µs before it is forwarded.
  • The rate limiter’s cleanup of idle counters no longer rescans a full shard on every new counter when none of them is idle — with very many active callers, every new one paid a scan of thousands of entries.

Every v0.3 feature plus every user feature on at once — a user per request, per-user limits and budgets, hashed log and forwarding (bench/results/2026-10-19-go-v0.4.0-release.md). Measured on a busy machine, so v0.3.0 was run alongside:

  • Throughput and latency equal to v0.3.0 at 1 client; at 16 clients within 2–8 %, inside the spread of two v0.3.0 runs.
  • The user id costs ≈ 30 ns from the header; a per-user rate check ≈ 0.1 µs with 100,000 active users.
  • Reading model from long requests is ≈ 7× faster (2.6 GB/s).
  • 16.6 MB binary (6.6 MB gzip), ready in 70–90 ms, ≈ 53 MB RAM at idle.
Was this page helpful?