mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
* feat(proxy): push-based OTLP billable-request metering for enterprise deployments
Adds opt-in, license-gated metering that counts 2xx HTTP requests to LLM
inference, MCP, and A2A endpoints and exports them over mutual TLS to a global
OpenTelemetry Collector for request-based billing.
A pure ASGI middleware (BillableRequestMetricsMiddleware) classifies each
request by route and records one count per 2xx response via an injected
recorder. The recorder (BillingMetricsRecorder) owns a dedicated OTEL meter
provider and an OTLP/gRPC exporter authenticated with client certificates, kept
isolated from the global meter provider so a customer's own OTEL metrics are
untouched. The recorder is built only when a valid LITELLM_LICENSE is present
and the cert material is configured; otherwise the middleware is a transparent
pass-through.
Deployment identity rides on the mTLS client certificate rather than the
payload, so the secret license key is never sent as an attribute or header; only
the license org id travels as a resource attribute for cross-checking.
Resolves LIT-4089
* fix(proxy): align billable-request metering with the global collector
- switch the exporter to OTLP/HTTP with a TLS client certificate. The
collector front end terminates mutual TLS and validates the client cert
against our CA; server verification uses the system trust store, so the
CA env var is now an optional override for private collectors
- resolve the metrics recorder on the first request via a factory instead
of at import time, so deployments that provide the license and cert env
vars through the YAML config's environment_variables export correctly
- close the metering bypass: classify /images/edits, /images/variations,
/v1/messages, /v1/videos, video remix, /v1/ocr and Gemini generateContent
as billable, and gate LLM routes to POST so GET reads (list videos, fetch
a response) do not bill. Verified live: the collector count matches the
UI usage page successful_requests exactly, with failures excluded on both
sides
* fix(proxy): wrap enterprise billing import in try-except per code-quality gate
The check_unsafe_enterprise_import gate requires every import from an
enterprise-pathed module to be guarded. Annotate the factory with the
middleware's BillingRecorder protocol so no enterprise type import is
needed at type-check time
* chore: satisfy strict lint gates in billing modules
- builtin generics per UP006 (dict/tuple instead of typing.Dict/Tuple)
- noqa the deliberate blind catch that keeps metering from breaking startup
- sort proxy_server import blocks split by the guarded enterprise import
* fix(proxy): bill provider passthrough, search, and rag routes
Route-inventory audit against LiteLLMRoutes.llm_api_routes found more
SpendLogs-producing surfaces the classifier missed: provider passthrough
(/bedrock, /vertex-ai, /cohere and the rest of mapped_pass_through_routes),
/v1/search and vector-store search, and the rag ingest/query routes. All are
counted by the dashboard usage page, so missing them undercounts billing.
The passthrough prefix list is read from LiteLLMRoutes so new providers are
picked up without touching this module. /langfuse is excluded: it forwards
observability traffic and writes no SpendLogs row. Known limitation recorded
in the PR: /v1/realtime is a websocket flow the HTTP middleware does not see
* fix(proxy): bill MCP and A2A requests by protocol transport routes only
The billable-request classifier matched the whole /v1/mcp prefix, so
management and discovery reads such as GET /v1/mcp/tools and GET
/v1/mcp/server counted as billable MCP requests, while real MCP tool
calls on the /{server}/mcp and /toolset/{name}/mcp aliases were missed
because their route handlers rewrite the ASGI scope only after this
middleware has already classified the original path. Classify MCP by the
concrete transport surface (the /mcp streamable-HTTP and SSE sub-app plus
the single-segment server and toolset aliases) and exclude the /v1/mcp
management API. Apply the same shape to A2A, which had the identical
issue: only the /message/send invoke route bills, not /v1/a2a/discover or
the .well-known agent-card reads.
* fix(proxy): harden billable-request classification and recorder lifecycle
Exact-match Anthropic /v1/messages so OpenAI Assistants thread-message
routes no longer bill, add Google Interactions create routes, guard
recorder.record() so a broken exporter can never fail a served request,
lock lazy recorder resolution against concurrent first requests, and
disable metering on empty-string env config instead of accepting a
blank endpoint
* chore(ui): regenerate eslint metrics after staging merge
* docs(proxy): state the lower-bound billing contract in middleware comments
* fix(proxy): bill mcp-rest tool calls and bare a2a agent invokes
POST /mcp-rest/tools/call executes a tool and fires the same MCP spend
logging as the /mcp transport, and POST /a2a/{agent_id} is the JSON-RPC
invoke route whose method (message/send or message/stream) travels in
the body; both returned 2xx without being recorded
* fix(proxy): flush billable-request counts on proxy shutdown
PeriodicExportingMetricReader buffers up to one export interval of
counts; without a final flush every restart silently dropped them. The
factory registers the recorder it builds and proxy_shutdown_event pops
and flushes it, bounded by a 5s timeout so a dead collector cannot
stall shutdown
* fix(proxy): stop billing bare a2a task RPCs and close the shutdown race
POST /a2a/{agent_id} multiplexes JSON-RPC methods off the request body. Only
message/send and message/stream write a SpendLogs row; tasks/get, tasks/cancel
and the pushNotificationConfig RPCs are forwarded upstream and write none.
Classifying the bare path as billable counted those task RPCs and pushed the
metric above the dashboard's successful-request count. Since a path-only
classifier cannot read the body, the bare route no longer bills; the explicit
/message/send routes still do. Missing a bare-path invoke undercounts, which is
the only direction this metric is allowed to drift. The /mcp transport keeps
billing every method because its list path logs a SpendLogs row too.
The billing middleware also sat outside InFlightRequestsMiddleware, and it
records after the inner app returns. A request could therefore be counted as
drained while its record() had not yet run, letting proxy_shutdown_event flush
and stop the exporter underneath it. Registering it before the in-flight
tracker nests it inside, so wait_for_drain covers the record
* test(proxy): stub the OTLP exporter in the recorder-build test
test_premium_with_full_config_builds_recorder built a real MeterProvider, so
the shutdown flush resolved collector.example and opened a TLS connection from
a unit test. The exporter is now stubbed, and a getaddrinfo spy asserts nothing
resolves the collector host so the stub cannot be quietly dropped later
* fix(helm): truncate the helm.sh/chart label to 63 bytes
Kubernetes caps a label value at 63 bytes and .Chart.Version is unbounded. CI
publishes branch builds as 0.0.0-branch-<branch>-<sha>, so helm.sh/chart
rendered as a 64 byte value and the API server rejected every labeled resource
with "must be no more than 63 bytes", including the migrations Job. The
litellm-helm chart already guards this through a litellm.chart helper; this
adds the same helper here.
Swept the rest of the chart for label and name values built from unbounded
input. .Chart.Version appeared only in this label. The remaining candidates all
derive from .Release.Name, which helm itself caps at 53 characters, so they
cannot overflow; three of them are selector labels feeding immutable Deployment
matchLabels, where adding trunc would risk churn for no gain. They are left
alone deliberately.
Verified with a new helm-unittest suite, tests/chart_label_tests.yaml, which
overrides chart.version per test:
helm unittest -f 'tests/*.yaml' helm/litellm # 13 passed
helm unittest -f 'tests/*.yaml' helm/litellm-helm # 54 passed
The truncation cases fail against the previous helper. Reproduced the original
overflow by rendering with the real branch version and measuring the label:
helm template rel helm/litellm -f helm/litellm/tests/values/required.yaml \
| grep helm.sh/chart # 64 bytes before, 63 after
* feat(proxy): accept inline PEM for the billing-metrics mTLS credentials
LITELLM_BILLING_METRICS_CLIENT_CERT, _CLIENT_KEY and _CA_CERT took a filesystem
path. ECS injects Secrets Manager values as environment content and cannot mount
them as files, so a licensed deployment there could not turn metering on.
Each variable now takes either a path or the PEM itself. Inline PEM, detected by
the "-----BEGIN" prefix, is written once when the recorder is built into a 0700
temp dir as a 0600 file, and the config points at that path. The OTLP exporter
still only ever sees paths. A write failure disables metering through the
existing failure-as-None path rather than raising, and path-valued variables are
passed through untouched, so nothing changes for deployments that mount files.
The mixed case works too: mount the CA, inject the client credentials
* feat(helm): add first-class billingMetrics values to the componentized chart
Turning enterprise billable-request metering on meant hand-rolling the env vars
and the cert volume through gateway.extraEnv and gateway.volumes. This adds a
top-level billingMetrics block, off by default, consumed only by the gateway
since that is the component serving billable traffic.
When enabled it renders LITELLM_BILLING_METRICS_ENDPOINT plus the two cert paths
and mounts secretName read-only at /etc/litellm/billing-mtls. caSecretName is
optional and only needed for private collectors whose server certificate is not
on the public web PKI; when set it mounts at /etc/litellm/billing-mtls-ca and
adds the CA env var. exportIntervalMs is passed through only when set.
Enabling without secretName or with an empty endpoint fails the render with a
named message rather than producing a gateway that silently never exports.
The generic gateway.volumes, gateway.volumeMounts and gateway.extraEnv paths are
untouched and still compose with this, so existing overlays keep working.
The chart has no values.schema.json and no README, so there is nothing further to
update. Verified with a new helm-unittest suite:
helm unittest -f 'tests/*.yaml' helm/litellm # 23 passed
helm unittest -f 'tests/*.yaml' helm/litellm-helm # 54 passed
* feat(terraform): billing-metrics variables for the aws and gcp templates
* feat(helm): add billingMetrics values to the classic chart
The componentized chart just gained a first-class billingMetrics block; this
mirrors it in litellm-helm so enabling enterprise billable-request metering no
longer means hand-rolling the env vars and the cert volume through envVars and
volumes.
When enabled the proxy Deployment renders LITELLM_BILLING_METRICS_ENDPOINT plus
the two cert paths, and mounts secretName read-only at /etc/litellm/billing-mtls.
secretName defaults to litellm-billing-metrics-mtls, the conventional name, so
enabling the block is enough once that Secret exists. caSecretName is optional
and only needed for private collectors whose server certificate is not on the
public web PKI; when set it mounts at /etc/litellm/billing-mtls-ca and adds the
CA env var. exportIntervalMs is passed through only when set.
The env entries render after envVars and extraEnvVars, so a user-supplied
LITELLM_BILLING_METRICS_ENDPOINT cannot silently redirect the export under
Kubernetes last-wins duplicate-env semantics; this is the same ordering the
migrations Job relies on for DISABLE_SCHEMA_UPDATE.
Enabling with an emptied secretName or endpoint fails the render with a named
message rather than producing a proxy that silently never exports.
The generic volumes, volumeMounts, envVars and extraEnvVars paths are untouched
and still compose with this, so existing overlays keep working. The chart has no
values.schema.json; README parameters and a setup section are updated.
helm unittest -f 'tests/*.yaml' helm/litellm-helm # 68 passed (54 + 14 new)
helm lint helm/litellm-helm # 0 failed
* test(helm): pin that the migrations job never mounts the billing cert
The componentized chart's suite asserts the backend Deployment stays clear of the
billing wiring, since only the gateway serves billable traffic. The classic chart
has no backend, but it does have a second pod: the migrations Job, which renders
its own env from envVars and extraEnvVars. Nothing today wires the billing
include into it, and nothing stopped a future edit from doing so.
Asserts absence of the env, and that the Job grows no volumes or volumeMounts at
all. Both are notExists rather than notContains because the Job renders neither
key by default, so a notContains would fail on an unknown path instead of
checking the absence it looks like it is checking.
* fix(helm): meter the backend too, it serves the MCP transport
Scoping billingMetrics to the gateway was wrong. Applying each component's own
route allowlist to the proxy app shows the split is 75 billable routes on the
gateway and one on the backend: /{mcp_server_name}/mcp, the named-server MCP
transport, which writes a SpendLogs row on success. Metering only the gateway
would have silently dropped every MCP transport call from the counter, an
undercount proportional to a customer's MCP traffic.
The backend deployment now renders the same env and mounts the same read-only
cert secret. The migrations job still gets neither; it runs prisma and serves no
traffic, and a test pins that.
helm unittest -f 'tests/*.yaml' helm/litellm # 25 passed
helm unittest -f 'tests/*.yaml' helm/litellm-helm # 69 passed
This also aligns the chart with the terraform templates, which inject the
credentials into both components.
* fix(proxy): never log billing credential values when they fail to resolve
Accepting inline PEM turned the cert env vars into secret-bearing values, but
the disable warning still echoed them. A value that is neither a readable path
nor `-----BEGIN`-prefixed PEM, for example a key with a preamble or a malformed
secret, fell through to the path branch and was written to the proxy logs
verbatim, exposing the client certificate or private key to anyone who can read
them.
The warning now names the offending environment variables and tells the operator
what a valid value looks like, without ever printing one
* Revert "fix(helm): truncate the helm.sh/chart label to 63 bytes"
This reverts commit 4f7f706a63.
Version hygiene belongs to the pipeline that mints chart versions, not to the
chart. The build workflow now caps the version slug so litellm-<version> fits
the 63 byte label budget, which removes the overflow at the source rather than
silently truncating a value operators use to identify the build.
Drops the litellm.chart helper, restores the direct helm.sh/chart printf, and
removes tests/chart_label_tests.yaml. Both chart suites stay green:
helm unittest -f 'tests/*.yaml' helm/litellm # 20 passed
helm unittest -f 'tests/*.yaml' helm/litellm-helm # 69 passed
* feat(helm): default billingMetrics.secretName to the conventional name
The componentized chart required an explicit secretName while the classic chart
defaults to litellm-billing-metrics-mtls. Both now default to it, so the common
path is to create that Secret with tls.crt and tls.key and set enabled: true.
The required() guard stays, and with a default it now only fires when someone
explicitly blanks the override, which the tests pin from both sides
* feat(proxy): log once when billing metrics are actually enabled
build_billing_metrics_recorder returned None silently when the deployment was
not licensed, while every other disable path logged a warning. An operator
reading logs could not tell "metering active" from "metering off because this
component never saw the license", and a component can carry the cert mount and
the billing env and still meter nothing. That is the undercount direction the
metric is not allowed to drift in.
A successful build now emits one info line naming the collector endpoint and the
export interval; neither the certificate contents nor the license appear. The
unlicensed path logs at debug rather than warning, because unlicensed is the
common case and a warning there would be noise on every OSS proxy
* fix(terraform): fail the plan on a partial billing-metrics config
Each PEM secret is created only when its own variable is non-empty, so setting
billing_metrics_endpoint with a certificate but no key applied cleanly and left
the proxy logging "missing config" and never exporting. Silent non-export is the
undercount direction this metric must not drift in, and every other surface
fails fast on a half-configured metering block.
Both templates now carry a lifecycle precondition requiring the client
certificate and its key together whenever the endpoint is set. It lives on the
gateway task definition (aws) and the gateway Cloud Run service (gcp) rather
than on the secret resources, because those are themselves count-gated on the
PEM being present and would never evaluate in the failing case. Cross-variable
`validation` blocks would need terraform 1.9; versions.tf pins >= 1.6, and
preconditions work there.
ca_cert_pem stays optional, so an empty value still falls back to the system
trust store.
endpoint cert key result
"" any any metering off, no secrets created
set set set metering on
set missing either plan fails
Verified each row with `terraform console` against the condition, and reran
`terraform fmt -check` and `terraform validate` in both directories
* docs(terraform): record why the billing guard sits on the gateway resource
The precondition cannot live on the cert secret, which is count-gated on
the cert itself and so has zero instances in exactly the case the guard
must catch. That makes the guard's correctness depend on this resource
staying unconditional, which nothing else records and no test enforces
* fix(terraform): guard the backend against a partial billing config too
The precondition only sat on the gateway, but the backend receives the billing
endpoint as well, because it serves the named-server MCP transport and meters
it. A targeted apply of just the backend task or service would therefore skip
the guard entirely and provision a component holding a billing endpoint with no
credentials to use it, which is the silent never-export failure the guard exists
to prevent.
Both templates now carry the same precondition on the backend resource. The
condition and truth table are unchanged; ca_cert_pem stays optional.
terraform fmt -check and terraform validate clean in both directories
* docs(team): document mcp_rpm_limit in update_team docstring
* chore(ui): regenerate schema.d.ts for update_team docstring change
456 lines
14 KiB
YAML
456 lines
14 KiB
YAML
# Default values for litellm.
|
|
# This is a YAML-formatted file.
|
|
# Declare variables to be passed into your templates.
|
|
|
|
replicaCount: 1
|
|
# numWorkers: 2
|
|
|
|
image:
|
|
# Use "ghcr.io/berriai/litellm-database" for optimized image with database
|
|
repository: ghcr.io/berriai/litellm-database
|
|
pullPolicy: Always
|
|
# Overrides the image tag whose default is the chart appVersion.
|
|
# tag: "latest"
|
|
tag: ""
|
|
|
|
imagePullSecrets: []
|
|
nameOverride: "litellm"
|
|
fullnameOverride: ""
|
|
|
|
serviceAccount:
|
|
# Specifies whether a service account should be created
|
|
create: false
|
|
# Automatically mount a ServiceAccount's API credentials?
|
|
automount: true
|
|
# Annotations to add to the service account
|
|
annotations: {}
|
|
# The name of the service account to use.
|
|
# If not set and create is true, a name is generated using the fullname template
|
|
name: ""
|
|
|
|
# annotations for litellm deployment
|
|
deploymentAnnotations: {}
|
|
deploymentLabels: {}
|
|
deploymentMinReadySeconds: 0
|
|
|
|
# annotations for litellm pods
|
|
podAnnotations: {}
|
|
podLabels: {}
|
|
|
|
# -- Deployment strategy configuration
|
|
# Example:
|
|
# type: RollingUpdate
|
|
# rollingUpdate:
|
|
# maxUnavailable: 0
|
|
# maxSurge: 1
|
|
strategy: {}
|
|
|
|
terminationGracePeriodSeconds: 90
|
|
topologySpreadConstraints:
|
|
[]
|
|
# - maxSkew: 1
|
|
# topologyKey: kubernetes.io/hostname
|
|
# whenUnsatisfiable: DoNotSchedule
|
|
# labelSelector:
|
|
# matchLabels:
|
|
# app: litellm
|
|
|
|
# At the time of writing, the litellm docker image requires write access to the
|
|
# filesystem on startup so that prisma can install some dependencies.
|
|
podSecurityContext: {}
|
|
securityContext:
|
|
{}
|
|
# capabilities:
|
|
# drop:
|
|
# - ALL
|
|
# readOnlyRootFilesystem: false
|
|
# runAsNonRoot: true
|
|
# runAsUser: 1000
|
|
|
|
# A list of Kubernetes Secret objects that will be exported to the LiteLLM proxy
|
|
# pod as environment variables. These secrets can then be referenced in the
|
|
# configuration file (or "litellm" ConfigMap) with `os.environ/<Env Var Name>`
|
|
environmentSecrets:
|
|
[]
|
|
# - litellm-env-secret
|
|
|
|
# A list of Kubernetes ConfigMap objects that will be exported to the LiteLLM proxy
|
|
# pod as environment variables. The ConfigMap kv-pairs can then be referenced in the
|
|
# configuration file (or "litellm" ConfigMap) with `os.environ/<Env Var Name>`
|
|
environmentConfigMaps:
|
|
[]
|
|
# - litellm-env-configmap
|
|
|
|
service:
|
|
type: ClusterIP
|
|
port: 4000
|
|
# If service type is `LoadBalancer` you can
|
|
# optionally specify loadBalancerClass
|
|
# loadBalancerClass: tailscale
|
|
|
|
# Probes for LiteLLM gateway container
|
|
livenessProbe:
|
|
path: /health/liveliness
|
|
initialDelaySeconds: 0
|
|
periodSeconds: 15
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 5
|
|
|
|
readinessProbe:
|
|
path: /health/readiness
|
|
initialDelaySeconds: 0
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
|
|
startupProbe:
|
|
path: /health/readiness
|
|
initialDelaySeconds: 0
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 30
|
|
|
|
ingress:
|
|
enabled: false
|
|
className: "nginx"
|
|
labels: {}
|
|
annotations:
|
|
{}
|
|
# kubernetes.io/ingress.class: nginx
|
|
# kubernetes.io/tls-acme: "true"
|
|
hosts:
|
|
- host: api.example.local
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
tls: []
|
|
# - secretName: chart-example-tls
|
|
# hosts:
|
|
# - chart-example.local
|
|
|
|
# masterkey: changeit
|
|
|
|
# if set, use this secret for the master key; otherwise, autogenerate a new one
|
|
masterkeySecretName: ""
|
|
|
|
# if set, use this secret key for the master key; otherwise, use the default key
|
|
masterkeySecretKey: ""
|
|
|
|
# Optional: enterprise billable-request metering. When enabled, the proxy counts
|
|
# successful requests to inference, MCP, and A2A endpoints and pushes them to
|
|
# LiteLLM's collector over mutual TLS. Requires an enterprise license.
|
|
# The client certificate identifies the deployment, so it is mounted read-only
|
|
# from an existing Secret and never passed through the environment.
|
|
billingMetrics:
|
|
enabled: false
|
|
endpoint: https://telemetry.litellm.ai # collector to push the counter to
|
|
secretName: litellm-billing-metrics-mtls # existing Secret holding tls.crt and tls.key
|
|
# Only for private or test collectors whose server certificate is not on the
|
|
# public web PKI. The production collector needs no CA override.
|
|
caSecretName: "" # existing Secret holding ca.crt
|
|
exportIntervalMs: "" # push cadence; the proxy defaults to 60000
|
|
|
|
proxyConfigMap:
|
|
# when true, creates a new configmap
|
|
create: true
|
|
# if create is false and name is set, use existing ConfigMap
|
|
# create: false
|
|
# name: ""
|
|
# key: "config.yaml"
|
|
|
|
# The elements within proxy_config are rendered as config.yaml for the proxy
|
|
# Examples: https://github.com/BerriAI/litellm/tree/main/litellm/proxy/example_config_yaml
|
|
# Reference: https://docs.litellm.ai/docs/proxy/configs
|
|
proxy_config:
|
|
model_list:
|
|
# At least one model must exist for the proxy to start.
|
|
- model_name: gpt-3.5-turbo
|
|
litellm_params:
|
|
model: gpt-3.5-turbo
|
|
api_key: eXaMpLeOnLy
|
|
- model_name: fake-openai-endpoint
|
|
litellm_params:
|
|
model: openai/fake
|
|
api_key: fake-key
|
|
api_base: https://exampleopenaiendpoint-production.up.railway.app/
|
|
general_settings:
|
|
master_key: os.environ/PROXY_MASTER_KEY
|
|
|
|
resources:
|
|
{}
|
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
|
# choice for the user. This also increases chances charts run on environments with little
|
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
|
# limits:
|
|
# cpu: 100m
|
|
# memory: 128Mi
|
|
# requests:
|
|
# cpu: 100m
|
|
# memory: 128Mi
|
|
|
|
autoscaling:
|
|
enabled: false
|
|
minReplicas: 1
|
|
maxReplicas: 100
|
|
targetCPUUtilizationPercentage: 80
|
|
# targetMemoryUtilizationPercentage: 80
|
|
# behavior: {}
|
|
|
|
# Autoscaling with keda is mutually exclusive with hpa
|
|
keda:
|
|
enabled: false
|
|
minReplicas: 1
|
|
maxReplicas: 100
|
|
pollingInterval: 30
|
|
cooldownPeriod: 300
|
|
# fallback:
|
|
# failureThreshold: 3
|
|
# replicas: 11
|
|
restoreToOriginalReplicaCount: false
|
|
scaledObject:
|
|
annotations: {}
|
|
triggers: []
|
|
# - type: prometheus
|
|
# metadata:
|
|
# serverAddress: http://<prometheus-host>:9090
|
|
# metricName: http_requests_total
|
|
# threshold: '100'
|
|
# query: sum(rate(http_requests_total{deployment="my-deployment"}[2m]))
|
|
behavior: {}
|
|
# scaleDown:
|
|
# stabilizationWindowSeconds: 300
|
|
# policies:
|
|
# - type: Pods
|
|
# value: 1
|
|
# periodSeconds: 180
|
|
# scaleUp:
|
|
# stabilizationWindowSeconds: 300
|
|
# policies:
|
|
# - type: Pods
|
|
# value: 2
|
|
# periodSeconds: 60
|
|
|
|
# Additional volumes on the output Deployment definition.
|
|
volumes: []
|
|
# - name: foo
|
|
# secret:
|
|
# secretName: mysecret
|
|
# optional: false
|
|
|
|
# Additional volumeMounts on the output Deployment definition.
|
|
volumeMounts: []
|
|
# - name: foo
|
|
# mountPath: "/etc/foo"
|
|
# readOnly: true
|
|
|
|
nodeSelector: {}
|
|
|
|
tolerations: []
|
|
|
|
affinity: {}
|
|
|
|
db:
|
|
# Use an existing postgres server/cluster
|
|
useExisting: false
|
|
|
|
# How to connect to the existing postgres server/cluster
|
|
endpoint: localhost
|
|
database: litellm
|
|
url: postgresql://$(DATABASE_USERNAME):$(DATABASE_PASSWORD)@$(DATABASE_HOST)/$(DATABASE_NAME)
|
|
secret:
|
|
name: postgres
|
|
usernameKey: username
|
|
passwordKey: password
|
|
# Optional: when set, DATABASE_HOST will be sourced from this secret key instead of db.endpoint
|
|
endpointKey: ""
|
|
# Optional: when set, DATABASE_URL_READ_REPLICA will be sourced from this
|
|
# secret key instead of db.readReplicaUrl. Prefer this over the plain
|
|
# value: read-replica URLs typically embed credentials, and a value
|
|
# written to db.readReplicaUrl ends up visible in the rendered pod spec
|
|
# and the Helm release secret.
|
|
readReplicaUrlKey: ""
|
|
|
|
# Optional read-replica routing. When set, the proxy sends read-only
|
|
# queries (find_*, count, group_by, query_raw/_first) to this URL while
|
|
# writes continue to go to db.url. Useful for Aurora-style clusters with
|
|
# separate reader/writer endpoints. Leave empty to keep single-DB behavior.
|
|
# When IAM_TOKEN_DB_AUTH is enabled, the reader URL is auto-refreshed
|
|
# alongside the writer (host/port/user/db are parsed from this URL once
|
|
# at startup; only the IAM token rotates).
|
|
#
|
|
# If the URL embeds credentials, prefer db.secret.readReplicaUrlKey over
|
|
# this field — the plain value is rendered into the pod spec and the
|
|
# Helm release secret. This field is intended for credential-less URLs
|
|
# only (e.g. when IAM_TOKEN_DB_AUTH supplies the token at runtime).
|
|
readReplicaUrl: ""
|
|
|
|
# Use the Stackgres Helm chart to deploy an instance of a Stackgres cluster.
|
|
# The Stackgres Operator must already be installed within the target
|
|
# Kubernetes cluster.
|
|
# TODO: Stackgres deployment currently unsupported
|
|
useStackgresOperator: false
|
|
|
|
# Use the Postgres Helm chart to create a single node, stand alone postgres
|
|
# instance. See the "postgresql" top level key for additional configuration.
|
|
deployStandalone: true
|
|
|
|
# Lifecycle hooks for the LiteLLM container
|
|
#
|
|
# Prefer the native /health/drain preStop hook over a fixed `sleep`: it marks
|
|
# the pod NotReady and blocks only until in-flight requests actually finish
|
|
# (bounded by GRACEFUL_SHUTDOWN_TIMEOUT, default 30s), instead of always
|
|
# waiting the worst-case duration. The drain runs once (the preStop hook and
|
|
# the SIGTERM handler share it), so set terminationGracePeriodSeconds a few
|
|
# seconds above GRACEFUL_SHUTDOWN_TIMEOUT to leave room for teardown before
|
|
# SIGKILL.
|
|
#
|
|
# /health/drain is off by default; enable it with
|
|
# general_settings.enable_drain_endpoint: true. The kubelet calls preStop
|
|
# hooks without proxy credentials, so when the health port is reachable from
|
|
# other pods (the common case) also set
|
|
# general_settings.drain_endpoint_token (or the DRAIN_ENDPOINT_TOKEN env
|
|
# var) and send the same value on the X-Drain-Token header from the hook.
|
|
# Calls missing/wrong the token get a 401 and have no side effect.
|
|
# Example:
|
|
# lifecycle:
|
|
# preStop:
|
|
# httpGet:
|
|
# path: /health/drain
|
|
# port: 4000
|
|
# httpHeaders:
|
|
# - name: X-Drain-Token
|
|
# value: <same value as drain_endpoint_token>
|
|
lifecycle: {}
|
|
|
|
# Settings for Bitnami postgresql chart (if db.deployStandalone is true, ignored
|
|
# otherwise)
|
|
postgresql:
|
|
architecture: standalone
|
|
auth:
|
|
username: litellm
|
|
database: litellm
|
|
|
|
# You should override these on the helm command line with
|
|
# `--set postgresql.auth.postgres-password=<some good password>,postgresql.auth.password=<some good password>`
|
|
password: NoTaGrEaTpAsSwOrD
|
|
postgres-password: NoTaGrEaTpAsSwOrD
|
|
|
|
# A secret is created by this chart (litellm-helm) with the credentials that
|
|
# the new Postgres instance should use.
|
|
# existingSecret: ""
|
|
# secretKeys:
|
|
# userPasswordKey: password
|
|
|
|
# Redis is the proxy's coordination store: cross-pod tpm/rpm rate limits, spend
|
|
# tracking, and the pod lock manager. Enabling this deploys the bundled Redis
|
|
# subchart, wires REDIS_HOST / REDIS_PORT / REDIS_PASSWORD into the proxy, and
|
|
# renders a `general_settings.coordination_redis` block into the proxy config.
|
|
#
|
|
# To point at an existing Redis instead, leave `enabled: false` and pass a
|
|
# secret for REDIS_HOST, REDIS_PORT, REDIS_PASSWORD or REDIS_URL; the proxy
|
|
# falls back to those env vars for coordination. Set `cache: true` in the proxy
|
|
# config only if you also want LLM response caching, which is independent of
|
|
# coordination
|
|
#
|
|
# When `redis.sentinel.enabled` is set, the coordination block is rendered with
|
|
# `sentinel_nodes` and `service_name` (from `redis.sentinel.masterSet`) instead
|
|
# of host/port, because a plain Redis client cannot talk to the sentinel port
|
|
redis:
|
|
enabled: false
|
|
architecture: standalone
|
|
coordination:
|
|
# Set to false to keep the bundled Redis for response caching only and leave
|
|
# `general_settings.coordination_redis` out of the rendered config. A
|
|
# `coordination_redis` block you define yourself in `proxy_config` always wins
|
|
enabled: true
|
|
|
|
# Prisma migration job settings
|
|
migrationJob:
|
|
enabled: true # Enable or disable the schema migration Job
|
|
retries: 3 # Number of retries for the Job in case of failure
|
|
backoffLimit: 4 # Backoff limit for Job restarts
|
|
disableSchemaUpdate: false # Skip schema migrations for specific environments. When True, the job will exit with code 0.
|
|
# Optional service account for the migration job.
|
|
# Only used when migrationJob.hooks.helm.enabled=true and serviceAccount.create=true.
|
|
# In that case, pre-install/pre-upgrade hooks run before normal resources, so this defaults to "default".
|
|
serviceAccountName: ""
|
|
annotations: {}
|
|
ttlSecondsAfterFinished: 120
|
|
resources: {}
|
|
# requests:
|
|
# cpu: 100m
|
|
# memory: 100Mi
|
|
extraContainers: []
|
|
extraInitContainers: []
|
|
|
|
# Hook configuration
|
|
hooks:
|
|
argocd:
|
|
enabled: true
|
|
helm:
|
|
enabled: false
|
|
|
|
# Log level for the litellm proxy (sets LITELLM_LOG in the deployment env).
|
|
# Rendered as a direct `env:` entry, which in Kubernetes takes precedence over
|
|
# any `envFrom:` source. If you currently source LITELLM_LOG from an
|
|
# environmentSecret or environmentConfigMap, set `logLevel: ""` here to
|
|
# disable injection — otherwise this value silently overrides your secret /
|
|
# configmap entry.
|
|
#
|
|
# Setting LITELLM_LOG inside `envVars:` below also wins: the template skips
|
|
# this injection entirely when envVars already defines LITELLM_LOG.
|
|
logLevel: INFO
|
|
|
|
# Additional environment variables to be added to the deployment as a map of key-value pairs
|
|
envVars: {}
|
|
|
|
# USE_DDTRACE: "true"
|
|
# Additional environment variables to be added to the deployment as a list of k8s env vars
|
|
extraEnvVars: {}
|
|
|
|
# if you want to override the container command, you can do so here
|
|
command: {}
|
|
# if you want to override the container args, you can do so here
|
|
args: {}
|
|
|
|
# - name: EXTRA_ENV_VAR
|
|
# value: EXTRA_ENV_VAR_VALUE
|
|
# Additional Kubernetes resources to deploy with litellm
|
|
extraResources: []
|
|
|
|
# - apiVersion: v1
|
|
# kind: ConfigMap
|
|
# metadata:
|
|
# name: my-extra-config
|
|
# data:
|
|
# foo: bar
|
|
# Pod Disruption Budget
|
|
pdb:
|
|
enabled: false
|
|
# Set exactly one of the following. If both are set, minAvailable takes precedence.
|
|
minAvailable: null # e.g. "50%" or 1
|
|
maxUnavailable: null # e.g. 1 or "20%"
|
|
annotations: {}
|
|
labels: {}
|
|
|
|
serviceMonitor:
|
|
enabled: false
|
|
labels:
|
|
{}
|
|
# test: test
|
|
annotations:
|
|
{}
|
|
# kubernetes.io/test: test
|
|
interval: 15s
|
|
scrapeTimeout: 10s
|
|
relabelings: []
|
|
# - targetLabel: __meta_kubernetes_pod_node_name
|
|
# replacement: $1
|
|
# action: replace
|
|
namespaceSelector:
|
|
matchNames: []
|
|
# - test-namespace
|