{"id":29535930,"url":"https://github.com/cysharp/aiapitracer","last_synced_at":"2025-07-18T03:01:37.301Z","repository":{"id":304644018,"uuid":"1017947690","full_name":"Cysharp/AIApiTracer","owner":"Cysharp","description":"A reverse proxy for local development environments that intercepts requests to AI services like OpenAI, Anthropic, etc.., allowing you to trace request and response content.","archived":false,"fork":false,"pushed_at":"2025-07-14T12:20:36.000Z","size":1755,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-14T13:48:21.388Z","etag":null,"topics":["ai","csharp","dotnet"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cysharp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-07-11T10:55:56.000Z","updated_at":"2025-07-14T13:34:32.000Z","dependencies_parsed_at":"2025-07-14T13:48:25.671Z","dependency_job_id":"6b04b6e6-e08b-4fb5-93e4-508fadf9f0dc","html_url":"https://github.com/Cysharp/AIApiTracer","commit_stats":null,"previous_names":["cysharp/aiapitracer"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Cysharp/AIApiTracer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cysharp%2FAIApiTracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cysharp%2FAIApiTracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cysharp%2FAIApiTracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cysharp%2FAIApiTracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cysharp","download_url":"https://codeload.github.com/Cysharp/AIApiTracer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cysharp%2FAIApiTracer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265561010,"owners_count":23788292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ai","csharp","dotnet"],"created_at":"2025-07-17T02:43:38.351Z","updated_at":"2025-07-18T03:01:37.238Z","avatar_url":"https://github.com/Cysharp.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AIApiTracer\n\nA reverse proxy for local development environments that intercepts requests to AI services like OpenAI, Anthropic, Azure OpenAI, and xAI, allowing you to trace request and response content.\n\nSimply put, it's like [Cloudflare AI Gateway Logs](https://developers.cloudflare.com/ai-gateway/observability/logging/) specialized for local development environments. Note that it's not intended for auditing, monitoring, or team usage.\n\n![](docs/img/screen-01.png)\n![](docs/img/screen-02.png)\n\n## Features\n\n- Monitor locally without using external services\n- Human-readable display of requests and responses\n- Support for multiple AI services\n    - OpenAI\n    - Anthropic\n    - Microsoft Azure OpenAI\n    - xAI\n    - OpenAI Compatible APIs\n- In-memory: No data persistence, retains up to 1000 records\n\n## Quick Start\n\n### 1. Run AIApiTracer\n\n#### Using Docker\nRun AIApiTracer using the Docker image (ghcr.io/cysharp/aiapitracer).\n\n```bash\ndocker run -p 8080:8080 ghcr.io/cysharp/aiapitracer:latest\n```\n\n#### Using pre-build binary\n\nYou can download and run the pre-built application from the [Releases](https://github.com/Cysharp/AIApiTracer/releases) page.\n\n```bash\n./AIApiTracer --urls http://localhost:8080/\n```\n\n### 2. Open in your browser\nOnce started, you can view request traces by accessing `http://localhost:8080` in your web browser.\n\n### 3. Change Various Endpoints to AIApiTracer\n\n#### OpenAI\n\nSpecify `http://localhost:8080/endpoint/openai/v1` as the endpoint instead of `https://api.openai.com/v1`.\n\n```bash\ncurl http://localhost:8080/endpoint/openai/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -d '{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Hello.\"\n    }\n  ],\n  \"model\": \"gpt-4.1-nano\"\n}'\n```\n```csharp\nvar openAIClient = new OpenAIClient(new ApiKeyCredential(apiKey), new OpenAIClientOptions\n{\n    Endpoint = new Uri($\"http://localhost:8080/endpoint/openai/v1\"),\n});\n```\n\n#### Anthropic\nSpecify `http://localhost:8080/endpoint/anthropic` as the endpoint instead of `https://api.anthropic.com/`.\n\n#### Claude Code\n```bash\nexport ANTHROPIC_BASE_URL=http://localhost:8080/endpoint/anthropic\n```\n\n#### Azure OpenAI\nSpecify `http://localhost:8080/endpoint/aoai/\u003cresource-name\u003e` as the endpoint instead of `https://\u003cresource-name\u003e.openai.azure.com/`.\n\n```csharp\nvar azureClient = new AzureOpenAIClient(\n    new Uri(\"http://localhost:8080/endpoint/aoai/my-resource\"),\n    new AzureKeyCredential(credential)\n);\n```\n\n#### xAI\nSpecify `http://localhost:8080/endpoint/x/v1` as the endpoint instead of `https://api.x.ai/v1`.\n\n```bash\ncurl http://localhost:8080/endpoint/x/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -d '{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Hello.\"\n    }\n  ],\n  \"model\": \"grok-3-latest\"\n}'\n```\n```csharp\nvar openAIClient = new OpenAIClient(new ApiKeyCredential(apiKey), new OpenAIClientOptions\n{\n    Endpoint = new Uri($\"http://localhost:8080/endpoint/x/v1\"),\n});\n```\n\n#### OpenAI Compatible\nSpecify `http://localhost:8080/endpoint/openai-compat/\u003copenai-compatible-endpoint\u003e` as the endpoint.\n\n⚠️ **Security Notice**: The OpenAI compatible endpoint is disabled by default for security reasons. You must explicitly enable it by setting the environment variable `AIApiTracer__EnableOpenAICompatForwarding` to `true`. When enabled, you should absolutely avoid making it accessible from external networks as it would become an open proxy.\n\nSpecify the address of the OpenAI compatible API endpoint after `openai-compat/`, including the scheme. For example, use `http://localhost:8080/endpoint/openai-compat/http://localhost:5273/v1`.\n\n```bash\ncurl http://localhost:8080/endpoint/openai-compat/http://localhost:5273/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -d '{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Hello.\"\n    }\n  ],\n  \"model\": \"Phi-4-mini-instruct-cuda-gpu\"\n}'\n```\n```csharp\nvar openAIClient = new OpenAIClient(new ApiKeyCredential(apiKey), new OpenAIClientOptions\n{\n    Endpoint = new Uri($\"http://localhost:8080/endpoint/openai-compat/http://localhost:5273/v1\"), // `http://localhost:5273/v1` is Foundry Local\n});\n```\n\n## TODO\n- [ ] Support for more AI services (Google Vertex AI, Amazon Bedrock)\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcysharp%2Faiapitracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcysharp%2Faiapitracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcysharp%2Faiapitracer/lists"}