Gateway deployment

See which work your AI spend pays for. The AI Data Plane runs in your own Kubernetes cluster, between your applications and your AI gateway. Your requests still reach your gateway as they do today. CloudZero receives usage data with all prompt and response content removed.

Use this guide if your applications can send their AI requests through the AI Data Plane. If your AI tools call their providers directly, use AI Data Plane client telemetry instead.

Who you need: someone with admin access to your Kubernetes cluster runs Steps 1 to 5 and publishes the AI Data Plane in Step 6. The rest of Step 6 changes each application's base URL.

ℹ️

The AI Data Plane is in preview. Coverage and capabilities are expanding. To get started, reach out to your account manager.

Overview

Connecting the AI Data Plane to your gateway takes seven steps:

  1. Set your installation values
  2. Install the session cache operator
  3. Create the namespace and Secrets
  4. Install the chart
  5. Point your gateway at the AI Data Plane
  6. Route your applications through the AI Data Plane
  7. Verify the deployment

Prerequisites

  • A Kubernetes cluster running version 1.29 or later, with at least two nodes, and capacity for about 1.9 CPU and 2.9 GiB of memory in requests.
  • kubectl access to the cluster, and Helm 3.
  • An ingress your cluster already provides, to publish an in-cluster Service at a TLS-terminated URL on your private network.
  • Outbound network access from the cluster to telemetry.cloudzero.com (telemetry ingest), ai-control-plane.discovery.cloudzero.com (control plane), docker.cloudsmith.io (images), and your classification model's host. Installing the Dragonfly operator in Step 2 also reaches raw.githubusercontent.com and the Dragonfly image registry. If you mirror images, mirror the Dragonfly image too.
  • An AI gateway in the cluster, or outside it at an HTTPS hostname the cluster can reach, that meets these requirements:
RequirementWhy it matters
Serves Anthropic Messages, OpenAI Chat Completions, or OpenAI ResponsesThe AI Data Plane analyzes these formats over HTTP. Other traffic, including WebSocket traffic, is forwarded but not analyzed.
Accepts a credential for the AI Data Plane's own classification callsAfter each turn, the AI Data Plane labels the work: the kind of work, plus the repository, branch, pull request, and work item when they appear. It does this with one small call per turn to a model you choose. CloudZero receives the labels, not the conversation. A turn is the set of requests to a model, and their responses, that one user prompt starts. The classification endpoint is your gateway, so use a credential scoped to that call, such as a LiteLLM virtual key. Classification makes one call per turn, and one per sub-agent, billed to your provider account. Measured turns average about 4,550 input tokens, about $0.0018 per turn on Claude Haiku 4.5.
Exports OpenTelemetry traces to an endpoint you setYour gateway's token counts and costs reach CloudZero this way.

This guide is tested with LiteLLM 1.98.0 or later.

Gather your credentials

CredentialWhere to get itWhere it is stored
CloudZero API keyIn CloudZero, go to Settings > API Keys and create a key with the Send AI Telemetry scopeSecret cloudzero-api-key, data key value
Registry tokenYour account manager, along with the chart version to install. CloudZero hosts the chart and images in a private registry, so you can't create this token yourself.Used for helm registry login and the image pull Secret cloudsmith-pull
Classification credentialCreated by you in your gatewaySecret context-engine-gateway, data key token

Step 1: Set your installation values

This guide installs the AI Data Plane Helm chart in inline mode, where your AI requests pass through the AI Data Plane on their way to your gateway.

Every command in this guide uses these shell variables, so run every later step in the same terminal.

  1. Find your gateway's Service name and port. Replace <GATEWAY_NAMESPACE> with the namespace your gateway runs in:
kubectl --namespace <GATEWAY_NAMESPACE> get service
  1. Set the shell variables:
