mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-12-06 11:03:52 +00:00
docs: state that /v1/messages responses are cached
The Caching section named chat and embeddings only. It now names /v1/messages, the beta set in the key, and that entries are shared across users and groups.
This commit is contained in:
@@ -420,7 +420,7 @@ config accepts them as YAML, which decodes to the same JSON shape.
|
||||
| `retry` | `RetryConfig` | `{}` (disabled) | Same-provider retry for transient upstream failures — see [Retry](#retry). Omitted or `enabled: false` means no retry: every request makes exactly one upstream attempt, byte-identical to a gateway built before this field existed. |
|
||||
| `failover` | `FailoverConfig` | `{}` (disabled) | Cross-provider failover for a bare model id more than one configured provider serves — see [Failover](#failover). Omitted or `enabled: false` means no failover, byte-identical to a gateway built before this field existed. `enabled: true` opts in; a deployment with no overlapping providers behaves exactly as before regardless of this setting either way. |
|
||||
| `requestTimeout` | `string` (Go duration) | `5m` | Progress-based upstream request timeout, applied to every provider adapter call, native passthrough, and the MCP/A2A target proxy — see [Request timeout](#request-timeout). **Behavior change for every deployment**: before this field existed, no timeout was set at all, so a provider that accepted a connection and then went silent hung the request forever. A provider's own `requestTimeout` (`ProviderConfig`) overrides this. Empty means the default; a value that fails to parse, or parses to zero or a negative duration, is a construction error. |
|
||||
| `cache` | `CacheConfig` | `{}` (disabled) | Opt-in Redis-backed response cache for unified non-streaming chat/embeddings — see [Caching](#caching). Omitted or `enabled: false` means no caching, byte-identical to a gateway built before this field existed. |
|
||||
| `cache` | `CacheConfig` | `{}` (disabled) | Opt-in Redis-backed response cache for unified non-streaming chat, `/v1/messages` and embeddings — see [Caching](#caching). Omitted or `enabled: false` means no caching, byte-identical to a gateway built before this field existed. |
|
||||
| `breaker` | `BreakerConfig` | `{}` (every default) | Per-provider discovery circuit breaker — see [Provider health (discovery circuit breaker)](#provider-health-discovery-circuit-breaker). Every field is individually zero-means-default; a provider whose discovery never fails is unaffected regardless of what this block contains. |
|
||||
| `targetHealth` | `TargetHealthConfig` | `{}` (probes off) | Health tracking for MCP servers and A2A agents — see [MCP and A2A](#mcp-and-a2a)'s "Target health" section. Passive recording and exposure stay on regardless of this block; `enabled` gates only the active probe sweep. |
|
||||
| `admin` | `*AdminConfig` | `nil` (disabled) | Read-only admin dashboard — see [Admin](#admin). `nil` or `enabled: false` means the `/admin*` routes are not registered at all. |
|
||||
@@ -2118,7 +2118,7 @@ stall there is bounded at whichever of those applies, not indefinite.
|
||||
## Caching
|
||||
|
||||
An opt-in, Redis-backed response cache for the unified, non-streaming
|
||||
`POST /v1/chat/completions` and `POST /v1/embeddings` routes. Off by
|
||||
`POST /v1/chat/completions`, `POST /v1/messages` and `POST /v1/embeddings` routes. Off by
|
||||
default (`cache.enabled: false`); every config that predates this field
|
||||
keeps calling the upstream on every request. Caching also requires
|
||||
`redis` to be configured — without it, `cache.enabled: true` is silently
|
||||
@@ -2126,7 +2126,8 @@ disabled with one warning logged at construction, never a per-replica
|
||||
in-process fallback: divergent replicas would otherwise serve different
|
||||
cached bodies for the same request.
|
||||
|
||||
- **What's cacheable**: a non-streaming chat request, or a non-streaming
|
||||
- **What's cacheable**: a non-streaming chat or `/v1/messages` request
|
||||
(endpoint value `messages`), or a non-streaming
|
||||
embeddings request when `cache.cacheEmbeddings` is `true`, whose
|
||||
upstream response was HTTP 200 and no larger than `cache.maxBodyBytes`.
|
||||
Never cached: a streaming request, native passthrough, MCP/A2A, the
|
||||
@@ -2134,9 +2135,12 @@ cached bodies for the same request.
|
||||
or any non-200 upstream response.
|
||||
- **Key**: `llmgw:cache:` plus a hex SHA-256 digest of the provider name,
|
||||
the resolved upstream model id, the client's own exactly-as-sent
|
||||
`model` string (`requestedModel`), the endpoint (`chat` or
|
||||
`embeddings`), and the canonical JSON of the request body with
|
||||
`stream_options` and `user` removed. `requestedModel` and the endpoint
|
||||
`model` string (`requestedModel`), the endpoint (`chat`,
|
||||
`messages` or `embeddings`), and the canonical JSON of the request body with
|
||||
`stream_options` and `user` removed. For `/v1/messages`, the forwarded
|
||||
`anthropic-beta` set (split on commas, lower-cased, sorted, de-duplicated)
|
||||
is also hashed in when present; with `stripClientAnthropicBeta: true` the
|
||||
header is ignored. Entries are shared across users and groups. `requestedModel` and the endpoint
|
||||
are both part of the key so that two different alias forms of the same
|
||||
upstream model (`claude-x` versus `anthropic/claude-x`) never collide
|
||||
into one cache entry: a translating adapter (`anthropic`, `gemini`)
|
||||
|
||||
Reference in New Issue
Block a user