OTel Collector
AI coding agents — Claude Code, OpenAI Codex CLI, and GitHub Copilot — can emit OpenTelemetry (OTLP) data that AgenticAnts ingests. This gives you per-tool usage: sessions, token counts, models, and tool calls, attributed to the user and device.
Privacy by default. With the configuration below, prompt and response content is never captured — only usage metadata (counts, models, durations, tool names). The content-capturing switches are deliberately left unset / disabled.
How it works
Each tool exports OTLP over HTTP to a single ingest endpoint, authenticated with your project keys. AgenticAnts detects which tool sent the data (from the OTel service.name / scope) and parses it into usage records.
| Value | |
|---|---|
| Endpoint (base) | https://<your-agenticants-host>/api/public/shadow-ai/otlp |
| Protocol | http/json (HTTP/protobuf also accepted) |
| Auth | your project's public + secret API key |
Replace <your-agenticants-host> with your platform host (e.g. api.agenticants.ai). Get the public and secret API keys from Settings → API Keys.
Authentication
Send your keys as these headers:
X-Shadow-Ai-Public-Key: pk-...
X-Shadow-Ai-Secret-Key: sk-...These are equivalent to standard HTTP Basic auth — Authorization: Basic base64(publicKey:secretKey) — so either form works.
Setup
Set the OTel values for each coding agent you use. On macOS you can set them session-wide with launchctl setenv; otherwise add them to your shell profile.
Claude Code reads standard OTEL_* environment variables. Add these to your shell profile (~/.zshrc / ~/.bashrc), or on macOS set them session-wide with launchctl setenv:
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/json
export OTEL_EXPORTER_OTLP_ENDPOINT="https://<your-agenticants-host>/api/public/shadow-ai/otlp"
export OTEL_EXPORTER_OTLP_HEADERS="X-Shadow-Ai-Public-Key=pk-...,X-Shadow-Ai-Secret-Key=sk-..."Do not set OTEL_LOG_USER_PROMPTS — leaving it unset keeps prompt text out of the telemetry.
Restart your terminal (or the Claude Code session) so the variables are picked up.
Environment variable reference
| Tool | Key | Value |
|---|---|---|
| Claude Code | CLAUDE_CODE_ENABLE_TELEMETRY | 1 |
| Claude Code | OTEL_METRICS_EXPORTER | otlp |
| Claude Code | OTEL_LOGS_EXPORTER | otlp |
| Claude Code | OTEL_EXPORTER_OTLP_PROTOCOL | http/json |
| Claude Code | OTEL_EXPORTER_OTLP_ENDPOINT | https://<host>/api/public/shadow-ai/otlp |
| Claude Code / Copilot | OTEL_EXPORTER_OTLP_HEADERS | X-Shadow-Ai-Public-Key=pk-...,X-Shadow-Ai-Secret-Key=sk-... |
| Copilot | COPILOT_OTEL_ENABLED | 1 |
| Copilot | COPILOT_OTEL_ENDPOINT | https://<host>/api/public/shadow-ai/otlp |
| Codex | (see ~/.codex/config.toml [otel] block above) | — |
Optional (set automatically by the agent): OTEL_RESOURCE_ATTRIBUTES=host.id=<device-uuid> ties telemetry to a specific device.
Verify it's working
Confirm the variables are set
# shell session
env | grep -E "CLAUDE_CODE_ENABLE_TELEMETRY|OTEL_|COPILOT_OTEL"
# macOS session-wide (set via launchctl / the agent)
launchctl getenv OTEL_EXPORTER_OTLP_ENDPOINT
cat ~/.codex/config.toml # CodexGenerate activity
Run a prompt in the tool (e.g. ask Claude Code a question, or run a Codex/Copilot command).
Check AgenticAnts
Open AgenticAnts — the tool should appear in your usage/traces view with sessions and token counts within a minute or two.
Troubleshooting
Nothing shows up
- Endpoint reachable? A quick check — an unauthenticated POST should return
401(auth required), not404:Acurl -s -o /dev/null -w "%{http_code}\n" -X POST \ -H "Content-Type: application/json" --data '{}' \ https://<your-agenticants-host>/api/public/shadow-ai/otlp/v1/logs404means the OTLP ingest endpoint isn't available on that host — confirm the host and that the endpoint is deployed. 401errors? Check the public/secret keys and that they belong to the right project.- Variables not picked up? Restart the terminal/tool. On macOS,
launchctl setenvapplies to new processes — fully quit and reopen the app.
Codex won't start ("duplicate key")
Codex allows only one [otel] table. Remove any extra [otel*] sections so there's a single managed block.