export NAMESPACE=cloudzero-data-plane
export RELEASE_NAME=czdp
export CHART=oci://docker.cloudsmith.io/cloudzero/cloudzero/cloudzero-data-plane
export CHART_VERSION=<CHART_VERSION>
export GATEWAY_TYPE=<GATEWAY_TYPE>
export GATEWAY_NAMESPACE=<GATEWAY_NAMESPACE>
export GATEWAY_SERVICE=<GATEWAY_SERVICE>
export GATEWAY_PORT=<GATEWAY_PORT>
export GATEWAY_HOST="$GATEWAY_SERVICE.$GATEWAY_NAMESPACE.svc.cluster.local"
export GATEWAY_TLS=false
export CLASSIFIER_CODEC=<CLASSIFIER_CODEC>
export MODEL=<MODEL>
VariableWhat to set it to
CHART_VERSIONThe chart version your account manager provided with your registry token
GATEWAY_TYPEA short name for your gateway, such as bifrost or litellm. CloudZero files your gateway's telemetry under this name.
GATEWAY_NAMESPACE, GATEWAY_SERVICE, GATEWAY_PORTYour gateway's namespace, Service name, and port, from the listing above. LiteLLM's default port is 4000.
GATEWAY_TLSfalse for a gateway in this cluster. For a gateway outside it, see If your gateway runs outside the cluster.
CLASSIFIER_CODECThe format your gateway serves for classification calls: anthropic-messages (/v1/messages), openai-chat (/v1/chat/completions), or openai-responses (/v1/responses).
MODELA model name your gateway serves, used for classification calls and the test request. Start with an inexpensive model, such as claude-haiku-4-5.

Keep the other values as written.

  1. Store your registry token without printing it. Run this command, paste the token at the prompt, and press Enter:
read -rs REGISTRY_TOKEN

If your gateway runs outside the cluster

Make these changes to the installation:

  • Step 1: skip action 1. Set GATEWAY_HOST to the gateway's hostname, GATEWAY_TLS to true, and GATEWAY_PORT to its HTTPS port, typically 443. You don't need GATEWAY_NAMESPACE or GATEWAY_SERVICE. The chart requires TLS for any gateway that isn't an in-cluster Service, and the gateway's certificate must be publicly trusted and include the hostname as a DNS name.
  • Step 5: expose the egress collector's port 4318 to your gateway at a TLS-terminated URL, using the same kind of ingress as in Step 6, and use that https:// URL as <COLLECTOR_ENDPOINT>. The egress collector accepts telemetry without authentication, so make the URL reachable only from your gateway's network.

Step 2: Install the session cache operator

The AI Data Plane's session cache runs on Dragonfly, an in-memory data store. The Dragonfly operator installs once per cluster, before the chart.

  1. Check whether the operator is installed:
kubectl get crd dragonflies.dragonflydb.io

If the command lists dragonflies.dragonflydb.io, skip to Step 3.

  1. If the command returns NotFound, install the operator and wait for it to register:
kubectl apply -f https://raw.githubusercontent.com/dragonflydb/dragonfly-operator/v1.6.1/manifests/dragonfly-operator.yaml
kubectl wait --for=condition=Established crd/dragonflies.dragonflydb.io --timeout=120s

The wait command prints condition met when the operator is ready.

Step 3: Create the namespace and Secrets

The chart reads its credentials from three Secrets. Only the names and data keys are fixed, so any secret management tool works.

  1. Create the namespace:
kubectl create namespace "$NAMESPACE"
  1. Store your CloudZero API key:
kubectl create secret generic cloudzero-api-key \
  --namespace "$NAMESPACE" \
  --from-literal=value='<CLOUDZERO_API_KEY>'
  1. Create the image pull Secret. The username is always cloudzero/cloudzero:
kubectl create secret docker-registry cloudsmith-pull \
  --namespace "$NAMESPACE" \
  --docker-server=docker.cloudsmith.io \
  --docker-username=cloudzero/cloudzero \
  --docker-password="$REGISTRY_TOKEN"
  1. Store the classification credential. If your gateway doesn't require one, store any non-empty value:
