Levo integration
Levo is an API security and observability platform. This integration sends every request through the gateway to Levo as an OpenTelemetry trace, with the organization and workspace headers Levo uses for routing, so Levo sees which models your applications call, how often, with which keys and teams, and where calls fail.
A real-world scenario
A security team uses Levo to inventory every API their company calls. Once the gateway sends its traces there, Levo lists the model providers as APIs too, shows which internal team calls which model, and flags a new application that started calling an unexpected model last week.
Turn it on from the Admin UI
- Sign in as a proxy admin and open Settings, then Logging & Alerts. Click Add Callback.
- Pick Levo in the Callback dropdown and fill in the API key, the organization ID, the workspace ID and, for a self-hosted satellite, the collector URL.
- Click Add Callback. The table shows a
levorow with the badge Success.
Turn it on in the config file
spanway_settings:
callbacks: ["levo"]
| Variable | Purpose |
|---|---|
LEVOAI_API_KEY | Collector credential. Required. |
LEVOAI_ORG_ID | Organization id, sent as x-levo-organization-id. |
LEVOAI_WORKSPACE_ID | Workspace id, sent as x-levo-workspace-id. |
LEVOAI_COLLECTOR_URL | Collector endpoint, for self-hosted Levo satellites. |
The integration uses the OTLP exporter, so the OpenTelemetry Python packages must be installed in the gateway environment. The Docker image includes them.
Check that traces arrive
-
Send one request through the gateway:
curl -X POST http://localhost:4000/v1/chat/completions \-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \-d '{"model": "claude-haiku-5-5", "messages": [{"role": "user", "content": "Hi"}]}' -
Open the workspace in Levo. Expected result: a new trace with a span for the gateway request and a child span for the provider call, carrying the model, provider, token counts, cost, status, key alias and team as attributes.
What is exported
Each request becomes a trace with a span for the gateway request and child spans for the provider call, including attributes for the model, provider, request and response token counts, cost, status, the calling key alias and team, and the request metadata. Content attributes follow the OpenTelemetry generative AI semantic conventions and are left out when turn_off_message_logging is on.
Using a generic OpenTelemetry collector instead
If you already run an OpenTelemetry collector, use the otel callback with the standard OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS variables and forward traces from the collector to Levo or any other backend. The levo callback is a convenience for sending directly.
Errors
| Status | Where | Meaning | Fix |
|---|---|---|---|
| Nothing appears in Levo | Levo workspace | The organization or workspace id is wrong, or the API key is not accepted. | Check the three values against the Levo workspace settings and look for exporter errors in the gateway log. |
| 400 naming the collector URL and the API key | Saving the callback in the Admin UI | The collector URL changed while the stored key was kept. | Retype the API key with the new URL. |
403 naming scoped_integrations | Team callback | Per team Levo workspaces need the license feature. | Use the gateway wide callback, or add the feature. |
Logs
| Level | Line | Meaning |
|---|---|---|
| WARNING | OpenTelemetry: Unknown log exporter '<value>', defaulting to console. ... | OTEL_EXPORTER has an unknown value, so traces are printed instead of sent. Remove the variable or set it to otlp_http. |
| ERROR | Spanway.LoggingError: [Non-Blocking] Exception occurred while success logging <traceback> | The exporter could not deliver a span. The traceback names the collector's answer. |
Related
- OpenTelemetry for the exporter this integration is built on.
- Logging for the full list of integrations.
- Error reference and log reference.