I have an AI Gateway
Amberflo integrates with third-party AI Gateways. Gateways act as the control point for all model traffic, capturing the metadata needed to understand usage, attribute costs, and govern AI workloads. When connected to Amberflo, a gateway becomes significantly more powerful: its raw traffic is transformed into structured, attributed, real-time usage data that unlocks budgets, guardrails, attribution, multi-source aggregation, and AI governance across your organization.
Amberflo supports connecting multiple gateways to a single Amberflo account. You can run different gateways for different teams, environments, or use cases, and all usage will be unified inside Amberflo.
Supported AI Gateways
- LiteLLM
Coming soon
- CloudFlare
- Apigee
- Kong Gateway
This guide covers how to connect LiteLLM when it is already deployed in your environment.
If you do not already have LiteLLM running, or if your gateway is not currently supported, follow the guide below to deploy LiteLLM from scratch and integrate it with Amberflo.
Enable Amberflo Integration for an Existing LiteLLM Deployment
This guide assumes you already have LiteLLM deployed and operational. You will:
- Download the Amberflo callback
- Add a configuration entry to enable it
- Add Amberflo specific variables to your environment file
- Update your deployment command
- Redeploy and verify that usage flows into Amberflo
- Overview
LiteLLM handles and proxies LLM requests.
Amberflo provides real-time usage metering, attribution, and cost governance.
The Amberflo callback attaches to LiteLLM and pushes meter events directly to the Amberflo ingestion API. Once enabled, model usage appears immediately in the Amberflo AI Control Tower. It is important to note that the meter events are only metadata about the call to the LLM. The prompt and response never leave your VPC.
- Prerequisites
You must already have:
- A running LiteLLM deployment (Docker, Kubernetes, VM, etc.)
- A Postgres database used by LiteLLM
- Required for teams, virtual keys, organizations, and routing rules
- Your existing YAML config file
Note:
LiteLLM can technically run without Postgres, but many required features (virtual keys, teams, routing rules) will not function. Postgres is required for the Amberflo integration.
- Download the Amberflo Callback Package
Amberflo has created a package to collect the necessary metadata and send it to Amberflo.
- Download amberflo.zip from Amberflo.
- Unzip it into the same directory as your LiteLLM config file.
Your directory should look like this:
your-directory/
├── amberflo/
│ ├── __init__.py
│ └── (other Amberflo callback files)
├── config.yaml
└── .envNote: Do not modify any callback source files.
- Add the Amberflo Callback to config.yaml
Edit your LiteLLM config and add:
litellm_settings:
callbacks:
- "amberflo.litellm.callback"If you already have other callbacks, add "amberflo.litellm.callback" as an additional entry.
This tells LiteLLM to load the callback code from the amberflo/ directory.
- Add the Amberflo Environment Variables
Amberflo provides the required variables and values for connecting the Amberflo callback to your account. You can find them in the connection wizard. Simply copy them and add them to your existing environment file.
The variables contain:
- Your Amberflo API key
- The Amberflo ingest endpoint
- The customer account identifier
- Batch size, retry settings, and other callback-related variables
If you do not currently have an environment file you can create the .env file in the same directory where you run your Docker command and then copy in the values.
Note: Do not commit this file to Git.
Optionally you can update the AFLO_HOSTED_ENV value. The string set as the value will be used to identify the instance of the AI Gateway. Amberflo supports the ability to connect multiple AI Gateways and this will allow you to filter the data based on which AI Gateway instance the data is coming from.
- Update Your Deployment Command (Docker Example)
Modify your existing Docker command to include if you were not already using an environment file:
--env-file .env
A volume mount for the amberflo callback directory
--volume ./amberflo:/app/amberflo:ro
Example:
docker run \
--env-file .env \
--volume ./amberflo:/app/amberflo:ro \
--volume ./config.yaml:/app/config.yaml:ro \
--publish 4000:4000 \
ghcr.io/berriai/litellm:v1.79.0-stable \
--config /app/config.yamlKey points:
- ./amberflo maps to /app/amberflo inside the container
- LiteLLM automatically discovers callbacks in this folder
- The .env file supplies Amberflo credentials and ingest information
No additional installation is required.
- Redeploy the Gateway
Stop your current LiteLLM container and redeploy using the updated command.
- Test the Integration
Step 1: Call the Gateway
Make sure to update the placeholder values in the cURL command below.:
- <YOUR_VM_IP>
- <YOUR_VIRTUAL_KEY>
- <MODEL_ID>
curl http://<YOUR_VM_IP>:4000/chat/completions \
-H "Authorization: Bearer <YOUR_VIRTUAL_KEY>" \
-H "Content-Type: application/json" \
-d '{"model": "<MODEL_ID>","messages": [{"role": "user", "content": "How are tokens calculated?"}]}'Step 2: Verify in Amberflo
Once you've successfully made the API call in the previous step you should log in to Amberflo and check the AI Spend Dashboard's Summary page. You will begin to see your usage and cost show up there.
Events should appear in near real time. It can take up to 2 minutes for the first data to show up. You may need to refresh the page.
- Automatic Business Unit Creation
Amberflo automatically creates a new Business Unit the first time a virtual key is used.
Mapping:
- LiteLLM team name → Business Unit name
- LiteLLM team ID → Business Unit ID
All future events for that key are attributed to that Business Unit.
You can rename Business Units later if needed. The first time you send data for a particular team you will see only their LiteLLM team ID shown in the Amberflo App. If can take up to 5 minutes for the business unit to be fully created in Amberflo.