kubectl create secret generic context-engine-gateway \
  --namespace "$NAMESPACE" \
  --from-literal=token='<CLASSIFICATION_CREDENTIAL>'
PlaceholderValue
<CLOUDZERO_API_KEY>Your CloudZero API key
<CLASSIFICATION_CREDENTIAL>The credential you created in your gateway for the AI Data Plane

Step 4: Install the chart

  1. Log in to the registry:
helm registry login docker.cloudsmith.io \
  --username cloudzero/cloudzero \
  --password "$REGISTRY_TOKEN"
  1. Write the values file:
cat > values.yaml <<EOF
unstable:
  cloudZero:
    existingSecretName: cloudzero-api-key
  upstream:
    type: $GATEWAY_TYPE
    host: $GATEWAY_HOST
    port: $GATEWAY_PORT
    tls: $GATEWAY_TLS
  defaults:
    image:
      pullSecrets:
        - cloudsmith-pull
  components:
    contextEngine:
      enabled: true
      classifier:
        target:
          codec: $CLASSIFIER_CODEC
          model: $MODEL
          credentialSecret: context-engine-gateway
EOF
⚠️

Settings under unstable can change in any release. Before you install a different chart version, check this guide for changed settings.

  1. Install the chart:
helm upgrade --install "$RELEASE_NAME" "$CHART" \
  --version "$CHART_VERSION" \
  --namespace "$NAMESPACE" \
  -f values.yaml

Helm prints STATUS: deployed when the install succeeds.

Step 5: Point your gateway at the AI Data Plane

Your gateway's usage telemetry (tokens, models, and cost) reaches CloudZero through the AI Data Plane's egress collector. Your gateway must export its OpenTelemetry traces there with prompt and response content turned off. It must also keep the trace ID from the incoming W3C traceparent header on its usage spans and export them without sampling them out, because CloudZero uses that trace ID to connect usage to the classified work.

  1. Print the collector's endpoint:
echo "http://$RELEASE_NAME-egress-collector.$NAMESPACE.svc.cluster.local:4318"

Then follow the option for your gateway. In each, replace <COLLECTOR_ENDPOINT> with the value you printed.

Option A: LiteLLM

  1. If you deploy LiteLLM with its official Helm chart, add these values to your LiteLLM release. If you use a proxy configuration file instead, add the same litellm_settings block to it and set the two variables in the container's environment:
envVars:
  OTEL_EXPORTER_OTLP_ENDPOINT: <COLLECTOR_ENDPOINT>
  OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
proxy_config:
  litellm_settings:
    callbacks: ["otel"]
    turn_off_message_logging: true
  1. Upgrade your LiteLLM release, or restart the proxy, to apply the change.

For the full callback reference, see LiteLLM's OpenTelemetry integration.

Option B: Bifrost

Bifrost's OpenTelemetry plugin doesn't read the OTEL_EXPORTER_* environment variables, so set the collector in the plugin's configuration.

  1. Add these values to your Bifrost Helm release. The collector URL takes the full path, /v1/traces:
bifrost:
  plugins:
    otel:
      enabled: true
      config:
        collector_url: <COLLECTOR_ENDPOINT>/v1/traces
        protocol: http
        disable_content_logging: true

For an in-cluster install with the default names, the URL is http://czdp-egress-collector.cloudzero-data-plane.svc.cluster.local:4318/v1/traces.

  1. Upgrade your Bifrost release to apply the change.

Option C: Other gateways

  1. Set your gateway's OpenTelemetry trace export to the collector. Gateways built on an OpenTelemetry SDK read these environment variables:
OTEL_EXPORTER_OTLP_ENDPOINT: <COLLECTOR_ENDPOINT>
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
  1. Turn off prompt and response content in your gateway's telemetry. For the setting, see your gateway's documentation.

Step 6: Route your applications through the AI Data Plane

