Documentation
¶
Overview ¶
Package tollgate holds the files that the Tollgate binary embeds from the root of the repository. The program itself is in cmd/tollgate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PriceTable ¶
func PriceTable() []byte
PriceTable returns the content of pricing.yaml. Tollgate uses it when the configuration does not set pricing.file.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
fakeprovider
command
Command fakeprovider is a test server that speaks the Anthropic Messages API and the OpenAI Chat Completions API wire formats.
|
Command fakeprovider is a test server that speaks the Anthropic Messages API and the OpenAI Chat Completions API wire formats. |
|
tollgate
command
Command tollgate is a lightweight AI gateway for coding agents.
|
Command tollgate is a lightweight AI gateway for coding agents. |
|
internal
|
|
|
admin
Package admin serves the admin listener of Tollgate: the Prometheus metrics, the admin API, the dashboard and, when the operator turns them on, the net/http/pprof profiles (ADR 0025, ADR 0032, ADR 0033).
|
Package admin serves the admin listener of Tollgate: the Prometheus metrics, the admin API, the dashboard and, when the operator turns them on, the net/http/pprof profiles (ADR 0025, ADR 0032, ADR 0033). |
|
apierror
Package apierror writes Tollgate errors in the format of the API that the client called, because client SDKs parse them.
|
Package apierror writes Tollgate errors in the format of the API that the client called, because client SDKs parse them. |
|
auth
Package auth makes virtual keys and finds the tenant of a key.
|
Package auth makes virtual keys and finds the tenant of a key. |
|
budget
Package budget turns the limits and budgets of a tenant into the counters of the limit store, and estimates the reservation of a request (ADR 0005 and ADR 0018).
|
Package budget turns the limits and budgets of a tenant into the counters of the limit store, and estimates the reservation of a request (ADR 0005 and ADR 0018). |
|
buildinfo
Package buildinfo reports the version, commit and toolchain of the running binary.
|
Package buildinfo reports the version, commit and toolchain of the running binary. |
|
config
Package config loads and validates the Tollgate configuration file.
|
Package config loads and validates the Tollgate configuration file. |
|
fakeprovider
Package fakeprovider implements a test server that speaks the wire formats of the Anthropic Messages API and the OpenAI Chat Completions API.
|
Package fakeprovider implements a test server that speaks the wire formats of the Anthropic Messages API and the OpenAI Chat Completions API. |
|
limiter
Package limiter keeps the rate limit and budget state of Tollgate behind one Store interface (ADR 0004).
|
Package limiter keeps the rate limit and budget state of Tollgate behind one Store interface (ADR 0004). |
|
preflight
Package preflight reads the few request fields that Tollgate needs, and makes small edits to the request body.
|
Package preflight reads the few request fields that Tollgate needs, and makes small edits to the request body. |
|
pricing
Package pricing reads the price table and calculates the cost of a request in micro-USD (ADR 0011).
|
Package pricing reads the price table and calculates the cost of a request in micro-USD (ADR 0011). |
|
provider
Package provider sends requests to upstream providers and reads the token usage of their responses.
|
Package provider sends requests to upstream providers and reads the token usage of their responses. |
|
provider/anthropic
Package anthropic is the adapter and usage meter for the Anthropic Messages API.
|
Package anthropic is the adapter and usage meter for the Anthropic Messages API. |
|
provider/openai
Package openai is the adapter and usage meter for the OpenAI Chat Completions API.
|
Package openai is the adapter and usage meter for the OpenAI Chat Completions API. |
|
provider/vertex
Package vertex is the adapter for Claude on Google Cloud Vertex AI (ADR 0024).
|
Package vertex is the adapter for Claude on Google Cloud Vertex AI (ADR 0024). |
|
redact
Package redact masks personal data in request bodies and restores it in responses (ADR 0031).
|
Package redact masks personal data in request bodies and restores it in responses (ADR 0031). |
|
relay
Package relay sends an upstream response to the client without changes, gives a copy of the bytes to a meter, and applies the four timeouts of an upstream request (ADR 0009, ADR 0016).
|
Package relay sends an upstream response to the client without changes, gives a copy of the bytes to a meter, and applies the four timeouts of an upstream request (ADR 0009, ADR 0016). |
|
respcache
Package respcache is the exact response cache of Tollgate (ADR 0030).
|
Package respcache is the exact response cache of Tollgate (ADR 0030). |
|
router
Package router chooses the upstream target of each attempt of a request.
|
Package router chooses the upstream target of each attempt of a request. |
|
server
Package server is the data plane of Tollgate: the HTTP handlers, the proxy flow for each request, the health endpoints and the drain at shutdown.
|
Package server is the data plane of Tollgate: the HTTP handlers, the proxy flow for each request, the health endpoints and the drain at shutdown. |
|
sse
Package sse parses server-sent event streams in increments.
|
Package sse parses server-sent event streams in increments. |
|
telemetry
Package telemetry holds the Prometheus metrics and the OpenTelemetry tracer of Tollgate.
|
Package telemetry holds the Prometheus metrics and the OpenTelemetry tracer of Tollgate. |
|
usage
Package usage records one usage event for each request, and reads the spend back from the usage file at start.
|
Package usage records one usage event for each request, and reads the spend back from the usage file at start. |
|
Package web holds the Tollgate dashboard: a Vite, React and TypeScript app in this directory.
|
Package web holds the Tollgate dashboard: a Vite, React and TypeScript app in this directory. |
