Skip to content

Architecture decision records ​

This page lists the design decisions of Tollgate.

Each record has a number, a status, and a date. To change a decision, write a new record that supersedes the old record. Do not edit the decision of an accepted record.

ADRTitleStatus
0001Use Go and one static binaryAccepted
0002Pass request bodies through without changesAccepted
0003Estimate input tokens from the body sizeAccepted
0004Keep limit state behind one store interfaceAccepted
0005Reserve the estimate, then settle the real costAccepted
0006Rate limits fail open, hard budgets fail closedAccepted
0007Fall back only before the first byteAccepted
0008Use sticky routing and an exact cache, not a semantic cacheAccepted
0009Relay streams as a teeAccepted
0010Log metadata onlyAccepted
0011Store money as integer micro-USDAccepted
0012Protect keys and the build pipelineAccepted
0013Drain open streams before shutdownAccepted
0014Use encoding/json/v2Accepted
0015Keep SDK tests in a separate Go moduleAccepted
0016Define the four timeouts of an upstream requestAccepted
0017Edit request bodies in place, without a new encodeAccepted
0018Reserve a capped output, and document the overspend boundAccepted
0019Rebuild the spend from the usage file at startAccepted
0020Keep /readyz ready when the limit store failsAccepted
0021Apply ordered retries before the first byteAccepted
0022Limit extra attempts with a local retry budgetAccepted
0023Keep circuit breakers in each processAccepted
0024Use Vertex AI for the Claude cloud hostAccepted
0025Serve metrics and profiles on a separate admin portAccepted
0026Export traces as OTLP JSON with an in-house exporterAccepted

| 0027 | Derive session IDs from the original prompt prefix | Accepted | | 0028 | Keep the last successful target for the provider cache lifetime | Accepted | | 0029 | Cancel streams when estimated cumulative cost exceeds their hard budget room | Accepted | | 0030 | Cache exact responses in bounded tenant-scoped memory | Accepted | | 0031 | Mask JSON strings with request-local placeholders | Accepted | | 0032 | Serve a read-only admin API from a bounded event index | Accepted | | 0033 | Embed the dashboard build in the Go binary | Accepted |

Template ​

Use this structure for a new record. Copy the next number.

markdown
# ADR NNNN: Title in the imperative

- Status: Proposed | Accepted | Superseded by NNNN
- Date: YYYY-MM-DD
- Supersedes: none | NNNN

## Context

The problem and the facts that the decision depends on.

## Decision

What Tollgate does.

## Alternatives

1. Each alternative and the reason not to use it.

## Consequences

- What changes because of the decision.

Released under the Apache-2.0 license.