Applications outside the cluster reach the AI Data Plane at a hostname you publish with your ingress. Your ingress must:

  • Route every path to the <RELEASE_NAME>-context-engine Service on port 18000
  • Terminate TLS for your hostname and forward plaintext to the Service
  • Allow long-running streaming responses without buffering them
  • Live in the AI Data Plane's namespace, if it is a Kubernetes Ingress
  • Be reachable only from your own network, because the AI Data Plane doesn't authenticate the traffic it receives
  1. Publish the <RELEASE_NAME>-context-engine Service with an ingress that meets these requirements.

  2. From a machine outside the cluster, send a test request through your hostname. If your gateway serves only OpenAI formats, send an equivalent OpenAI request to the same hostname:

curl https://<EXPOSED_URL>/v1/messages \
  -H 'content-type: application/json' \
  -H 'x-api-key: <CLIENT_GATEWAY_CREDENTIAL>' \
  -H 'anthropic-version: 2023-06-01' \
  -d '{"model":"<MODEL>","max_tokens":32,"messages":[{"role":"user","content":"Reply with one word."}]}'
PlaceholderValue
<EXPOSED_URL>The hostname you published the AI Data Plane at
<CLIENT_GATEWAY_CREDENTIAL>A gateway credential a client already uses
<MODEL>The MODEL value from Step 1

A JSON response with generated text means the path is open.

  1. Change each client's base URL to your hostname. Clients keep their existing gateway credentials. For example, Claude Code and the Anthropic SDKs read these environment variables:
export ANTHROPIC_BASE_URL=https://<EXPOSED_URL>
export ANTHROPIC_AUTH_TOKEN=<CLIENT_GATEWAY_CREDENTIAL>

Clients built on the OpenAI API take a base URL the same way. Codex is supported over HTTP with the Responses API; its WebSocket traffic passes through without classification.

Step 7: Verify the deployment

  1. Run one real turn from a client you routed in Step 6.

  2. In AI Signals, open the Livestream tab and confirm the turn appears with its classified activity, model usage, and estimated cost.

What to expect

The AI Data Plane registers with CloudZero when it starts and appears in Settings > AI Settings > Control Plane within a few minutes. Viewing it requires read permission for AI Signals. Activity from each routed turn appears in the Livestream tab within seconds of the turn finishing. Once your test turn appears, setup is complete.

Uninstall

Remove the release's workloads:

helm uninstall "$RELEASE_NAME" --namespace "$NAMESPACE"

This leaves the coordinator identity Secrets (<RELEASE_NAME>-coordinator-identity and <RELEASE_NAME>-coordinator-gateway), the Secrets you created in Step 3, the Dragonfly operator and its custom resource definition (CRD), and a runtime Lease in the namespace. Delete those to remove everything. The device stays registered in CloudZero after you uninstall.

Troubleshooting

SymptomCauseFix
helm registry login failsThe username isn't cloudzero/cloudzero, or the registry token is wrong or has been rotatedLog in with the username cloudzero/cloudzero. If it still fails, ask your account manager for a new token, and recreate the cloudsmith-pull Secret with it.
Pods stay in ImagePullBackOffThe cloudsmith-pull Secret is missing or has the wrong username, or unstable.defaults.image.pullSecrets doesn't list itDelete the Secret with kubectl delete secret cloudsmith-pull -n "$NAMESPACE", recreate it with the username cloudzero/cloudzero as in Step 3, and list it under unstable.defaults.image.pullSecrets. If you mirror images, also mirror cloudzero.com/envoy and the Dragonfly image.
Clients get 502 responses from your ingressYour ingress can't reach the AI Data PlaneConfirm the ingress targets the <RELEASE_NAME>-context-engine Service on port 18000 from the AI Data Plane's namespace, and that the context engine pods are ready.

If you need help, contact your account manager.

Related resources

ℹ️

Have questions or feedback? Reach out to your account manager.


Did this page help you?