A proxy setup for Open Source, Open Telemetry Compliant, or proxyable Developer Agents to add observability, monitoring, and tracing capabilities. Each layer can be easily hosted or depolyed anywhere, allowing teams to view all of their traces in a single pane of glass, no matter the deployment needs.
The first developer agent is Claude Code, Dev-Agent-Lens comes complete with seamless OAuth Passthrough for Pro and Max plans.
Leverage observability to track cost, identify common errors, and increase your teams shipping velocity.
This repository provides a transparent proxy layer for Claude Code that:
- Intercepts Claude Code API calls and routes them through LiteLLM
- Adds AI observability and monitoring via Arize AI
- Maintains full compatibility with the standard Claude Code CLI
- Provides centralized model configuration and management
graph TD
A[Claude CLI / SDK] -->|OAuth / API-key<br/>passthrough| B[LiteLLM Proxy<br/>localhost:4000]
B --> C[OpenTelemetry exporter]
B --> D["Postgres<br/>(optional)"]
C --> E[Arize AX OR<br/>Arize Phoenix]
D --> F["LiteLLM UI / stats<br/>(optional)"]
- Docker and Docker Compose
- Claude Code CLI installed (
curl -fsSL https://claude.ai/install.sh | sh) - Anthropic API key (get from https://console.anthropic.com/settings/keys)
Get started in under 2 minutes by choosing your observability backend!
# Copy the example environment file
cp .env.example .env
# Edit .env and add ONLY your Anthropic API key (OAuth will pass through automatically)
# ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
# For Arize AX, also add:
# ARIZE_API_KEY=your-arize-api-key
# ARIZE_SPACE_KEY=your-arize-space-keyOption A: Arize AX (Cloud)
# Start with Arize AX cloud observability
docker compose --profile arize up -dOption B: Phoenix (Local)
# Start with local Phoenix observability
docker compose --profile phoenix up -d
# Access Phoenix UI at http://localhost:6006# Use the wrapper script with default settings (localhost:4000)
./claude-lens
# Or install globally for convenience
sudo cp claude-lens /usr/local/bin
claude-lens
# Use different proxy configurations:
./claude-lens --proxy-url http://localhost:4001 # For advanced profile
CLAUDE_LENS_PROXY_URL=http://remote-server:4000 ./claude-lens # Via environment
./claude-lens --help # View all configuration optionsThat's it! Claude Code now routes through LiteLLM for consistent API handling.
- Open Arize AI Dashboard
- Navigate to your project
- Filter traces:
status_code = 'OK' and attributes.llm.token_count.total > 0
This repository includes comprehensive examples for integrating the Claude Code SDK with Dev-Agent-Lens observability in both TypeScript and Python. These examples demonstrate advanced usage patterns, specialized agents, and full observability integration.
Note: Due to Claude Code SDK authentication options, OAuth passthrough for the SDK is not supported.
TypeScript Examples (examples/typescript/):
- Basic Usage: Simple SDK setup with proxy observability
- Code Review Agent: Automated code analysis with structured feedback
- Custom Tools: Advanced tool integration and execution tracing
- Documentation Generator: Automatic API documentation generation
Python Examples (examples/python/):
- Basic Usage: Core SDK functionality with streaming responses
- Observable Agent: Advanced agent framework with:
- Security Analysis Agent (vulnerability detection)
- Incident Response Agent (automated incident handling)
- Session management and history tracking
Our examples contain code samples to leverage the Claude Code SDKs for python and typescript, while maintaining the proxy and observability features from Dev-Agent-Lens.
# 1. Ensure the proxy is running (choose your observability backend)
docker compose --profile arize up -d # Arize AX (cloud)
# OR: docker compose --profile phoenix up -d # Phoenix (local)
# 2. Try TypeScript examples
cd examples/typescript
npm install
npm run basic # Basic usage
npm run review basic-usage.ts # Code review
# 3. Try Python examples
cd examples/python
uv pip install -e .
uv run python basic_usage.py # Basic usage
uv run python observable_agent.py # Advanced agentsAll examples automatically route through the LiteLLM proxy for full observability without requiring command-line exports.
📖 View Complete Examples Guide →
The proxy uses wildcard routing in litellm_config.yaml to allow Claude Code to select any model:
- Automatic Pass-through: Any model Claude Code selects is automatically routed to Anthropic
- Wildcard Support: Supports patterns like
claude-*,anthropic/*, andclaude-opus-* - No Model Override: The proxy doesn't force a specific model - Claude Code decides
- Optional Aliases:
sonnetandhaikushortcuts are available but not required
- LiteLLM Proxy: Port 4000
- Health Check: http://localhost:4000/health
- OpenTelemetry: Configured for Arize endpoint (when ARIZE keys are configured)
claude-lens- Wrapper script that starts Claude Code with proxy configurationdocker-compose.yml- Service definition and environment setuplitellm_config.yaml- Model routing and callback configuration.env.example- Example environment variables file.env- Your local environment configuration (not tracked in git)
The docker-compose.yml file sets up the LiteLLM proxy:
- Image: Custom OAuth-enabled image (
aowen14/litellm-oauth-fix:latest) - Port mapping: 4000 (host) → 4000 (container)
- Configuration: Mounts
litellm_config.yamlfor model routing - Environment: Passes through API keys and Arize configuration
- Health checks: Automatic health monitoring every 30 seconds
- Restart policy: Automatically restarts unless manually stopped
To modify the proxy configuration:
- Edit
litellm_config.yamlto change model mappings or callbacks - Update
.envwith your API credentials - Restart the proxy:
docker-compose restart
docker-compose up -ddocker-compose downdocker-compose logs -fdocker-compose restart- Check if services are running:
docker-compose ps - Verify proxy health:
curl http://localhost:4000/health - View real-time logs:
docker-compose logs -f litellm-proxy - Verify environment variables: Ensure required variables are set in
.env - Claude Lens errors: The wrapper script will check if the proxy is running before starting Claude Code
- OAuth issues: Check logs for OAuth token detection and passthrough messages
- API key fallback: Ensure
ANTHROPIC_API_KEYis set if not using OAuth
- Complete Observability: Full visibility into Claude Code usage
- Zero Configuration: Works transparently with existing Claude Code workflows
- Enterprise Ready: Built-in monitoring and cost tracking
- Model Management: Centralized configuration for all Claude models
- Extensible: Based on LiteLLM's robust proxy framework