{"id":47842390,"url":"https://github.com/jamesdconley/anthropic-proxy-logger","last_synced_at":"2026-04-03T21:01:16.859Z","repository":{"id":295180479,"uuid":"986002522","full_name":"JamesDConley/Anthropic-Proxy-Logger","owner":"JamesDConley","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-19T01:11:58.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-11T16:19:14.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesDConley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-19T00:37:23.000Z","updated_at":"2025-05-19T14:15:40.000Z","dependencies_parsed_at":"2025-05-24T04:14:48.318Z","dependency_job_id":"a7b4065c-85f5-4637-82fe-3a958b096876","html_url":"https://github.com/JamesDConley/Anthropic-Proxy-Logger","commit_stats":null,"previous_names":["jamesdconley/anthropic-proxy-logger"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JamesDConley/Anthropic-Proxy-Logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesDConley%2FAnthropic-Proxy-Logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesDConley%2FAnthropic-Proxy-Logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesDConley%2FAnthropic-Proxy-Logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesDConley%2FAnthropic-Proxy-Logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesDConley","download_url":"https://codeload.github.com/JamesDConley/Anthropic-Proxy-Logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesDConley%2FAnthropic-Proxy-Logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31377113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:53:18.093Z","status":"ssl_error","status_checked_at":"2026-04-03T17:53:17.617Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-03T21:01:10.879Z","updated_at":"2026-04-03T21:01:16.830Z","avatar_url":"https://github.com/JamesDConley.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anthropic API Logger\n\nA proxy server that logs all requests to and responses from the Anthropic API, allowing for detailed analysis of all your AI tools.\n\nFully compatible with the Anthropic API, just change your base URL and go.\n\n## Overview\n\nThis project provides a proxy server that sits between your application and the Anthropic API. It forwards all requests to Anthropic, logs the complete request and response data to disk, and returns the responses to your application unchanged. This enables:\n\n- Detailed logging of all API interactions\n- Analysis of AI model responses\n- Debugging and monitoring of API usage\n\n## Features\n\n- **Complete API Proxy**: Transparently proxies all requests to Anthropic's API\n- **Request/Response Logging**: Saves all API interactions to disk in JSON format\n- **Streaming Support**: Handles both standard and streaming API requests\n- **Docker Support**: Easy deployment using Docker\n- **Testing**: Includes tests to verify proxy functionality\n\n## Installation\n\n### Prerequisites\n\nPython or Docker\n\n### Local Installation\n\n1. Clone the repository:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd anthropic-logger\n   ```\n\n2. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. If you intend to run the tests, run the server and set your API key as an environment variable.\n   ```\n   export ANTHROPIC_API_KEY=your-api-key\n   ```\n\n### Docker Installation\n\n1. Clone the repository:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd anthropic-logger\n   ```\n\n2. Run the provided script to build and start the Docker container:\n   ```bash\n   ./run.sh\n   ```\n\n## Usage\n\n### Starting the Proxy Server\n\nI recommend running with Docker which uses gunicorn for real world usage. Running directly will use the flask development server, which is more useful for testing.\n\n#### Local Execution\n\n```bash\npython src/server.py\n```\n\nBy default, the server runs on `http://0.0.0.0:5001`.\n\n#### Docker Execution\n\n```bash\n./run.sh\n```\n\n### Configuring Your Application\n\nUpdate your application to use the proxy server instead of the direct Anthropic API:\n\n1. Change the API base URL from `https://api.anthropic.com` to `http://localhost:5001`\n2. Keep all other API parameters the same (API key, headers, etc.)\n\nExample with the Anthropic Python client:\n\n```python\nimport anthropic\n\n# Instead of using the default endpoint\nclient = anthropic.Anthropic(\n    api_key=\"your-api-key\",\n    base_url=\"http://localhost:5001\"  # Point to the proxy\n)\n\n# Use the client as normal\nresponse = client.messages.create(\n    model=\"claude-3-5-haiku-20241022\",\n    max_tokens=100,\n    messages=[\n        {\"role\": \"user\", \"content\": \"Hello, Claude!\"}\n    ]\n)\n```\n\n### Log Files\n\nLogs are stored in the `logs` directory in JSON format. Each log file contains:\n\n- Timestamp and request ID\n- API endpoint called\n- Complete request data\n- Complete response data\n- For streaming responses, reconstructed content and events sequence\n\n## Configuration\n\nThe proxy server can be configured using environment variables:\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `PORT` | Port to run the server on | `5001` |\n| `HOST` | Host to bind the server to | `0.0.0.0` |\n| `LOGS_DIR` | Directory to store log files | `./logs` |\n\n## Testing\n\nTo test the proxy server:\n\n1. Ensure your Anthropic API key is set in the environment:\n   ```bash\n   export ANTHROPIC_API_KEY=your-api-key\n   ```\n\n2. Run the test script:\n   ```bash\n   ./test.sh\n   ```\n\nThe tests verify that the proxy correctly handles both standard and streaming requests.\n\n## Project Structure\n\n```\nanthropic-logger/\n├── src/\n│   ├── server.py         # Main proxy server implementation\n│   └── test_proxy.py     # Tests for the proxy server\n├── logs/                 # Directory for storing log files\n├── Dockerfile            # Docker configuration\n├── requirements.txt      # Python dependencies\n├── run.sh                # Script to build and run the Docker container\n└── test.sh               # Script to run tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesdconley%2Fanthropic-proxy-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesdconley%2Fanthropic-proxy-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesdconley%2Fanthropic-proxy-logger/lists"}